From 955e4ceb12b155d3dc840f25197a11b663d09ecc Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Wed, 13 May 2015 19:41:29 +0200 Subject: reproducible: fix all users of gen_packages_html() after the refactoring of it notable changes: * gen_packages_html() in common.sh got renamed to the singular version gen_package_html() and now accept only one argument (a package name) + thus reproducible_blacklist.sh got fixed to pass one package at time + this greatly semplify the code, by removing *a lot* of crappy code * _html_all_packages.py really becomed a 2-liner, with part of its login being now either in _html_packages.py or removed. --- bin/reproducible_blacklist.sh | 6 ++++-- bin/reproducible_build.sh | 2 +- bin/reproducible_common.sh | 25 +++++-------------------- bin/reproducible_html_all_packages.py | 8 ++------ bin/reproducible_html_notes.py | 4 ++-- bin/reproducible_html_packages.py | 12 +++++++----- bin/reproducible_scheduler.py | 2 +- 7 files changed, 22 insertions(+), 37 deletions(-) (limited to 'bin') diff --git a/bin/reproducible_blacklist.sh b/bin/reproducible_blacklist.sh index f541deee..cbe153dc 100755 --- a/bin/reproducible_blacklist.sh +++ b/bin/reproducible_blacklist.sh @@ -81,9 +81,11 @@ else revert_blacklisted_packages fi -# notify -gen_packages_html $SUITE $PACKAGES +for PACKAGE in "$PACKAGES" ; do + gen_package_html $PACKAGE +done echo +# notify echo "$MESSAGE" kgb-client --conf /srv/jenkins/kgb/debian-reproducible.conf --relay-msg "$MESSAGE" echo diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index 09b493d8..7cd501e4 100755 --- a/bin/reproducible_build.sh +++ b/bin/reproducible_build.sh @@ -138,7 +138,7 @@ update_db_and_html() { fi # unmark build since it's properly finished sqlite3 -init $INIT ${PACKAGES_DB} "DELETE FROM schedule WHERE package_id='$SRCPKGID';" - gen_packages_html $SUITE $SRCPACKAGE + gen_package_html $SRCPACKAGE echo echo "Successfully updated the database and updated $REPRODUCIBLE_URL/rb-pkg/${SUITE}/${ARCH}/$SRCPACKAGE.html" echo diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh index 64854c4f..1ce6f630 100755 --- a/bin/reproducible_common.sh +++ b/bin/reproducible_common.sh @@ -346,27 +346,12 @@ link_packages() { if "$DEBUG" ; then set -x ; fi } -gen_packages_html() { - local suite="$1" - shift - CWD=$(pwd) +gen_package_html() { cd /srv/jenkins/bin - local i - for (( i=1; i<$#+1; i=i+100 )) ; do - local string='[' - local delimiter='' - local j - for (( j=0; j<100; j++)) ; do - local item=$(( $j+$i )) - if (( $item < $#+1 )) ; then - string+="${delimiter}\"${!item}\"" - delimiter=',' - fi - done - string+=']' - python3 -c "from reproducible_html_packages import gen_packages_html; gen_packages_html(${string}, suite=\"${suite}\", no_clean=True)" || echo "Warning: cannot update html pages for ${string} in ${suite}" - done - cd "$CWD" + python3 -c "import reproducible_html_packages as rep +pkg = rep.Package('$1', no_notes=True) +rep.gen_packages_html([pkg], no_clean=True)" || echo "Warning: cannot update html pages for $1" + cd - > /dev/null } calculate_build_duration() { diff --git a/bin/reproducible_html_all_packages.py b/bin/reproducible_html_all_packages.py index 3d347053..e339adf0 100755 --- a/bin/reproducible_html_all_packages.py +++ b/bin/reproducible_html_all_packages.py @@ -11,11 +11,7 @@ # code already written in reproducible_html_packages -from reproducible_common import * -from reproducible_html_packages import gen_all_rb_pkg_pages, purge_old_pages +from reproducible_html_packages import gen_all_rb_pkg_pages -for suite in SUITES: - for arch in ARCHS: - gen_all_rb_pkg_pages(suite=suite, arch=arch, no_clean=True) -purge_old_pages() +gen_all_rb_pkg_pages(no_clean=True) diff --git a/bin/reproducible_html_notes.py b/bin/reproducible_html_notes.py index b9c9bcea..8249ed87 100755 --- a/bin/reproducible_html_notes.py +++ b/bin/reproducible_html_notes.py @@ -322,7 +322,7 @@ def purge_old_notes(notes): except IndexError: # the package is not tested. this can happen if pass # a package got removed from the archive if to_rebuild: - gen_packages_html(to_rebuild, no_clean=True) + gen_packages_html([Package(x) for x in to_rebuild]) def purge_old_issues(issues): @@ -431,7 +431,7 @@ if __name__ == '__main__': index_issues(issues) purge_old_notes(notes) purge_old_issues(issues) - gen_packages_html(notes) # regenerate all rb-pkg/ pages + gen_packages_html([Package(x) for x in notes]) for suite in SUITES: for arch in ARCHS: build_page('notes', suite, arch) diff --git a/bin/reproducible_html_packages.py b/bin/reproducible_html_packages.py index ffc6aece..42fcf77e 100755 --- a/bin/reproducible_html_packages.py +++ b/bin/reproducible_html_packages.py @@ -232,12 +232,14 @@ def gen_packages_html(packages, no_clean=False): purge_old_pages() # housekeep is always good -def gen_all_rb_pkg_pages(suite='unstable', arch='amd64', no_clean=False): - query = 'SELECT name FROM sources WHERE suite="%s" AND architecture="%s"' % (suite, arch) +def gen_all_rb_pkg_pages(no_clean=False): + query = 'SELECT DISTINCT name FROM sources' rows = query_db(query) - pkgs = [str(i[0]) for i in rows] - log.info('Processing all ' + str(len(pkgs)) + ' package pages for ' + suite + '/' + arch +'.') - gen_packages_html(pkgs, suite=suite, arch=arch, no_clean=no_clean) + pkgs = [Package(str(i[0]), no_notes=True) for i in rows] + log.info('Processing all ' + str(len(pkgs)) + ' package from all suites/architectures') + gen_packages_html(pkgs, no_clean=True) # we clean at the end + purge_old_pages() + def purge_old_pages(): for suite in SUITES: diff --git a/bin/reproducible_scheduler.py b/bin/reproducible_scheduler.py index 4af23092..9a317eaa 100755 --- a/bin/reproducible_scheduler.py +++ b/bin/reproducible_scheduler.py @@ -149,7 +149,7 @@ def update_sources_db(suite, arch, sources): sys.exit(1) if pkgs_to_add: log.info('Building pages for the new packages') - gen_packages_html(pkgs_to_add, no_clean=True) + gen_packages_html([Package(x) for x in pkgs_to_add], no_clean=True) def print_schedule_result(suite, criteria, packages): -- cgit v1.2.3-54-g00ecf