[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] *.py: use distro agnostic variable names in configurable settings

Holger Levsen gitlab at salsa.debian.org
Tue May 29 13:46:54 BST 2018


Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net


Commits:
19159b18 by Eli Schwartz at 2018-05-29T12:46:27+00:00
*.py: use distro agnostic variable names in configurable settings

Using e.g. DEBIAN_BASE to find the jenkins basedir ending in archlinux/
was confusing me a lot until I figured this out. It makes sense to use
variable names that do not imply something they are not, in order to
prevent other people from being similarly confused.

- - - - -


9 changed files:

- bin/reproducible_common.py
- bin/reproducible_html_breakages.py
- bin/reproducible_html_dd_list.py
- bin/reproducible_html_indexes.py
- bin/reproducible_html_live_status.py
- bin/reproducible_html_notes.py
- bin/reproducible_html_packages.py
- bin/reproducible_html_pkg_sets.py
- bin/reproducible_json.py


Changes:

=====================================
bin/reproducible_common.py
=====================================
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -99,19 +99,19 @@ TEMP_PATH = conf_distro['tempdir']
 
 REPRODUCIBLE_STYLES = os.path.join(BASE, conf_distro['css'])
 
-DEBIAN_URI = '/' + conf_distro['distro_root']
-DEBIAN_BASE = os.path.join(BASE, conf_distro['distro_root'])
-
-DBD_URI = os.path.join(DEBIAN_URI, conf_distro['diffoscope_html'])
-DBDTXT_URI = os.path.join(DEBIAN_URI, conf_distro['diffoscope_txt'])
-LOGS_URI = os.path.join(DEBIAN_URI, conf_distro['buildlogs'])
-DIFFS_URI = os.path.join(DEBIAN_URI, conf_distro['logdiffs'])
-NOTES_URI = os.path.join(DEBIAN_URI, conf_distro['notes'])
-ISSUES_URI = os.path.join(DEBIAN_URI, conf_distro['issues'])
-RB_PKG_URI = os.path.join(DEBIAN_URI, conf_distro['packages'])
-RBUILD_URI = os.path.join(DEBIAN_URI, conf_distro['rbuild'])
-HISTORY_URI = os.path.join(DEBIAN_URI, conf_distro['pkghistory'])
-BUILDINFO_URI = os.path.join(DEBIAN_URI, conf_distro['buildinfo'])
+DISTRO_URI = '/' + conf_distro['distro_root']
+DISTRO_BASE = os.path.join(BASE, conf_distro['distro_root'])
+
+DBD_URI = os.path.join(DISTRO_URI, conf_distro['diffoscope_html'])
+DBDTXT_URI = os.path.join(DISTRO_URI, conf_distro['diffoscope_txt'])
+LOGS_URI = os.path.join(DISTRO_URI, conf_distro['buildlogs'])
+DIFFS_URI = os.path.join(DISTRO_URI, conf_distro['logdiffs'])
+NOTES_URI = os.path.join(DISTRO_URI, conf_distro['notes'])
+ISSUES_URI = os.path.join(DISTRO_URI, conf_distro['issues'])
+RB_PKG_URI = os.path.join(DISTRO_URI, conf_distro['packages'])
+RBUILD_URI = os.path.join(DISTRO_URI, conf_distro['rbuild'])
+HISTORY_URI = os.path.join(DISTRO_URI, conf_distro['pkghistory'])
+BUILDINFO_URI = os.path.join(DISTRO_URI, conf_distro['buildinfo'])
 DBD_PATH = BASE + DBD_URI
 DBDTXT_PATH = BASE + DBDTXT_URI
 LOGS_PATH = BASE + LOGS_URI
@@ -123,12 +123,12 @@ RBUILD_PATH = BASE + RBUILD_URI
 HISTORY_PATH = BASE + HISTORY_URI
 BUILDINFO_PATH = BASE + BUILDINFO_URI
 
