-
Notifications
You must be signed in to change notification settings - Fork 32
/
package-rpm
executable file
·64 lines (50 loc) · 1.43 KB
/
package-rpm
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
58
59
60
61
62
63
64
#!/bin/sh
#
# This script builds Varnish Cache in chroot from a tarball.
#
# Author: Lasse Karstensen <lkarsten@varnish-software.com>, March 2015.
# Author: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>, March 2018.
set -e
set -u
ELVER=${ELVER:-el7}
rm -rf build
mkdir -p build
cd build
SOURCE=$(ls ../sources/varnish-*gz 2>/dev/null | tail -1)
tar xf "$SOURCE"
DIST_DIR=$(ls)
VERSION=$("$DIST_DIR"/configure --version | awk 'NR == 1 {print $NF}')
# VERSION looks like 5.2.1 or 5.2.0-rc1
MAJOR=${VERSION%.*} # 5.2
MINOR=${VERSION##*.} # 1 or 0-rc1
MINOR=${MINOR%%-*} # 1 or 0
RELEASE=${VERSION#*-} # 5.2.1 or rc1
RELEASE=${RELEASE#$VERSION} # '' or rc1
cp -r -L ../redhat/* "$DIST_DIR"/
tar zcf "$DIST_DIR.tgz" "$DIST_DIR"/
if [ -n "${WEEKLY_VERSION:-}" ]; then
RPMVERSION="${WEEKLY_VERSION}"
else
RPMVERSION="${MAJOR}.${MINOR}"
fi
MOCK_ROOT="epel-${ELVER#el}-x86_64"
RESULT_DIR="varnish-${MAJOR}/${ELVER}"
mock() {
if [ -n "$RELEASE" ]
then
set -- --define "v_rc $RELEASE" "$@"
fi
command mock \
--root "$MOCK_ROOT" \
--uniqueext "worker${EXECUTOR_NUMBER:-}" \
--resultdir "$RESULT_DIR" \
--define "_smp_mflags -j10" \
--define "versiontag ${RPMVERSION}" \
--define "releasetag ${RPMRELEASE:-1}" \
--define "srcname $DIST_DIR" \
--define "nocheck 1" \
"$@"
# XXX: no mechanism to make nocheck conditional
}
mock --buildsrpm --source . --spec "$DIST_DIR"/varnish.spec
mock --rebuild "$RESULT_DIR"/varnish-*.src.rpm "$@"