diff options
author | Valerie R Young <spectranaut@riseup.net> | 2016-07-29 17:46:22 -0400 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2016-07-29 17:53:03 -0400 |
commit | 513ea8839f6eee18d228e11a6152a15bb4e4d689 (patch) | |
tree | 5c4f9628afdb5e12796fefb9fdb586bfce248497 /bin | |
parent | c31a41e721799b8df060bd71ed2e052472aa8a50 (diff) | |
download | jenkins.debian.net-513ea8839f6eee18d228e11a6152a15bb4e4d689.tar.xz |
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@layer-acht.org>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/reproducible_html_packages.py | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py index 38e11e09..765826a5 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) |