-
Notifications
You must be signed in to change notification settings - Fork 3
/
rebuild
executable file
·57 lines (55 loc) · 2.67 KB
/
rebuild
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
EXCEPTIONS_DIR="$(dirname $BASH_SOURCE)/exceptions"
: ${OSC_BUILD_ROOT:="/var/tmp/build-root/standard-x86_64"}
: ${clean:=--clean}
: ${OUTDIR:=RPMS}
: ${release:=0.0}
: ${buildhost:=reproducible}
export OSC_BUILD_ROOT
pkg=$(basename $(pwd))
: ${debuginfo:=--disable-debuginfo}
clean+=" --release=$release"
if grep -q "^$pkg$" $EXCEPTIONS_DIR/cleanbuild ; then
clean=${clean/--noinit/--clean}
fi
if grep -q "^$pkg$" $EXCEPTIONS_DIR/rootforbuild ; then
rootforbuild=" --userootforbuild"
fi
if grep -q "^$pkg$" $EXCEPTIONS_DIR/debuginfo ; then
debuginfo="--debuginfo"
fi
if grep -q "^$pkg$" $EXCEPTIONS_DIR/date ; then
VM_CUSTOMOPT=""
fi
oscopts+=("--build-opt=--buildtool-opt=--noclean") # to counter rpm commit b34333fa021c0ee7215714eeef96d1a2843ea08e and still get buildroot diffs for r-b debugging
if [[ $VM_CUSTOMOPT ]] && osc build --help | grep -q build-opt ; then
oscopts+=("--build-opt=--vm-custom-opt=$VM_CUSTOMOPT")
unset VM_CUSTOMOPT
fi
[[ $DISTURL ]] && oscopts+=("--build-opt=--disturl=$DISTURL")
[[ $rbsnd ]] && oscopts+=(--define='%__spec_build_post [ -e /usr/bin/strip-nondeterminism ] && find -type f -print0 | xargs -0 --no-run-if-empty strip-nondeterminism --timestamp=${SOURCE_DATE_EPOCH:-1494270000} --clamp-timestamp ; exit 0')
oscopts+=("--build-opt=--vm-disk-filesystem=ext4")
getent passwd qemu >/dev/null || oscopts+=("--build-opt=--vm-user=nobody")
oscopts+=(--define='%source_date_epoch_from_changelog Y' --define="%_buildhost $buildhost" --define='%clamp_mtime_to_source_date_epoch Y' --define='%use_source_date_epoch_as_buildtime Y')
#vmtype="--vm-type=kvm"
: ${project:=home:bmwiedemann:reproducible}
: ${repo:=openSUSE_Tumbleweed}
rm -rf $OSC_BUILD_ROOT/home/abuild/rpmbuild/RPMS/ $OSC_BUILD_ROOT/.mount/.build.packages/RPMS/ $OSC_BUILD_ROOT/.build.log
rm -rf $OUTDIR
mkdir -p $OUTDIR
echo in-progress > $OUTDIR/.osc-build-retval
hostname > $OUTDIR/buildhost
set -x
osc build --keep-pkg=$OUTDIR/ --alternative-project "$project" --nopreinstallimage $debuginfo --noservice$rootforbuild ${oscbuildparams} $vmtype $clean "${oscopts[@]}" $repo $(basename `pwd`).spec "$@" 2>&1 | tee $OUTDIR/.build.log2
echo ${PIPESTATUS[0]} > $OUTDIR/.osc-build-retval
cp -a $OUTDIR/.osc-build-retval .
cp -a $OSC_BUILD_ROOT/.build.log $OUTDIR/
cp -a $OUTDIR/.build.log .
test -e $OUTDIR/.build.log && tail -1 $OUTDIR/.build.log | perl -ne '/\[\s*(\d+)s\]/ && print $1' > $OUTDIR/build-time
ntpdate -p 1 ntp.zq1.de ntp.suse.de
find -mtime -0 -print0 | xargs --no-run-if-empty -0 touch
if [ `cat $OUTDIR/.osc-build-retval` -gt 0 ] ; then
exit 1
fi
calcchecksums ../$pkg/$OUTDIR/*.rpm | sed -e 's!\.\./!!' > $OUTDIR/checksums
test -n "$(find $OUTDIR/ -maxdepth 1 -name '*.rpm' -print -quit)"