diff options
author | Mattia Rizzolo <mattia@mapreri.org> | 2015-04-06 15:04:08 +0200 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2015-04-18 17:20:08 +0200 |
commit | 869c4ef9876b3164609e061f872ce3c956687736 (patch) | |
tree | af3458ff94da3eb5ad608298f8f8536b4f38cc0c /bin | |
parent | 1442af4d1a169c028ad74d8de64a5b388d7ea310 (diff) | |
download | jenkins.debian.net-869c4ef9876b3164609e061f872ce3c956687736.tar.xz |
reproducible: build: refactor: lift up the handle_* functions
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/reproducible_build.sh | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index ed650515..67aec9bf 100755 --- a/bin/reproducible_build.sh +++ b/bin/reproducible_build.sh @@ -81,6 +81,34 @@ print_out_duration() { echo "$(date) - total duration: ${HOUR}h ${MIN}m ${SEC}s." | tee -a ${RBUILDLOG} } +handle_404() { + echo "Warning: Download of ${SRCPACKAGE} sources from ${SUITE} failed." | tee -a ${RBUILDLOG} + ls -l ${SRCPACKAGE}* | tee -a ${RBUILDLOG} + sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO results (package_id, version, status, build_date, build_duration) VALUES ('${SRCPKGID}', 'None', '404', '$DATE', '')" + echo "Warning: Maybe there was a network problem, or ${SRCPACKAGE} is not a source package in ${SUITE}, or was removed or renamed. Please investigate." | tee -a ${RBUILDLOG} + update_db_and_html + if [ $SAVE_ARTIFACTS -eq 1 ] ; then SAVE_ARTIFACTS=2 ; fi + exit 0 +} + +handle_not_for_us() { + # a list of valid architecture for this package should be passed to this function + sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO results (package_id, version, status, build_date, build_duration) VALUES ('${SRCPKGID}', '${VERSION}', 'not for us', '$DATE', '')" + echo "Package ${SRCPACKAGE} (${VERSION}) shall only be build on \"$(echo "$@" | xargs echo )\" and thus was skipped." | tee -a ${RBUILDLOG} + update_db_and_html + if [ $SAVE_ARTIFACTS -eq 1 ] ; then SAVE_ARTIFACTS=2 ; fi + exit 0 +} + +handle_ftbfs() { + echo "${SRCPACKAGE} failed to build from source." + calculate_build_duration + sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO results (package_id, version, status, build_date, build_duration) VALUES ('${SRCPKGID}', '${VERSION}', 'FTBFS', '$DATE', '$DURATION')" + sqlite3 -init $INIT ${PACKAGES_DB} "INSERT INTO stats_build (name, version, suite, architecture, status, build_date, build_duration) VALUES ('${SRCPACKAGE}', '${VERSION}', '${SUITE}', '${ARCH}', 'FTBFS', '${DATE}', '${DURATION}')" + update_db_and_html + if [ $SAVE_ARTIFACTS -eq 1 ] ; then SAVE_ARTIFACTS=2 ; fi +} + init_debbindiff() { # the schroot for debbindiff gets updated once a day. wait patiently if that's the case if [ -f $DBDCHROOT_WRITELOCK ] || [ -f $DBDCHROOT_READLOCK ] ; then @@ -169,34 +197,6 @@ call_debbindiff() { print_out_duration } -handle_404() { - echo "Warning: Download of ${SRCPACKAGE} sources from ${SUITE} failed." | tee -a ${RBUILDLOG} - ls -l ${SRCPACKAGE}* | tee -a ${RBUILDLOG} - sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO results (package_id, version, status, build_date, build_duration) VALUES ('${SRCPKGID}', 'None', '404', '$DATE', '')" - echo "Warning: Maybe there was a network problem, or ${SRCPACKAGE} is not a source package in ${SUITE}, or was removed or renamed. Please investigate." | tee -a ${RBUILDLOG} - update_db_and_html - if [ $SAVE_ARTIFACTS -eq 1 ] ; then SAVE_ARTIFACTS=2 ; fi - exit 0 -} - -handle_not_for_us() { - # a list of valid architecture for this package should be passed to this function - sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO results (package_id, version, status, build_date, build_duration) VALUES ('${SRCPKGID}', '${VERSION}', 'not for us', '$DATE', '')" - echo "Package ${SRCPACKAGE} (${VERSION}) shall only be build on \"$(echo "$@" | xargs echo )\" and thus was skipped." | tee -a ${RBUILDLOG} - update_db_and_html - if [ $SAVE_ARTIFACTS -eq 1 ] ; then SAVE_ARTIFACTS=2 ; fi - exit 0 -} - -handle_ftbfs() { - echo "${SRCPACKAGE} failed to build from source." - calculate_build_duration - sqlite3 -init $INIT ${PACKAGES_DB} "REPLACE INTO results (package_id, version, status, build_date, build_duration) VALUES ('${SRCPKGID}', '${VERSION}', 'FTBFS', '$DATE', '$DURATION')" - sqlite3 -init $INIT ${PACKAGES_DB} "INSERT INTO stats_build (name, version, suite, architecture, status, build_date, build_duration) VALUES ('${SRCPACKAGE}', '${VERSION}', '${SUITE}', '${ARCH}', 'FTBFS', '${DATE}', '${DURATION}')" - update_db_and_html - if [ $SAVE_ARTIFACTS -eq 1 ] ; then SAVE_ARTIFACTS=2 ; fi -} - choose_package () { local RESULT=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT s.suite, s.id, s.name, sch.date_scheduled, sch.save_artifacts FROM schedule AS sch JOIN sources AS s ON sch.package_id=s.id WHERE sch.date_build_started = '' ORDER BY date_scheduled LIMIT 1") SUITE=$(echo $RESULT|cut -d "|" -f1) |