[Blends-commit] r3336 - in /blends/trunk/webtools: blendstasktools.py templates/tasks.xhtml

tille at users.alioth.debian.org tille at users.alioth.debian.org
Sun May 20 19:56:30 UTC 2012


Author: tille
Date: Sun May 20 19:56:30 2012
New Revision: 3336

URL: http://svn.debian.org/wsvn/blends/?sc=1&rev=3336
Log:
Use information about Blends packages in Vcs on tasks pages

Modified:
    blends/trunk/webtools/blendstasktools.py
    blends/trunk/webtools/templates/tasks.xhtml

Modified: blends/trunk/webtools/blendstasktools.py
URL: http://svn.debian.org/wsvn/blends/blends/trunk/webtools/blendstasktools.py?rev=3336&op=diff
==============================================================================
--- blends/trunk/webtools/blendstasktools.py (original)
+++ blends/trunk/webtools/blendstasktools.py Sun May 20 19:56:30 2012
@@ -349,6 +349,17 @@
                    WHERE (p.package, p.version) IN  
                          (SELECT package, max(version) FROM
                    new_packages WHERE package = ANY ($1) GROUP BY package)"""
+_execute_udd_query(query)
+
+query = """PREPARE query_vcs (text[]) AS SELECT
+                   p.package,
+                   p.component, p.maintainer,
+                   p.source, p.section, 'vcs' AS release, p.component, p.homepage,
+                   p.changed_by, p.chlog_version AS version,
+                   description AS description_en, long_description AS long_description_en,
+                   p.blend
+                   FROM blends_prospectivepackages p
+                   WHERE package = ANY ($1)"""
 _execute_udd_query(query)
 
 # This prepared statement is called only once but it makes sense to mention it in the
@@ -1524,7 +1535,7 @@
                             	    logger.warning("Refuse to change Author string in %s: '%s'(%i) -> '%s'(%i)", \
                             	                    dep.pkg, to_unicode(row[pub]), row[pub].count(' and '), to_unicode(authors_string), authors_string.count(','))
                             	else:
-                        	    logger.info("Author string changed in %s: '%s' -> '%s'", dep.pkg, to_unicode(row[pub]), to_unicode(authors_string))
+                        	    logger.debug("Author string changed in %s: '%s' -> '%s'", dep.pkg, to_unicode(row[pub]), to_unicode(authors_string))
                                     row[pub] = authors_string
                         if not dep.properties.has_key('published'):
                             dep.properties['published'] = {}
@@ -1588,7 +1599,7 @@
                     self.dependencies['new'].append(dep)
                 dep.pkgstatus = 'new'
                 dep.component = row['component']
-                dep.version   = [{'release':'new', 'version': row['version'], 'archs':row['architecture']} , ]
+                dep.version   = [ row['version'], ]
                 dep.properties['pkg-url'] = 'http://ftp-master.debian.org/new/%s_%s.html' % (row['source'], row['version'])
                 # Warn about remaining information of prospective package
                 if ( dep.desc['en'] and dep.desc['en']['short'] ) or dep.properties['homepage'] != HOMEPAGENONE:
@@ -1636,7 +1647,66 @@
                             if found:
                                 break
 
-        # Verify whether packages which are neither in pool, new nor virtual have sufficient information in task file
+        pkgs_not_in_pool = []
+        for status in self.dependencies.keys():
+            for dep in self.dependencies[status]:
+                if dep.pkg not in pkgs_in_pool and dep.pkg not in pkgs_in_new and dep.pkg not in pkgs_virtual:
+                    pkgs_not_in_pool.append(dep.pkg)
+        # Gather information about packages in Vcs
+        query = "EXECUTE query_vcs('%s')" % List2PgArray(pkgs_not_in_pool)
+        _execute_udd_query(query)
+        pkgs_in_vcs = []
+        if curs.rowcount > 0:
+            for row in RowDictionaries(curs):
+		# print row
+                pkgs_in_vcs.append(row['package'])
+                # seek for package name in list of packages mentioned in tasks file
+                found = False
+                for status in self.dependencies.keys():
+                    for dep in self.dependencies[status]:
+                        if dep.pkg == row['package']:
+                            found = True
+                            break
+                    if found:
+                        break
+                if not found:
+                    # this should not happen ...
+                    logger.info("The package %s was found in vcs but never mentioned in task %s." % (row['package'], self.task))
+                    continue
+                # Check for korrekt status 'pkgvcs'
+                if status != 'pkgvcs':
+                    self.dependencies[status].remove(dep)
+                    self.dependencies['pkgvcs'].append(dep)
+                dep.pkgstatus = 'pkgvcs'
+                dep.component = row['component']
+                dep.version   = [ row['version'], ]
+                dep.debtags   = [] # prevent trying to print debtags (should be default setting but does not work in template (FIXME)
+                # Warn about remaining information of prospective package
+                if ( dep.desc['en'] and dep.desc['en']['short'] ) or dep.properties['homepage'] != HOMEPAGENONE:
+                    logger.info("The package %s is not yet in Debian but it is just in Blends %s Vcs. (Task %s)" % (dep.pkg, row['blend'], dep.taskname))
+                for prop in PROPERTIES:
+                    dep.properties[prop] = row[prop]
+                dep.desc['en']['short'] = MarkupString(to_unicode(row['description_en']), dep.pkg, 'ShortDesc - New')
+                dep.desc['en']['long']  = Markup(render_longdesc(row['long_description_en'].splitlines()))
+                (_name, _url) = email.Utils.parseaddr(row['maintainer'])
+                dep.responsible = '<a href="mailto:%s">%s</a>' % (_url, to_unicode(_name))
+                if row['changed_by']:
+                    try:
+                        changed = to_unicode(row['changed_by'])
+                    except TypeError, err:
+                        changed = None
+                        logger.warning("Encoding problem for changelog author in Vcs of package '%s' in task %s (%s)" % (dep.pkg, dep.taskname, err))
+                    if changed:
+                        try:
+                            (_name, _url) = email.Utils.parseaddr(changed)
+                            changed = '<a href="mailto:%s">%s</a>' % (_url, _name)
+                            dep.properties['changed_by']    = MarkupString(changed, dep.pkg, 'changed_by')
+                            dep.properties['last_uploader'] = to_unicode(changed)
+                            dep.properties['last_uploader_simple'] = to_unicode('%s <%s>' % (_name, _url))
+                        except UnicodeDecodeError, err:
+                            logger.error("Encoding problem for changer - assume same as maintainer for package %s (%s)", dep.pkg, err)
+
+        # Verify whether packages which are neither in pool, new, vcs nor virtual have sufficient information in task file
         for status in self.dependencies.keys():
             for dep in self.dependencies[status]:
                 if dep.pkg not in pkgs_in_pool and dep.pkg not in pkgs_in_new and dep.pkg not in pkgs_virtual and (dep.pkgstatus == 'unknown' or dep.pkgstatus == 'pkgvcs'):

Modified: blends/trunk/webtools/templates/tasks.xhtml
URL: http://svn.debian.org/wsvn/blends/blends/trunk/webtools/templates/tasks.xhtml?rev=3336&op=diff
==============================================================================
--- blends/trunk/webtools/templates/tasks.xhtml (original)
+++ blends/trunk/webtools/templates/tasks.xhtml Sun May 20 19:56:30 2012
@@ -95,6 +95,8 @@
              </div>
 	   </td>
 	   <td py:if="project.component" class="project-info">
+	    <div py:choose="">
+            <span py:when="project.pkgstatus != 'new' and project.pkgstatus != 'pkgvcs'">
 	     <span py:if="project.version != []" class="tooltip" id="${project.pkg}-versions">
 	       <table class="versionclass">
 		 <tr><th colspan="3" class="versionclass"><strong>Versions of package ${project.pkg}</strong></th></tr>
@@ -129,6 +131,11 @@
 		 <div class="project-infomissing"><a href="http://debtags.alioth.debian.org/edit.html?pkg=${project.pkg}">Go tagging</a></div>
 	       </div>
 	     </div>
+	    </span>
+            <span py:otherwise="">
+	     <span py:if="project.version != []">Version: ${project.version[0]}</span>
+            </span>
+            </div>
            </td>
            <td class="project-license">
              <em>${license}: ${project.properties['license']}</em>
@@ -142,7 +149,7 @@
 		 <span py:otherwise=""><a href="${project.properties['vcs-browser']}">${project.properties['vcs-type']}</a></span>
 	       </span>
 	     </div>
-            <div py:if="lang != 'en' and project.component == 'main'">
+            <div py:if="lang != 'en' and project.component == 'main' and project.pkgstatus != 'new' and project.pkgstatus != 'pkgvcs'">
 	       <div py:choose="">
 	           <div class="trans" py:when="project.desc.has_key(lang)"><a href="http://ddtp.debian.net/ddtss/index.cgi/${lang}/forexternalreview/${project.pkg}">${fixtranslation}</a></div>
 	           <div class="trans-missing" py:otherwise=""><a href="http://ddtp.debian.net/ddtss/index.cgi/${lang}/fetch?package=${project.pkg}">${translatedesc}</a></div>
@@ -194,7 +201,7 @@
 	       <span class="year" py:if="project.properties['published'].has_key('year')">(${project.properties['published']['year']})</span>
 	     </div>
 	   </td>
-	   <td py:if="project.component" class="project-icon">
+	   <td py:if="project.component and project.pkgstatus != 'new' and project.pkgstatus != 'pkgvcs'" class="project-icon">
 	     <div py:choose="">
 	       <div py:when="project.icon != None">
 		 <span class="tooltip" id="${project.pkg}-screenshot">




More information about the Blends-commit mailing list