From 860f29ff449b15a082407c80075e51be1e86c1a7 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Sat, 13 Jun 2015 18:06:55 +0200 Subject: reproducible: reduce code duplication by teaching sh's schedule_packages() to call reproducible_schedule_on_demand.py and fix various scripts --- bin/reproducible_schedule_on_demand.sh | 35 ++++++++-------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) (limited to 'bin/reproducible_schedule_on_demand.sh') diff --git a/bin/reproducible_schedule_on_demand.sh b/bin/reproducible_schedule_on_demand.sh index d9f50626..f7e3af35 100755 --- a/bin/reproducible_schedule_on_demand.sh +++ b/bin/reproducible_schedule_on_demand.sh @@ -11,9 +11,6 @@ common_init "$@" # common code defining db access . /srv/jenkins/bin/reproducible_common.sh -# -# main -# set +x ARTIFACTS=0 NOTIFY='' @@ -31,6 +28,13 @@ if [ "$SUITE" = "sid" ] ; then SUITE=unstable fi +if [ ! -z "$SUDO_USER" ] ; then + REQUESTER="$SUDO_USER" +else + echo "Looks like you logged into this host as the jenkins user without sudoing to it. How can that be possible?!?!" + REQUESTER="$USER" +fi + CANDIDATES="$@" if [ ${#} -gt 50 ] && [ "$NOTIFY" = "true" ] ; then echo @@ -39,29 +43,6 @@ if [ ${#} -gt 50 ] && [ "$NOTIFY" = "true" ] ; then echo exit 1 fi -check_candidates -if [ ${#PACKAGE_IDS} -gt 256 ] ; then - BLABLABLA="✂…" -fi -ACTION="manually rescheduled" -if [ -n "${BUILD_URL:-}" ] ; then - ACTION="rescheduled by $BUILD_URL" -fi -MESSAGE="$TOTAL $PACKAGES_TXT $ACTION in $SUITE: ${PACKAGES_NAMES:0:256}$BLABLABLA" -if [ $ARTIFACTS -eq 1 ] ; then - MESSAGE="$MESSAGE - artifacts will be preserved." -elif [ "$NOTIFY" = "true" ] ; then - MESSAGE="$MESSAGE - notification once finished." -fi # finally -schedule_packages $PACKAGE_IDS -echo -echo "$MESSAGE" -if [ -z "${BUILD_URL:-}" ] && [ $TOTAL -ne 0 ] ; then - kgb-client --conf /srv/jenkins/kgb/debian-reproducible.conf --relay-msg "$MESSAGE" -fi -echo "=============================================================================" -echo "The following $TOTAL source $PACKAGES_TXT $ACTION for $SUITE: $PACKAGES_NAMES" -echo "=============================================================================" -echo +schedule_packages $CANDIDATES -- cgit v1.2.3-54-g00ecf