[Blends-commit] r2073 - blends/trunk/webtools

Debian Pure Blends Subversion Commit noreply at alioth.debian.org
Fri Feb 5 13:50:14 UTC 2010


Author: tille
Date: Fri Feb  5 13:50:13 2010
New Revision: 2073
URL: http://svn.debian.org/viewsvn/blends?rev=2073&view=rev

Log:
Enhance report about available versions and archs


Modified:
   blends/trunk/webtools/blendstasktools.py

Modified: blends/trunk/webtools/blendstasktools.py
URL: http://svn.debian.org/viewsvn/blends/blends/trunk/webtools/blendstasktools.py?rev=2073&view=diff&r1=2073&r2=2072&p1=blends/trunk/webtools/blendstasktools.py&p2=blends/trunk/webtools/blendstasktools.py
==============================================================================
--- blends/trunk/webtools/blendstasktools.py	(original)
+++ blends/trunk/webtools/blendstasktools.py	Fri Feb  5 13:50:13 2010
@@ -271,15 +271,24 @@
 curs.execute(query)
 
 # Obtain available versions including the architectures where this version is available
-query = """PREPARE pkg_versions_arch (text, text) AS
-   SELECT release, regexp_replace(version, '^[0-9]:', '') AS version, array_to_string(array_accum(architecture),',') AS architectures FROM
-     ( SELECT architecture, version,
-          release || CASE WHEN char_length(substring(distribution from '-.*')) > 0 THEN substring(distribution from '-.*') ELSE '' END AS release FROM packages
-          WHERE package = $1 AND component = $2
-          GROUP BY architecture, version, release, distribution
-          ORDER BY architecture
-     ) AS av
-     GROUP BY version, release ORDER BY version DESC;"""
+#query = """PREPARE pkg_versions_arch (text, text) AS
+#   SELECT release, regexp_replace(version, '^[0-9]:', '') AS version, array_to_string(array_accum(architecture),',') AS architectures FROM
+#     ( SELECT architecture, version,
+#          release || CASE WHEN char_length(substring(distribution from '-.*')) > 0 THEN substring(distribution from '-.*') ELSE '' END AS release FROM packages
+#          WHERE package = $1 AND component = $2
+#          GROUP BY architecture, version, release, distribution
+#          ORDER BY architecture
+#     ) AS av
+#     GROUP BY version, release ORDER BY version DESC;"""
+query = """PREPARE pkg_versions_arch (text) AS
+   SELECT r as release, version, archs, component
+     FROM versions_archs_component($1) AS (r text, version text, archs text, component text)
+          -- you have to specify the column names because plain RECORD type is returned
+     JOIN releases ON releases.release = r
+          -- JOIN with release table to enable reasonable sorting
+    WHERE r NOT LIKE '%-%'
+          -- ignore releases like *-security etc.
+    ORDER BY releases.sort;"""
 curs.execute(query)
 
 # Obtain upstream version in case it is newer than Debian version
@@ -603,11 +612,15 @@
             if rel[0] != 'experimental':
                 has_official = 1
 
-        query = "EXECUTE pkg_versions_arch ('%s', '%s')" % (self.pkg, self.component)
+        # query = "EXECUTE pkg_versions_arch ('%s', '%s')" % (self.pkg, self.component)
+        query = "EXECUTE pkg_versions_arch ('%s')" % (self.pkg)
         curs.execute(query)
         if curs.rowcount > 0:
             for row in RowDictionaries(curs):
-                self.version.append({'release':row['release'], 'version': row['version'], 'archs':row['architectures']})
+                if self.component.startswith(row['component']):
+                    self.version.append({'release':row['release'], 'version': row['version'], 'archs':row['archs']})
+                else:
+                    self.version.append({'release':row['release'], 'version': row['version'] + ' (' + row['component'] + ')', 'archs':row['archs']})
 
         query = "EXECUTE pkg_dehs ('%s')" % (self.pkg)
         curs.execute(query)



More information about the Blends-commit mailing list