Commit 8acce39f authored by Holger Levsen's avatar Holger Levsen

reproducible Debian|Archlinux: refactoring

Signed-off-by: Holger Levsen's avatarHolger Levsen <holger@layer-acht.org>
parent 880bb661
......@@ -20,28 +20,6 @@ common_init "$@"
set -e
log_info () {
_log "I:" "$@"
}
log_error () {
_log "E:" "$@"
}
log_warning () {
_log "W:" "$@"
}
log_file () {
cat $@ | tee -a $RBUILDLOG
}
_log () {
local prefix="$1"
shift 1
echo -e "$(date -u) $prefix $*" | tee -a $RBUILDLOG
}
exit_early_if_debian_is_broken() {
# debian is fine, thanks
if false && [ "$ARCH" = "armhf" ] ; then
......@@ -63,19 +41,6 @@ create_results_dirs() {
mkdir -vp $DEBIAN_BASE/buildinfo/${SUITE}/${ARCH}
}
handle_race_condition() {
local RESULT=$(query_db "SELECT job FROM schedule WHERE package_id='$SRCPKGID'")
local msg="Package ${SRCPACKAGE} (id=$SRCPKGID) in ${SUITE} on ${ARCH} is probably already building at $RESULT, while this is $BUILD_URL.\n"
log_warning "$msg"
printf "$(date -u) - $msg" >> /var/log/jenkins/reproducible-race-conditions.log
log_warning "Terminating this build quickly and nicely..."
if [ $SAVE_ARTIFACTS -eq 1 ] ; then
SAVE_ARTIFACTS=0
if [ ! -z "$NOTIFY" ] ; then NOTIFY="failure" ; fi
fi
exit 0
}
save_artifacts() {
local random=$(head /dev/urandom | tr -cd '[:alnum:]'| head -c5)
local ARTIFACTS="artifacts/r00t-me/${SRCPACKAGE}_${SUITE}_${ARCH}_tmp-${random}"
......
......@@ -114,6 +114,29 @@ if $DEBUG ; then
set -x
fi
# some cmomon logging functions
log_info () {
_log "I:" "$@"
}
log_error () {
_log "E:" "$@"
}
log_warning () {
_log "W:" "$@"
}
log_file () {
cat $@ | tee -a $RBUILDLOG
}
_log () {
local prefix="$1"
shift 1
echo -e "$(date -u) $prefix $*" | tee -a $RBUILDLOG
}
# sleep 1-23 secs to randomize start times
delay_start() {
/bin/sleep $(echo "scale=1 ; $(shuf -i 1-230 -n 1)/10" | bc )
......@@ -664,6 +687,19 @@ cleanup_pkg_files() {
rm -vf $DEBIAN_BASE/logdiffs/${SUITE}/${ARCH}/${SRCPACKAGE}_*.diff{,.gz}
}
handle_race_condition() {
local RESULT=$(query_db "SELECT job FROM schedule WHERE package_id='$SRCPKGID'")
local msg="Package ${SRCPACKAGE} (id=$SRCPKGID) in ${SUITE} on ${ARCH} is probably already building at $RESULT, while this is $BUILD_URL.\n"
log_warning "$msg"
printf "$(date -u) - $msg" >> /var/log/jenkins/reproducible-race-conditions.log
log_warning "Terminating this build quickly and nicely..."
if [ $SAVE_ARTIFACTS -eq 1 ] ; then
SAVE_ARTIFACTS=0
if [ ! -z "$NOTIFY" ] ; then NOTIFY="failure" ; fi
fi
exit 0
}
#
# create the png (and query the db to populate a csv file...)
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment