aboutsummaryrefslogtreecommitdiff
path: root/build-libvirt-deb
blob: 96f7f546b322f7160c7c66395ba4e7a172ff8518 (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
#!/bin/bash
set -x

export WORKSPACE=`pwd`

#chroot_name=${build_dist}-${build_arch}-sbuild
debian_packaging_source_filename=${debian_packaging_source_url##*/}
debian_dir=./debian

: ${package_name:?"package_name must be set (i.e. package_name=libvirt)"}
: ${code_checkout_dir:?"code_checkout_dir must be set (i.e. code_checkout_dir=./libvirt)"}
: ${build_arch:?"build_arch must be set (i.e. build_arch=armhf)"}
: ${build_dist:?"build_dist must be set (i.e. build_dist=trusty)"}
: ${debian_packaging_source_url:?"debian_packaging_source_url must be set (i.e. debian_packaging_source_url=http://archive.ubuntu.com/.../libvirt_xxx.debian.tar.gz)"}

#
# clean up previous build files
#

rm *.deb
rm *.ddeb
rm *.build
rm *.changes
rm *.dsc
rm *.tar.gz*
rm -rf ${debian_dir}
rm -rf ${code_checkout_dir}/debian

#
# initialize submodules (like gnulib)
#

cd ${code_checkout_dir}
git submodule init
git submodule update
cd ${WORKSPACE}

#
# retrieve debian packaging source
#

wget ${debian_packaging_source_url}
tar xfz ${debian_packaging_source_filename}
rm ${debian_packaging_source_filename}

#
# update build dependencies in the control file
#

sed -i 's/quilt/native/' ./${debian_dir}/source/format
sed -i "s/Build-Depends:/Build-Depends:\n ${addl_builddep_package_list},/" ./${debian_dir}/control


# disable Sheepdog -- it's causing the build to fail for some reason
sed -i "s/--with-storage-sheepdog/--without-storage-sheepdog/" ./${debian_dir}/rules

# don't enable apparmor
sed -i "s/--with-apparmor/--with-apparmor=no --with-secdriver-apparmor=no/" ./${debian_dir}/rules

# enable libxl
sed -i 's/$(WITH_XEN)/$(WITH_XEN)   --with-libxl/' ./${debian_dir}/rules
#sed -i "s/libxen-dev \[i386 amd64\]/libxen-dev/" ${code_checkout_dir}/debian/control

#
# since building from a git checkout, force bootstrap to run before the build starts
#

cat >> ./${debian_dir}/rules << EOF

makebuilddir/libvirt-bin::
	if [ ! -f already_bootstrapped ]; then pwd ; ./bootstrap --no-git --gnulib-srcdir=.gnulib; touch already_bootstrapped; fi
EOF

#
# get the commit of the upstream code
#

cd ${code_checkout_dir}
scm_commit=`git log -n1 --pretty=format:%h`
if [ -z "${scm_commit}" ]; then
   echo "Invalid source git revision: ${scm_commit}" >&2
   exit 1
fi
cd ${WORKSPACE}

#
# construct version string using tag information from git
#

cd ${code_checkout_dir}
pkg_version=`git describe --match='v*' |sed -e 's/^v//' -e 's/-rc/~rc/' -e 's/-\([0-9]*\)-/+git\1+/' `
cd ${WORKSPACE}
echo "pkg_version: :${pkg_version}:"


#
# update changelog
#

currentdate=`date -R`
cat > ./${debian_dir}/changelog.new << EOF
${package_name} (${pkg_version}-${BUILD_NUMBER}linaro${build_dist}1) ${build_dist}; urgency=low

  * CI - ${package_name} build from upstream sources:
    - repository: ${GIT_URL}
    - commit: ${scm_commit}
    - build: ${BUILD_URL}

    - debian/ source: ${debian_packaging_source_url}

 -- Linaro Packagers <linaro-pkg@lists.launchpad.net>  ${currentdate}

EOF
cat ./${debian_dir}/changelog >> ./${debian_dir}/changelog.new
mv --force ./${debian_dir}/changelog.new ./${debian_dir}/changelog

#echo "changelog:"
#cat ${code_checkout_dir}/debian/changelog

cp --recursive ${debian_dir} ${code_checkout_dir}/.

# start the build
pushd ${code_checkout_dir}
debuild -us -uc -i -I
popd