summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2015-12-12 00:15:10 +0100
committerHolger Levsen <holger@layer-acht.org>2015-12-12 00:15:10 +0100
commit0e1572cefdc6f6823ed2a7f86621ff8fd442f843 (patch)
treeecf7c8f71c903a0e04540f95f58d0e150a224fc6
parent5031348dbecf1e0064d6a7c232343163e64d1950 (diff)
downloadjenkins.debian.net-0e1572cefdc6f6823ed2a7f86621ff8fd442f843.tar.xz
reproducible fedora rpms: update mock every 6h
-rw-r--r--TODO2
-rwxr-xr-xbin/reproducible_build_rpm.sh21
2 files changed, 20 insertions, 3 deletions
diff --git a/TODO b/TODO
index 74ad1cbd..99a0c72d 100644
--- a/TODO
+++ b/TODO
@@ -282,7 +282,7 @@ This is about Debian, below are more todo entries for other projects…
==== reproducible Fedora
* build script
-** maintenance should do maintenance too, to avoid blocking: if stamp file is older than 6h, do mock --update
+** maintenance should do maintenance of yum too… how so?
** how to allow more than one mock builder per node? using schroots?
** no variations introduced yet:
*** use '-j$NUM_CPU' and 'NEW_NUM_CPU=$(echo $NUM_CPU-1|bc)'
diff --git a/bin/reproducible_build_rpm.sh b/bin/reproducible_build_rpm.sh
index c946b507..ea28ccfe 100755
--- a/bin/reproducible_build_rpm.sh
+++ b/bin/reproducible_build_rpm.sh
@@ -35,6 +35,18 @@ handle_remote_error() {
exit 0
}
+update_mock() {
+ echo "$(date -u ) - checking whether to update mock for $RELEASE ($ARCH) on $HOSTNAME."
+ local STAMP="${RPM_STAMPS}-$RELEASE-$ARCH"
+ if [ ! -f $STAMP ] || [ $DUMMY -nt $STAMP ] ; then
+ echo "$(date -u ) - updating mock for $RELEASE ($ARCH) on $HOSTNAME now..."
+ mock -r $RELEASE-$ARCH --resultdir=$RESULTDIR --cleanup-after -v --update 2>&1
+ echo "$(date -u ) - mock updated."
+ touch $STAMP
+ else
+ echo "$(date -u ) - mock not updated, last update was at $(TZ=UTC ls --full-time $STAMP | cut -d ' ' -f6-7 | cut -d '.' -f1) UTC."
+ fi
+}
download_package() {
echo "$(date -u ) - downloading ${SRCPACKAGE} for $RELEASE now."
@@ -78,12 +90,13 @@ first_build() {
echo "Date: $(date -u)"
echo "============================================================================="
set -x
+ update_mock
download_package
local RESULTDIR="/tmp/$SRCPACKAGE-$(basename $TMPDIR)"
local LOG=$TMPDIR/b1/$SRCPACKAGE/build1.log
# nicely run mock with a timeout of 4h
timeout -k 4.1h 4h /usr/bin/ionice -c 3 /usr/bin/nice \
- mock -r $RELEASE-$ARCH --resultdir=$RESULTDIR --cleanup-after --rebuild -v $SRC_RPM 2>&1 | tee -a $LOG
+ mock -r $RELEASE-$ARCH --resultdir=$RESULTDIR --cleanup-after -v --rebuild $SRC_RPM 2>&1 | tee -a $LOG
PRESULT=${PIPESTATUS[0]}
if [ $PRESULT -eq 124 ] ; then
echo "$(date -u) - mock was killed by timeout after 4h." | tee -a $LOG
@@ -98,13 +111,14 @@ second_build() {
echo "Date: $(date -u)"
echo "============================================================================="
set -x
+ update_mock
download_package
local RESULTDIR="/tmp/$SRCPACKAGE-$(basename $TMPDIR)"
local LOG=$TMPDIR/b2/$SRCPACKAGE/build2.log
# NEW_NUM_CPU=$(echo $NUM_CPU-1|bc)
# nicely run mock with a timeout of 4h
timeout -k 4.1h 4h /usr/bin/ionice -c 3 /usr/bin/nice \
- mock -r $RELEASE-$ARCH --resultdir=$RESULTDIR --cleanup-after --rebuild -v $SRC_RPM 2>&1 | tee -a $LOG
+ mock -r $RELEASE-$ARCH --resultdir=$RESULTDIR --cleanup-after -v --rebuild $SRC_RPM 2>&1 | tee -a $LOG
PRESULT=${PIPESTATUS[0]}
if [ $PRESULT -eq 124 ] ; then
echo "$(date -u) - mock was killed by timeout after 4h." | tee -a $LOG
@@ -161,6 +175,8 @@ DATE=$(date -u +'%Y-%m-%d %H:%M')
START=$(date +'%s')
BUILDER="${JOB_NAME#reproducible_builder_}/${BUILD_ID}"
DUMMY=$(mktemp -t rpm-dummy-XXXXXXXX)
+touch -d "$(date -u -d "6 hours ago" '+%Y-%m-%d %H:%M') UTC" $DUMMY
+RPM_STAMPS=/srv/reproducible-results/.rpm_stamp
#
# determine mode
@@ -196,6 +212,7 @@ RELEASE="$1"
ARCH="$2"
SRCPACKAGE="" # package name
SRC_RPM="" # src rpm file name
+update_mock
choose_package
# build package twice
mkdir b1 b2