From e84bd4035f694c5e0a49e00e4e9381743424963b Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Mon, 16 Mar 2015 13:40:05 +0100 Subject: reproducible: move check_candidates() and schedule_packages() to common_functions.sh --- bin/reproducible_common.sh | 36 ++++++++++++++++++++++++++++++++++ bin/reproducible_schedule_on_demand.sh | 36 ---------------------------------- 2 files changed, 36 insertions(+), 36 deletions(-) (limited to 'bin') diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh index b55dbdb4..3df77370 100755 --- a/bin/reproducible_common.sh +++ b/bin/reproducible_common.sh @@ -73,6 +73,42 @@ META_PKGSET[11]="grml" META_PKGSET[12]="grml_build-depends" META_PKGSET[13]="maint_pkg-perl-maintainers" +schedule_packages() { + # these packages are manually scheduled, so should have high priority, + # so schedule them in the past, so they are picked earlier :) + DATE="2014-10-01 00:23" + TMPFILE=$(mktemp) + for PKG_ID in $@ ; do + echo "REPLACE INTO schedule (package_id, date_scheduled, date_build_started) VALUES ('$PKG_ID', '$DATE', '');" >> $TMPFILE + done + cat $TMPFILE | sqlite3 -init $INIT ${PACKAGES_DB} + rm $TMPFILE + cd /srv/jenkins/bin + python3 -c "from reproducible_html_indexes import build_page; build_page('scheduled')" +} + +check_candidates() { + PACKAGES="" + PACKAGES_NAMES="" + TOTAL=0 + for PKG in $CANDIDATES ; do + RESULT=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT id, name from sources WHERE name='$PKG' AND suite='$SUITE';") + if [ ! -z "$RESULT" ] ; then + PACKAGES="$PACKAGES $(echo $RESULT|cut -d '|' -f 1)" + PACKAGES_NAMES="$PACKAGES_NAMES $(echo $RESULT|cut -d '|' -f 2)" + let "TOTAL+=1" + fi + done + case $TOTAL in + 1) + PACKAGES_TXT="package" + ;; + *) + PACKAGES_TXT="packages" + ;; + esac +} + write_page() { echo "$1" >> $PAGE } diff --git a/bin/reproducible_schedule_on_demand.sh b/bin/reproducible_schedule_on_demand.sh index 3ffdde57..0866ea0b 100755 --- a/bin/reproducible_schedule_on_demand.sh +++ b/bin/reproducible_schedule_on_demand.sh @@ -11,42 +11,6 @@ common_init "$@" # common code defining db access . /srv/jenkins/bin/reproducible_common.sh -schedule_packages() { - # these packages are manually scheduled, so should have high priority, - # so schedule them in the past, so they are picked earlier :) - DATE="2014-10-01 00:23" - TMPFILE=$(mktemp) - for PKG_ID in $@ ; do - echo "REPLACE INTO schedule (package_id, date_scheduled, date_build_started) VALUES ('$PKG_ID', '$DATE', '');" >> $TMPFILE - done - cat $TMPFILE | sqlite3 -init $INIT ${PACKAGES_DB} - rm $TMPFILE - cd /srv/jenkins/bin - python3 -c "from reproducible_html_indexes import build_page; build_page('scheduled')" -} - -check_candidates() { - PACKAGES="" - PACKAGES_NAMES="" - TOTAL=0 - for PKG in $CANDIDATES ; do - RESULT=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT id, name from sources WHERE name='$PKG' AND suite='$SUITE';") - if [ ! -z "$RESULT" ] ; then - PACKAGES="$PACKAGES $(echo $RESULT|cut -d '|' -f 1)" - PACKAGES_NAMES="$PACKAGES_NAMES $(echo $RESULT|cut -d '|' -f 2)" - let "TOTAL+=1" - fi - done - case $TOTAL in - 1) - PACKAGES_TXT="package" - ;; - *) - PACKAGES_TXT="packages" - ;; - esac -} - # # main # -- cgit v1.2.3-70-g09d2