blob: 10de83274186c2508e5e521863fae5a518b73fda (
plain)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
#!/bin/bash
# Copyright 2012-2014 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2
DEBUG=false
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
replace_origin_pu() {
PREFIX=$1 ; shift
BRANCH=$1 ; shift
expr "$BRANCH" : 'origin/pu/' >/dev/null || return 1
echo "${PREFIX}${BRANCH#origin/pu/}"
}
clean_workspace() {
#
# clean
#
cd $WORKSPACE
cd ..
rm -fv *.deb *.udeb *.dsc *_*.build *_*.changes *_*.tar.gz *_*.tar.bz2 *_*.tar.xz *_*.buildinfo
cd $WORKSPACE
git clean -dfx
git reset --hard
#
# git clone and pull is done by jenkins job
#
if [ -d .git ] ; then
echo "git status:"
git status
elif [ -f .svn ] ; then
echo "svn status:"
svn status
fi
echo
}
pdebuild_package() {
#
# check if we need to do anything
#
if [ ! -f debian/control ] ; then
# the Warning: will make the build end in status "unstable" but not "failed"
echo "Warning: A source package without debian/control, so no build will be tried."
return
fi
if [ $(dh_listpackages | sed '/^$/d' | wc -l) -eq 0 ]; then
echo "This package is not supposed to be built on $(dpkg --print-architecture)"
grep "Architecture:" debian/control
return
fi
#
# prepare build
#
if [ ! -f /var/cache/pbuilder/base.tgz ] ; then
sudo pbuilder --create --http-proxy $http_proxy
else
ls -la /var/cache/pbuilder/base.tgz
file /var/cache/pbuilder/base.tgz
sudo pbuilder --update --http-proxy $http_proxy || ( sudo rm /var/cache/pbuilder/base.tgz ; sudo pbuilder --create )
fi
#
# 3.0 quilt is not happy without an upstream tarball
#
if [ "$(cat debian/source/format)" = "3.0 (quilt)" ] ; then
uscan --download-current-version --symlink
fi
#
#
# build (binary packages only, as sometimes we cannot get the upstream tarball...)
#
SOURCE=$(dpkg-parsechangelog |grep ^Source: | cut -d " " -f2)
# workaround #767260 (console-setup doesn't support parallel build)
if [ "$SOURCE" != "console-setup" ] ; then
NUM_CPU=$(grep -c '^processor' /proc/cpuinfo)
else
NUM_CPU=1
fi
#
# if we got a valid PU_GIT_BRANCH passed in as a parameter from the triggering job
# then grab the generated udebs. FIXME -- we need to work work out a way of cleaning up old branches
#
if PU_BRANCH_DIR=$(replace_origin_pu "/srv/udebs/" $PU_GIT_BRANCH) ; then
cp $PU_BRANCH_DIR/* build/localudebs
fi
pdebuild --use-pdebuild-internal --debbuildopts "-j$NUM_CPU -b" -- --http-proxy $http_proxy
# cleanup
echo
cat /var/cache/pbuilder/result/${SOURCE}_*changes
echo
sudo dcmd rm /var/cache/pbuilder/result/${SOURCE}_*changes
}
preserve_pu_udebs() {
#
# Check is we're in a pu/* branch
#
if PU_BRANCH_DIR=$(replace_origin_pu "/srv/udebs/" $GIT_BRANCH) ; then
mkdir -p $PU_BRANCH_DIR
cp $WORKSPACE/../*.udeb $PU_BRANCH_DIR
fi
}
iso_target() {
UI=$1 ; shift
echo "/srv/d-i/isos/mini-${UI}$(replace_origin_pu "-" $PU_GIT_BRANCH).iso"
}
preserve_miniiso() {
#
# check if we built the images
#
IMAGETAR=../debian-installer-images_*.tar.gz
[ -f $IMAGETAR ] || return 0
tar -xvzf $IMAGETAR --no-anchored mini.iso
mv -f installer-*/*/images/netboot/gtk/mini.iso $(iso_target gtk)
mv -f installer-*/*/images/netboot/mini.iso $(iso_target text)
}
clean_workspace
#
# if $1 is not given, build the package normally,
# else...
#
if [ "$1" = "" ] ; then
pdebuild_package
preserve_pu_udebs
preserve_miniiso
else
echo do something else ; exit 1
fi
clean_workspace
|