-REPRODUCIBLE_JSON = os.path.join(DEBIAN_BASE, conf_distro['json_out'])
-REPRODUCIBLE_TRACKER_JSON = os.path.join(DEBIAN_BASE, conf_distro['tracker.json_out'])
+REPRODUCIBLE_JSON = os.path.join(DISTRO_BASE, conf_distro['json_out'])
+REPRODUCIBLE_TRACKER_JSON = os.path.join(DISTRO_BASE, conf_distro['tracker.json_out'])
 
 REPRODUCIBLE_URL = conf_distro['base_url']
-DEBIAN_URL = urljoin(REPRODUCIBLE_URL, conf_distro['distro_root'])
-DEBIAN_DASHBOARD_URI = os.path.join(DEBIAN_URI, conf_distro['landing_page'])
+DISTRO_URL = urljoin(REPRODUCIBLE_URL, conf_distro['distro_root'])
+DISTRO_DASHBOARD_URI = os.path.join(DISTRO_URI, conf_distro['landing_page'])
 JENKINS_URL = conf_distro['jenkins_url']
 
 # global package set definitions
@@ -178,7 +178,7 @@ log.debug("BUILDINFO_PATH:\t" + BUILDINFO_PATH)
 log.debug("REPRODUCIBLE_JSON:\t" + REPRODUCIBLE_JSON)
 log.debug("JENKINS_URL:\t\t" + JENKINS_URL)
 log.debug("REPRODUCIBLE_URL:\t" + REPRODUCIBLE_URL)
-log.debug("DEBIAN_URL:\t" + DEBIAN_URL)
+log.debug("DISTRO_URL:\t" + DISTRO_URL)
 
 if args.ignore_missing_files:
     log.warning("Missing files will be ignored!")
@@ -346,7 +346,7 @@ def create_main_navigation(suite=defaultsuite, arch=defaultarch,
         'arch_nav': {
             'arch_list': arch_list
         } if len(arch_list) else '',
-        'debian_uri': DEBIAN_DASHBOARD_URI,
+        'debian_uri': DISTRO_DASHBOARD_URI,
         'cross_suite_arch_nav': True if suite_arch_nav_template else False,
     }
     if suite != 'experimental':


=====================================
bin/reproducible_html_breakages.py
=====================================
--- a/bin/reproducible_html_breakages.py
+++ b/bin/reproducible_html_breakages.py
@@ -294,7 +294,7 @@ def _gen_files_html(header, entries):
     return html
 
 def create_breakages_graph(png_file, main_label):
