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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
- job:
name: build-package
description: See https://wiki.linaro.org/Platform/Systems/Repository
project-type: matrix
defaults: global
logrotate:
daysToKeep: 30
numToKeep: 30
properties:
- authorization:
anonymous:
- job-read
- job-extended-read
linaro:
- job-read
- job-extended-read
- job-build
- job-cancel
- least-load:
disabled: False
parameters:
- string:
name: codename
default: 'jessie'
description: 'distribution codename targeted: xenial, stretch or jessie'
- string:
name: source
description: 'dsc source url or filename'
- string:
name: repo
description: 'repository to upload to'
default: 'linaro-staging'
- bool:
name: appendversion
description: 'append version with linaro$dist'
default: 'true'
- bool:
name: backport
description: 'mark as backport'
default: 'false'
axes:
- axis:
type: slave
name: label
values:
- docker-xenial-amd64
- docker-xenial-arm64
- docker-xenial-armhf
- docker-jessie-amd64
- docker-jessie-arm64
- docker-jessie-armhf
- docker-stretch-amd64
- docker-stretch-arm64
- docker-stretch-armhf
execution-strategy:
sequential: false
disabled: false
display-name: 'Build package'
wrappers:
- timestamps
- build-name:
name: '#${BUILD_NUMBER}-${ENV,var="codename"}: ${ENV,var="source"}'
- matrix-tie-parent:
node: master
builders:
- shell: |
#!/bin/bash
set -e
cat > repo.parameters << EOF
build_success=false
pkg_build_url=${BUILD_URL}
EOF
dist=`lsb_release -sc`
# lsb doesn't give stretch codename until release
[ "$dist" = "n/a" ] && dist=stretch
if [ "$dist" != "$codename" ]
then
echo "$codename requested while we are $dist, skip"
exit 0
fi
arch=`dpkg-architecture -qDEB_HOST_ARCH`
# arm64 is the must build target with source uploads for all dists
if [ $arch = arm64 ]
then
buildpackage_params="-sa"
else
buildpackage_params="-B"
fi
[ $arch = armhf ] && personality=linux32
echo "arch: $arch"
echo "dist: $dist"
echo "source: $source"
echo "repo: $repo"
echo "appendversion: $appendversion"
sudo rm -f *.changes repo work /etc/apt/sources.list.d/local.list
# build a source repo for apt-get build-dep
mkdir repo && cd repo
dget -q -d -u $source
dpkg-scansources . /dev/null > Sources.gz
echo "deb-src file:$(pwd) /" > local.list
echo "deb http://repo.linaro.org/ubuntu/linaro-overlay ${dist} main" >> local.list
if [ "${repo}" != "linaro-overlay" ]; then
echo "deb http://repo.linaro.org/ubuntu/${repo} ${dist} main" >> local.list
fi
sudo cp local.list /etc/apt/sources.list.d/
if [ "$dist == jessie" ]
then
cat > backports.pref <<EOF
Package: *
Pin: release a=jessie-backports
Pin-Priority: 500
EOF
sudo cp backports.pref /etc/apt/preferences.d/
fi
cd ..
localdsc=`echo $source|sed -e "s,.*/,$(pwd)/repo/,"`
sourcename=`basename ${localdsc}|sed -e 's,_.*,,'`
dpkg-source -x ${localdsc} work/
# Verify entries
cd work
dpkg-parsechangelog
maint=`dpkg-parsechangelog -SMaintainer`
if [[ $maint != *linaro* ]]; then
echo "Warning not a linaro maintainer: $maint"
export maint="packages@lists.linaro.org"
fi
echo email=$maint >> ../repo.parameters
change=`dpkg-parsechangelog -SChanges`
case $change in
*Initial*release*)
deltatype="new package"
;;
*Backport*from*|*Rebuild*for*)
deltatype="backport"
;;
*Added*patch*)
deltatype="patched"
;;
*Upstream*snapshot*)
deltatype="snapshot"
;;
*HACK*)
deltatype="hack"
;;
*)
deltatype="other"
;;
esac
if [ "$backport" = "true" ]; then
appendversion=true
deltatype=backport
fi
# Changelog update
if [ "$appendversion" = "true" ]; then
dch --force-distribution -m -D $dist -llinaro$dist "Linaro CI build: $deltatype"
elif [ `dpkg-parsechangelog -SDistribution` != $dist ]; then
echo "Wrong distribution in changelog, setting to: $dist"
dch --force-distribution -m -D $dist -a "Linaro CI: set distribution to $dist"
fi
export DEBIAN_FRONTEND=noninteractive
echo exit 101 | sudo tee /usr/sbin/policy-rc.d
sudo chmod +x /usr/sbin/policy-rc.d
sudo apt-get update -qq||true
sudo apt-get dist-upgrade -y -q||true
sudo apt-get build-dep -q --no-install-recommends -y ${sourcename}
export DEB_BUILD_OPTIONS=parallel=`getconf _NPROCESSORS_ONLN`
$personality dpkg-buildpackage -rfakeroot $buildpackage_params
cd ..
ls -l .
change=`echo *changes`
if [ ! -r $change ]
then
echo "no changes file"
exit 1
else
cat $change
fi
cat > repo.parameters << EOF
build_success=true
pkg_job_name=${JOB_NAME}
key_id=B86C70FE
pkg_changes=${change}
host_ppa=${repo}
pkg_build_url=${BUILD_URL}
email=$maint
EOF
publishers:
- copy-to-master:
includes:
- '*.changes, *.dsc, *.gz, *.bz2, *.xz, *.deb, *.udeb, repo.parameters'
- trigger-parameterized-builds:
- project: post-build-repo
property-file: "label/docker-${codename}-arm64/repo.parameters"
- project: post-build-repo
property-file: "label/docker-${codename}-armhf/repo.parameters"
- project: post-build-repo
property-file: "label/docker-${codename}-amd64/repo.parameters"
- email-ext:
recipients: '$DEFAULT_RECIPIENTS, packages@lists.linaro.org'
attach-build-log: true
failure: true
still-failing: true
subject: 'build-package: ${ENV,var="source"} failed'
matrix-trigger: only-configurations
body: |
Build ${BUILD_NUMBER} for ${ENV,var="source"} failed on ${ENV,var="codename"}
Build Log: ${BUILD_URL}/consoleText
Build URL: ${BUILD_URL}
send-to:
- requester
- email-ext:
recipients: packages@lists.linaro.org
attach-build-log: true
success: true
subject: 'build-package: ${ENV,var="source"} ${BUILD_STATUS}'
matrix-trigger: only-parent
body: |
Build ${BUILD_NUMBER} for ${ENV,var="source"} ${BUILD_STATUS} on ${ENV,var="codename"}
Build Log: ${BUILD_URL}/consoleText
Build URL: ${BUILD_URL}
|