[PATCH] Rework META_PKGSET; no functional change.

Daniel Shahaf danielsh at apache.org
Thu Nov 10 15:58:14 UTC 2016


---
Revised to avoid the Python '_ variable' idiom as per feedback on IRC.

Also available as:
    git fetch ssh://git.debian.org/~danielsh-guest/src/jenkins.debian.net 5ec252e861de

Cheers,

Daniel

 bin/reproducible_common.py        | 6 ++----
 bin/reproducible_html_pkg_sets.py | 7 ++-----
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index b23cb0e..f901d34 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -89,12 +89,10 @@ JENKINS_URL = 'https://jenkins.debian.net'
 # global package set definitions
 # META_PKGSET[pkgset_id] = (pkgset_name, pkgset_group)
 # csv file columns: (pkgset_group, pkgset_name)
-META_PKGSET = {}
-pkgset_id = 0
+META_PKGSET = []
 with open(os.path.join(BIN_PATH, './reproducible_pkgsets.csv'), newline='') as f:
     for line in csv.reader(f):
-        pkgset_id += 1
-        META_PKGSET[pkgset_id] = (line[1], line[0])
+        META_PKGSET.append((line[1], line[0]))
 
 # init the database data and connection
 DB_ENGINE = create_engine("sqlite:///" + REPRODUCIBLE_DB, connect_args={'timeout': 60})
diff --git a/bin/reproducible_html_pkg_sets.py b/bin/reproducible_html_pkg_sets.py
index 0cf155c..71c0564 100755
--- a/bin/reproducible_html_pkg_sets.py
+++ b/bin/reproducible_html_pkg_sets.py
@@ -117,9 +117,7 @@ def update_stats(suite, arch, stats, pkgset_name):
 def create_pkgset_navigation(suite, arch, view=None):
     # Group the package sets by section
     sections = OrderedDict()
-    for index in range(1, len(META_PKGSET)+1):
-        pkgset_name = META_PKGSET[index][0]
-        pkgset_section = META_PKGSET[index][1]
+    for pkgset_name, pkgset_section in META_PKGSET:
         pkgset = {
             'class': "active" if pkgset_name == view else "",
             'pkgset_name': pkgset_name,
@@ -302,8 +300,7 @@ for arch in ARCHS:
         if suite == 'experimental':
             continue
         create_index_page(suite, arch)
-        for index in META_PKGSET:
-            pkgset_name = META_PKGSET[index][0]
+        for pkgset_name, pkgset_version in META_PKGSET:
             stats = gather_meta_stats(suite, arch, pkgset_name)
             if (stats):
                 update_stats(suite, arch, stats, pkgset_name)



More information about the Reproducible-builds mailing list