[Qa-jenkins-scm] [jenkins.debian.net] 03/06: reproducible: fix all users of gen_packages_html() after the refactoring of it
Holger Levsen
holger at moszumanska.debian.org
Sat Aug 15 10:51:21 UTC 2015
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 955e4ceb12b155d3dc840f25197a11b663d09ecc
Author: Mattia Rizzolo <mattia at mapreri.org>
Date: Wed May 13 19:41:29 2015 +0200
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(-)
diff --git a/bin/reproducible_blacklist.sh b/bin/reproducible_blacklist.sh
index f541dee..cbe153d 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 09b493d..7cd501e 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 64854c4..1ce6f63 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 3d34705..e339adf 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 b9c9bce..8249ed8 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 ffc6aec..42fcf77 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 4af2309..9a317ea 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):
--
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