[Blends-commit] [SCM] website branch, master, updated. c4486d10a320c16413bfc394a3c813032d881027

Akshita Jha akshita-guest at users.alioth.debian.org
Wed Jul 29 21:39:36 UTC 2015


The following commit has been merged in the master branch:
commit c4486d10a320c16413bfc394a3c813032d881027
Author: Akshita Jha <akshita-guest at users.alioth.debian.org>
Date:   Thu Jul 30 00:00:37 2015 +0530

    Modify blendstasktools_udd.py : Fix the order of Versions and Archs. The release order is as per the 'sort' field of 'releases' table in UDD.

diff --git a/webtools_py3/blendstasktools_udd.py b/webtools_py3/blendstasktools_udd.py
index 8d0109e..cb248da 100644
--- a/webtools_py3/blendstasktools_udd.py
+++ b/webtools_py3/blendstasktools_udd.py
@@ -292,7 +292,6 @@ def _execute_udd_query(query):
     except psycopg2.DataError as err:
         print("%s; query was\n%s" % (err, query), file=stderr)
 
-
 query = """PREPARE query_pkgs (text[],text[]) AS
         SELECT * FROM blends_query_packages($1,$2) AS (
           package text, distribution text, release text, component text, version debversion,
@@ -475,6 +474,13 @@ _execute_udd_query(query)
 query = "PREPARE popcon_submissions AS SELECT vote FROM popcon WHERE package = '_submissions'"
 _execute_udd_query(query)
 
+# Get the releases ordered by sort field in 'releases' table
+release_order = {}
+query = "SELECT release, sort FROM releases ORDER BY sort"
+_execute_udd_query(query)
+if curs.rowcount > 0:
+    for release in curs.fetchall():
+        release_order[release[0]] = release[1]
 
 def List2PgArray(list):
     # turn a list of strings into the syntax for a PostgreSQL array:
@@ -839,10 +845,9 @@ class Tasks:
                 translations = metapkg_translations[pkgname]
         
             td.SetMetapackageInfo(pkgname, translations)
-            logger.debug("Task : %s " % task)	    
+            logger.debug("Task : %s " % task)
             if td.GetTaskDependencies(source):
                 self.tasks[task] = td
-            
             else: # Kick file that is obviously no task file from metapackage list
                 self.metapackagekeys = [name for name in self.metapackagekeys if name != task]
 
@@ -1132,8 +1137,12 @@ class TaskDependencies:
 
 
             if 'releases' in row:
-                for i in range(len(row['releases'])):
+                # reorder the 'releases' based on the release order (as per 'sort' field in releases table)
+                # also reorder the corresponding 'versions' and 'architectures' with the 'releases'
+                row['releases'], row['versions'], row['architectures'] = (list(r) for r in zip(*sorted(zip(row['releases'], row['versions'], row['architectures']),                                                                                                 key=lambda x: release_order[x[0]])))
+                for i in range(len(row['releases'])): 
                     dep.version.append({'release':row['releases'][i], 'version': row['versions'][i], 'archs':row['architectures'][i]})
+
             
             if 'vote' in row:
                 dep.popcon['vote']   = row['vote']

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list