[Qa-jenkins-scm] [jenkins.debian.net] 02/02: reproducible debian: rename diffoscope results directory and clean pages

Holger Levsen holger at layer-acht.org
Fri Jul 29 21:53:18 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 513ea8839f6eee18d228e11a6152a15bb4e4d689
Author: Valerie R Young <spectranaut at riseup.net>
Date:   Fri Jul 29 17:46:22 2016 -0400

    reproducible debian: rename diffoscope results directory and clean pages
    
    Renamed from "diffoscope" to "diffoscope-results" to differentiate
    from package named "diffoscope".
    Also clean pages in new directory when packages disappear from database.
    
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 bin/reproducible_html_packages.py | 38 ++++++++++++++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py
index 38e11e0..765826a 100755
--- a/bin/reproducible_html_packages.py
+++ b/bin/reproducible_html_packages.py
@@ -73,14 +73,14 @@ def get_dbd_links(package, eversion, suite, arch):
                        + '.diffoscope.html')
     dbdtxt_file = os.path.join(DBDTXT_PATH, suite, arch, package + '_' + eversion
                           + '.diffoscope.txt.gz')
-    dbd_page_file = os.path.join(RB_PKG_PATH, suite, arch, 'diffoscope', package +
-                                 '.html')
+    dbd_page_file = os.path.join(RB_PKG_PATH, suite, arch, 'diffoscope-results',
+                                 package + '.html')
     dbd_uri = DBD_URI + '/' + suite + '/' + arch + '/' +  package + '_' + \
               eversion + '.diffoscope.html'
     dbdtxt_uri = DBDTXT_URI + '/' + suite + '/' + arch + '/' +  package + '_' + \
                 eversion + '.diffoscope.txt'
-    dbd_page_uri = RB_PKG_URI + '/' + suite + '/' + arch + '/diffoscope/' + \
-                   package + '.html'
+    dbd_page_uri = RB_PKG_URI + '/' + suite + '/' + arch + \
+                   '/diffoscope-results/' + package + '.html'
     links = {}
     # only return dbd_uri and dbdtext_uri if they exist
     if os.access(dbd_file, os.R_OK):
@@ -438,6 +438,11 @@ def purge_old_pages():
                 presents = []
             log.debug('page presents: ' + str(presents))
             for page in presents:
+                # When diffoscope results exist for a package, we create a page
+                # that displays the diffoscope results by default in the main iframe
+                # in this subdirectory. Ignore this directory.
+                if page == 'diffoscope-results':
+                    continue
                 pkg = page.rsplit('.', 1)[0]
                 query = 'SELECT s.name ' + \
                     'FROM sources AS s ' + \
@@ -452,3 +457,28 @@ def purge_old_pages():
                     os.remove(RB_PKG_PATH + '/' + suite + '/' + arch + '/' +
                               page)
 
+            # Additionally clean up the diffoscope results default pages
+            log.info('Removing old pages from ' + suite + '/' + arch +
+                     '/diffoscope-results/.')
+            try:
+                presents = sorted(os.listdir(RB_PKG_PATH + '/' + suite + '/' +
+                                             arch + '/diffoscope-results'))
+            except OSError as e:
+                if e.errno != errno.ENOENT:  # that's 'No such file or
+                    raise                    # directory' error (errno 17)
+                presents = []
+            log.debug('diffoscope page presents: ' + str(presents))
+            for page in presents:
+                pkg = page.rsplit('.', 1)[0]
+                query = 'SELECT s.name ' + \
+                    'FROM sources AS s ' + \
+                    'WHERE s.name="{name}" ' + \
+                    'AND s.suite="{suite}" AND s.architecture="{arch}"'
+                query = query.format(name=pkg, suite=suite, arch=arch)
+                result = query_db(query)
+                if not result: # actually, the query produces no results
+                    log.info('There is no package named ' + pkg + ' from ' +
+                             suite + '/' + arch + '/diffoscope-results in ' + 
+                             'the database. Removing old page.')
+                    os.remove(RB_PKG_PATH + '/' + suite + '/' + arch + '/' +
+                              'diffoscope-results/' + page)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list