#!/bin/bash # Copyright 2014 Holger Levsen # released under the GPLv=2 DEBUG=true . /srv/jenkins/bin/common-functions.sh common_init "$@" # common code defining db access . /srv/jenkins/bin/reproducible_common.sh schedule_packages() { # these packages are manually scheduled, so should have high prio # so schedule them in the past, so they are picked earlier :) DATE="2014-10-01 00:23" TMPFILE=$(mktemp) for PKG in $PACKAGES ; do echo "REPLACE INTO sources_scheduled VALUES ('$PKG','$DATE','');" >> $TMPFILE done cat $TMPFILE | sqlite3 -init $INIT ${PACKAGES_DB} rm $TMPFILE echo "=============================================================================" echo "The following $TOTAL source packages have been (re-)scheduled: $PACKAGES" echo "=============================================================================" echo } check_candidates() { PACKAGES="" TOTAL=0 for PKG in $CANDIDATES ; do echo "checking $PKG" RESULT=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT name from sources WHERE name = '$PKG';") if [ ! -z "$RESULT" ] ; then PACKAGES="$PACKAGES $RESULT" let "TOTAL+=1" fi echo "Debug: $PKG $RESULT" done case $TOTAL in 0) echo "No packages to schedule, exiting." exit 0 ;; 1) PACKAGES_TXT="package" ;; *) PACKAGES_TXT="packages" ;; esac } # # main # set +x CANDIDATES="$@" check_candidates if [ ${#PACKAGES} -gt 256 ] ; then BLABLABLA="..." fi PACKAGES=$(echo $PACKAGES) ACTION="manually rescheduled" if [ -n "${BUILD_URL:-}" ] ; then ACTION="rescheduled by $BUILD_URL" fi MESSAGE="$TOTAL $PACKAGES_TXT $ACTION: ${PACKAGES:0:256}$BLABLABLA" # finally schedule_packages /srv/jenkins/bin/reproducible_html_indexes.py echo echo "$MESSAGE" kgb-client --conf /srv/jenkins/kgb/debian-reproducible.conf --relay-msg "$MESSAGE" echo