diff options
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) |