diff options
author | Mattia Rizzolo <mattia@mapreri.org> | 2015-02-27 00:32:48 +0100 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2015-03-01 14:37:30 +0100 |
commit | b85d08d121db51367cc79b551d8d939ceedcdf6b (patch) | |
tree | d818c986e3409499b69839128e3dc9ec1fea94db /bin/reproducible_html_packages.py | |
parent | dcc27dc3cd9e6682c1b24a3fa0d8cc4ac5472659 (diff) | |
download | jenkins.debian.net-b85d08d121db51367cc79b551d8d939ceedcdf6b.tar.xz |
reproducible: move packages files under a suite-named directory, e.g. /rb-pkg/sid/
Diffstat (limited to 'bin/reproducible_html_packages.py')
-rwxr-xr-x | bin/reproducible_html_packages.py | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py index 346d567d..a97d6573 100755 --- a/bin/reproducible_html_packages.py +++ b/bin/reproducible_html_packages.py @@ -166,8 +166,9 @@ def gen_packages_html(packages, suite='sid', arch='amd64', no_clean=False): links=links, bugs_links=bugs_links, default_view=default_view) - destfile = RB_PKG_PATH + '/' + pkg + '.html' - desturl = REPRODUCIBLE_URL + RB_PKG_URI + '/' + pkg + '.html' + destfile = RB_PKG_PATH + '/' + suite + '/' + arch + '/' + pkg + '.html' + desturl = REPRODUCIBLE_URL + RB_PKG_URI + '/' + suite + '/' + \ + arch + '/' + pkg + '.html' title = pkg + ' - reproducible build results' write_html_page(title=title, body=html, destfile=destfile, noheader=True, noendpage=True) @@ -185,16 +186,24 @@ def gen_all_rb_pkg_pages(suite='sid', arch='amd64', no_clean=False): gen_packages_html(pkgs, suite=suite, arch=arch, no_clean=no_clean) def purge_old_pages(): - presents = sorted(os.listdir(RB_PKG_PATH)) - for page in presents: - pkg = page.rsplit('.', 1)[0] - log.debug('Checking if ' + page + ' (from ' + pkg + ') is still needed') - query = 'SELECT s.name ' + \ - 'FROM results AS r JOIN sources AS s ON r.package_id=s.id ' + \ - 'WHERE s.name="%s" AND r.status != "" AND s.suite="sid"' % pkg - result = query_db(query) - if not result: # actually, the query produces no results - log.info('There is no package named ' + pkg + ' in the database.' + - ' Removing old page.') - os.remove(RB_PKG_PATH + '/' + page) + for suite in SUITES: + for arch in ARCHES: + log.info('Removing old pages from ' + suite + '...') + presents = sorted(os.listdir(RB_PKG_PATH + '/' + suite + '/' + + arch)) + for page in presents: + pkg = page.rsplit('.', 1)[0] + query = 'SELECT s.name ' + \ + 'FROM results AS r ' + \ + 'JOIN sources AS s ON r.package_id=s.id ' + \ + 'WHERE s.name="{name}" AND r.status != "" ' + \ + '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 + ' in the database. ' + + 'Removing old page.') + os.remove(RB_PKG_PATH + '/' + suite + '/' + arch + '/' + + page) |