forked from varnishcache/pkg-varnish-cache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage-deb
executable file
·73 lines (57 loc) · 2.13 KB
/
package-deb
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
65
66
67
68
69
70
71
72
73
#!/bin/bash
#
# Build Debian and Ubuntu packages from a tarball.
#
# This is the script that our Jenkins/CI system runs. Yes, it is a bit messy.
#
#
# For running this on your own computer (jessie), see https://wiki.debian.org/mk-sbuild
# for information on setting up sbuild.
# Short version: 1) apt-get install ubuntu-dev-tools 2) mk-sbuild jessie
#
# To CHANGE the golden image: sudo schroot -c source:jessie-amd64 -u root
# To ENTER an image snapshot: schroot -c jessie-amd64
# To BUILD within a snapshot: sbuild -A -d jessie-amd64 PACKAGE*.dsc
BINDISTS=${BINDISTS:-jessie}
if [ -n "$JENKINS_HOME" ]; then
set -x
# Handle old chroot naming on our jenkins servers. Used in the bottom.
chroot_postfix="-sbuild";
fi
set -o errexit
. common.sh
rm -rf build
mkdir -p build
SOURCE=$(ls -1 sources/varnish-*.tar.gz) # XXX
findversion $SOURCE
# Make sure we use the same tarball each time.
if [ -n "$DEBVERSION" -a $DEBVERSION -gt 1 ]; then
echo "DEBVERSION set, this is a release build. Using published tarball."
rm $SOURCE
(cd sources; wget https://repo.varnish-cache.org/source/varnish-$V.$MINOR.tar.gz)
SOURCE=$(ls -1 sources/varnish-*.tar.gz)
findversion $SOURCE
fi
tar xf ${SOURCE} -C build
cd build/varnish-*
cp -r ../../debian .
rm -f debian/.*.sw? # Delete any vim temporary files.
ln ../../$SOURCE ../varnish_$V.$MINOR.orig.tar.gz
# Modify Section to suit our repository software.
sed -i -e "s|^Section: \([^/]*\)\$|Section: varnish-$V/\1|" debian/control
# Take version override set on Jenkins builds into account.
if [ -n "$DEBVERSION" ]; then
FULL_VERSION="$V.$MINOR-$DEBVERSION"
dch -v "$FULL_VERSION" "Release build #$BUILD_NUMBER ID: $BUILD_ID"
else
FULL_VERSION="$V.$MINOR-0${RELEASE}+daily+$(date +%Y%m%d.%H%M%S)"
dch -v "$V.$MINOR-0${RELEASE}+daily+$(date +%Y%m%d.%H%M%S)" "Automatic build from git"
fi
dpkg-buildpackage -us -uc -S -j10
cd ..
# By now we are done setting up and building the source package.
# Build binary packages for the requested releases inside chroots.
for dist in $BINDISTS; do
export DEBIAN_OVERRIDE_BINARY_VERSION="$FULL_VERSION~$dist"
sbuild -v -A -c "$dist-amd64$chroot_postfix" -d "$dist" varnish_*.dsc
done