-    png_fullpath = os.path.join(DEBIAN_BASE, png_file)
+    png_fullpath = os.path.join(DISTRO_BASE, png_file)
     table = "stats_breakages"
     columns = ["datum", "diffoscope_timeouts", "diffoscope_crashes"]
     query = "SELECT {fields} FROM {table} ORDER BY datum".format(
@@ -408,8 +408,8 @@ if __name__ == '__main__':
         html += '<p><b>COOL!!!</b> Everything is GOOD and not a single issue was '
         html += 'detected. <i>Enjoy!</i></p>'
     title = 'Breakage on the Debian pages of tests.reproducible-builds.org'
-    destfile = DEBIAN_BASE + '/index_breakages.html'
-    desturl = DEBIAN_URL + '/index_breakages.html'
+    destfile = DISTRO_BASE + '/index_breakages.html'
+    desturl = DISTRO_URL + '/index_breakages.html'
 
     left_nav_html = create_main_navigation(displayed_page='breakages')
     write_html_page(title, html, destfile, style_note=True,


=====================================
bin/reproducible_html_dd_list.py
=====================================
--- a/bin/reproducible_html_dd_list.py
+++ b/bin/reproducible_html_dd_list.py
@@ -72,11 +72,11 @@ for suite in SUITES:
             html += '\n'
         html += '</pre></p>'
         title = 'Maintainers of unreproducible packages in ' + suite
-        destfile = DEBIAN_BASE + '/' + suite + '/index_dd-list.html'
-        suite_arch_nav_template = DEBIAN_URI + '/{{suite}}/index_dd-list.html'
+        destfile = DISTRO_BASE + '/' + suite + '/index_dd-list.html'
+        suite_arch_nav_template = DISTRO_URI + '/{{suite}}/index_dd-list.html'
         left_nav_html = create_main_navigation(suite=suite, arch=arch,
             displayed_page='dd_list', no_arch=True,
             suite_arch_nav_template=suite_arch_nav_template)
         write_html_page(title, html, destfile, style_note=True,
                         left_nav_html=left_nav_html)
-        log.info('%s/%s/index_dd-list.html published', DEBIAN_URL, suite)
+        log.info('%s/%s/index_dd-list.html published', DISTRO_URL, suite)


=====================================
bin/reproducible_html_indexes.py
=====================================
--- a/bin/reproducible_html_indexes.py
+++ b/bin/reproducible_html_indexes.py
@@ -772,15 +772,15 @@ def build_page(page, suite=None, arch=None):
             footnote = True if footnote1 else footnote
     suite_arch_nav_template = None
     if gpage:
-        destfile = DEBIAN_BASE + '/index_' + page + '.html'
-        desturl = DEBIAN_URL + '/index_' + page + '.html'
+        destfile = DISTRO_BASE + '/index_' + page + '.html'
+        desturl = DISTRO_URL + '/index_' + page + '.html'
         suite = defaultsuite  # used for the links in create_main_navigation
     else:
-        destfile = DEBIAN_BASE + '/' + suite + '/' + arch + '/index_' + \
+        destfile = DISTRO_BASE + '/' + suite + '/' + arch + '/index_' + \
                    page + '.html'
-        desturl = DEBIAN_URL + '/' + suite + '/' + arch + '/index_' + \
+        desturl = DISTRO_URL + '/' + suite + '/' + arch + '/index_' + \
                   page + '.html'
-        suite_arch_nav_template = DEBIAN_URI + '/{{suite}}/{{arch}}/index_' + \
+        suite_arch_nav_template = DISTRO_URI + '/{{suite}}/{{arch}}/index_' + \
                                   page + '.html'
     left_nav_html = create_main_navigation(
         suite=suite,


=====================================
bin/reproducible_html_live_status.py
=====================================
--- a/bin/reproducible_html_live_status.py
+++ b/bin/reproducible_html_live_status.py
@@ -85,9 +85,9 @@ def generate_schedule(arch):
         html += link_package(pkg, row[1], row[2], bugs)
         html += '</code></td><td>'+convert_into_status_html(str(row[4]))+'</td><td>'+duration+'</td><td>' + avg_duration + '</td></tr>\n'
     html += '</table></p>\n'
-    destfile = DEBIAN_BASE + '/index_' + arch + '_scheduled.html'
-    desturl = DEBIAN_URL + '/index_' + arch + '_scheduled.html'
-    suite_arch_nav_template = DEBIAN_URI + '/index_{{arch}}_scheduled.html'
+    destfile = DISTRO_BASE + '/index_' + arch + '_scheduled.html'
+    desturl = DISTRO_URL + '/index_' + arch + '_scheduled.html'
+    suite_arch_nav_template = DISTRO_URI + '/index_{{arch}}_scheduled.html'
     left_nav_html = create_main_navigation(arch=arch, no_suite=True,
         displayed_page='scheduled', suite_arch_nav_template=suite_arch_nav_template)
     write_html_page(title=title, body=html, destfile=destfile, style_note=True,
@@ -190,8 +190,8 @@ def generate_oldies(arch):
             html += link_package(pkg, row[0], row[1], bugs)
             html += '</code></td><td>'+convert_into_status_html(str(row[3]))+'</td><td>' + row[4] + '</td></tr>\n'
         html += '</table></p>\n'
-    destfile = DEBIAN_BASE + '/index_' + arch + '_oldies.html'
-    desturl = DEBIAN_URL + '/index_' + arch + '_oldies.html'
+    destfile = DISTRO_BASE + '/index_' + arch + '_oldies.html'
+    desturl = DISTRO_URL + '/index_' + arch + '_oldies.html'
     left_nav_html = create_main_navigation(arch=arch)
     write_html_page(title=title, body=html, destfile=destfile, style_note=True,
                     refresh_every=60, left_nav_html=left_nav_html)
@@ -201,4 +201,3 @@ if __name__ == '__main__':
     for arch in ARCHS:
         generate_schedule(arch)
         generate_oldies(arch)
-


=====================================
bin/reproducible_html_notes.py
=====================================
--- a/bin/reproducible_html_notes.py
+++ b/bin/reproducible_html_notes.py
@@ -467,8 +467,8 @@ def index_issues(issues, scorefuncs):
             '</b> issues.</p>'
     html += tab*2 + '<p>' + NOTESGIT_DESCRIPTION + '</p>'
     title = 'Known issues related to reproducible builds'
-    destfile = DEBIAN_BASE + '/index_issues.html'
-    desturl = DEBIAN_URL + '/index_issues.html'
+    destfile = DISTRO_BASE + '/index_issues.html'
+    desturl = DISTRO_URL + '/index_issues.html'
     left_nav_html = create_main_navigation(displayed_page='issues')
     write_html_page(title=title, body=html, destfile=destfile,
                     left_nav_html=left_nav_html)


=====================================
bin/reproducible_html_packages.py
=====================================
--- a/bin/reproducible_html_packages.py
+++ b/bin/reproducible_html_packages.py
@@ -107,7 +107,7 @@ def get_and_clean_dbd_links(package, eversion, suite, arch, status):
         }
     else:
         if status == 'unreproducible' and not args.ignore_missing_files:
-            log.critical(DEBIAN_URL + '/' + suite + '/' + arch + '/' + package +
+            log.critical(DISTRO_URL + '/' + suite + '/' + arch + '/' + package +
                          ' is unreproducible, but without diffoscope output.')
         # if there are no diffoscope results, we want to remove the old package
         # page used to display diffoscope results
@@ -169,7 +169,7 @@ def gen_suitearch_details(package, version, suite, arch, status, spokenstatus,
                                                           suite, arch)
     elif status not in ('untested', 'blacklisted') and \
          not args.ignore_missing_files:
-        log.critical(DEBIAN_URL  + '/' + suite + '/' + arch + '/' + package +
+        log.critical(DISTRO_URL  + '/' + suite + '/' + arch + '/' + package +
                      ' didn\'t produce a buildlog, even though it has been built.')
 
     context['has_buildloginfo'] = 'buildinfo_uri' in context or \
@@ -384,7 +384,7 @@ def gen_packages_html(packages, no_clean=False):
                     'suitearch_section_html': suitearch_section_html,
                     'project_links_html': project_links,
                     'reproducible': reproducible,
-                    'dashboard_url': DEBIAN_URL,
+                    'dashboard_url': DISTRO_URL,
                     'desturl': desturl,
                 })
 
@@ -481,7 +481,7 @@ def purge_old_pages():
                 pkg = page.rsplit('.', 1)[0]
                 if (pkg, suite, arch) not in cur_pkgs:
                     log.info('There is no package named ' + pkg + ' from ' +
-                             suite + '/' + arch + '/diffoscope-results in ' + 
+                             suite + '/' + arch + '/diffoscope-results in ' +
                              'the database. Removing old page.')
                     os.remove(RB_PKG_PATH + '/' + suite + '/' + arch + '/' +
                               'diffoscope-results/' + page)


=====================================
bin/reproducible_html_pkg_sets.py
=====================================
--- a/bin/reproducible_html_pkg_sets.py
+++ b/bin/reproducible_html_pkg_sets.py
@@ -141,9 +141,9 @@ def create_pkgset_navigation(suite, arch, view=None):
 def create_index_page(suite, arch):
     title = 'Package sets in %s/%s' % (suite, arch)
     body = create_pkgset_navigation(suite, arch)
-    destfile = os.path.join(DEBIAN_BASE, suite, arch,
+    destfile = os.path.join(DISTRO_BASE, suite, arch,
                             "index_pkg_sets.html")
-    suite_arch_nav_template = DEBIAN_URI + \
+    suite_arch_nav_template = DISTRO_URI + \
                               '/{{suite}}/{{arch}}/index_pkg_sets.html'
     left_nav_html = create_main_navigation(
         suite=suite,
@@ -170,7 +170,7 @@ def gen_other_arch_context(archs, suite, pkgset_name):
 
 
 def stats_png_file_href(suite, arch, pkgset_name):
-    return (os.path.join(DEBIAN_BASE, suite, arch, 'stats_meta_pkg_state_' +
+    return (os.path.join(DISTRO_BASE, suite, arch, 'stats_meta_pkg_state_' +
                          pkgset_name + '.png'),
             "/".join(["/debian", suite, arch, 'stats_meta_pkg_state_' +
                       pkgset_name + '.png'])
@@ -178,7 +178,7 @@ def stats_png_file_href(suite, arch, pkgset_name):
 
 
 def stats_thumb_file_href(suite, arch, pkgset_name):
-    return (os.path.join(DEBIAN_BASE, suite, arch, 'stats_meta_pkg_state_' +
+    return (os.path.join(DISTRO_BASE, suite, arch, 'stats_meta_pkg_state_' +
                          pkgset_name + '-thumbnail.png'),
             "/".join(["/debian", suite, arch, 'stats_meta_pkg_state_' +
                       pkgset_name + '-thumbnail.png'])
@@ -247,8 +247,8 @@ def create_pkgset_page_and_graphs(suite, arch, stats, pkgset_name):
     title = '%s package set for %s/%s' % \
             (pkgset_name, suite, arch)
     page = "pkg_set_" + pkgset_name + ".html"
-    destfile = os.path.join(DEBIAN_BASE, suite, arch, page)
-    suite_arch_nav_template = DEBIAN_URI + '/{{suite}}/{{arch}}/' + page
+    destfile = os.path.join(DISTRO_BASE, suite, arch, page)
+    suite_arch_nav_template = DISTRO_URI + '/{{suite}}/{{arch}}/' + page
     left_nav_html = create_main_navigation(
         suite=suite,
         arch=arch,


=====================================
bin/reproducible_json.py
=====================================
--- a/bin/reproducible_json.py
+++ b/bin/reproducible_json.py
@@ -116,7 +116,7 @@ for data, target in (
         json.dump(data, fd, indent=4, sort_keys=True)
     os.rename(tmpfile, target)
     os.chmod(target, 0o644)
-    log.info("%s/%s has been updated.", DEBIAN_URL, os.path.basename(target))
+    log.info("%s/%s has been updated.", DISTRO_URL, os.path.basename(target))
 
     # Write compressed version
     compressed = '{}.bz2'.format(target)
@@ -125,4 +125,4 @@ for data, target in (
         subprocess.check_call(('bzip2', '-9c', target), stdout=fd)
     os.rename(tmpfile, compressed)
     os.chmod(compressed, 0o644)
-    log.info("%s/%s has been updated.", DEBIAN_URL, os.path.basename(compressed))
+    log.info("%s/%s has been updated.", DISTRO_URL, os.path.basename(compressed))



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/commit/19159b18f3c25be89364aea39654aea7709ac818

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/commit/19159b18f3c25be89364aea39654aea7709ac818
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20180529/ed84d904/attachment-0001.html>


More information about the Qa-jenkins-scm mailing list