Skip to content

Commit 87b0ea6

Browse files
committed
Merge branch 'dev' into staging
2 parents ab8c684 + 71d8254 commit 87b0ea6

File tree

2 files changed

+117
-12
lines changed

2 files changed

+117
-12
lines changed

Diff for: Jenkinsfile

+58-12
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,24 @@ node(label: 'raspberrypi') {
44
durabilityHint(hint: 'PERFORMANCE_OPTIMIZED')
55
])
66

7+
// --- configuration for an arch-indep package ---
8+
9+
// The distributions we build on
10+
def build_dist_list = [
11+
"bullseye"
12+
]
13+
14+
// The distribution/architecture combinations we test-install on.
15+
def test_dist_arch_list = [
16+
["bullseye", "armhf"]
17+
]
18+
19+
// The list of packages to test-install, in the correct order to install.
20+
def test_package_list = ["piaware-ble-connect"]
21+
22+
// --- implementation ---
23+
724
def srcdir = "${WORKSPACE}/src"
8-
def resultsdir = "results"
9-
def dist = "bullseye"
1025

1126
stage("Checkout") {
1227
sh "rm -fr ${srcdir}"
@@ -16,20 +31,51 @@ node(label: 'raspberrypi') {
1631
}
1732
}
1833

19-
stage("Build") {
20-
sh "rm -fr ${resultsdir}"
21-
sh "mkdir -p ${resultsdir}"
22-
dir(srcdir) {
23-
sh "DIST=${dist} BRANCH=${env.BRANCH_NAME} pdebuild --use-pdebuild-internal --debbuildopts -b --buildresult ${WORKSPACE}/${resultsdir}"
34+
def resultdirs = [:]
35+
for (int i = 0; i < build_dist_list.size(); ++i) {
36+
def dist = build_dist_list[i]
37+
38+
String pkgdir = "pkg-${dist}"
39+
stage("Prepare source for ${dist}") {
40+
sh "rm -fr ${pkgdir}"
41+
sh "${srcdir}/prepare-build.sh ${dist} ${pkgdir}"
42+
}
43+
44+
def resultdir = "results-${dist}"
45+
resultdirs[dist] = resultdir
46+
47+
stage("Build for ${dist}") {
48+
sh "rm -fr ${resultdir}"
49+
sh "mkdir -p ${resultdir}"
50+
dir(pkgdir) {
51+
sh "DIST=${dist} BRANCH=${env.BRANCH_NAME} pdebuild --use-pdebuild-internal --debbuildopts -b --buildresult ${WORKSPACE}/${resultdir}"
52+
}
53+
archiveArtifacts artifacts: "${resultdir}/*.deb", fingerprint: true
2454
}
25-
archiveArtifacts artifacts: "${resultsdir}/*.deb", fingerprint: true
2655
}
2756

28-
stage("Test install on ${dist}") {
29-
sh "BRANCH=${env.BRANCH_NAME} /build/pi-builder/scripts/validate-packages.sh ${dist} ${resultsdir}/piaware-ble-connect_*.deb"
57+
for (int i = 0; i < test_dist_arch_list.size(); ++i) {
58+
def dist_and_arch = test_dist_arch_list[i]
59+
def dist = dist_and_arch[0]
60+
def arch = dist_and_arch[1]
61+
def resultdir = resultdirs[dist]
62+
63+
def test_debs = ""
64+
for (int j = 0; j < test_package_list.size(); ++j) {
65+
test_debs += "${resultdir}/${test_package_list[j]}_*.deb "
66+
}
67+
68+
stage("Test install on ${dist} (${arch})") {
69+
sh "BRANCH=${env.BRANCH_NAME} ARCH=${arch} /build/pi-builder/scripts/validate-packages.sh ${dist} ${test_debs}"
70+
}
3071
}
3172

32-
stage("Deployment to internal repository") {
33-
sh "/build/pi-builder/scripts/deploy.sh -distribution ${dist} -branch ${env.BRANCH_NAME} ${resultsdir}/*.deb"
73+
stage("Deploy to internal repository") {
74+
for (int i = 0; i < build_dist_list.size(); ++i) {
75+
def dist = build_dist_list[i]
76+
def resultdir = resultdirs[dist]
77+
78+
sh "/build/pi-builder/scripts/deploy.sh -distribution ${dist} -branch ${env.BRANCH_NAME} ${resultdir}/*.deb"
79+
}
3480
}
3581
}

Diff for: prepare-build.sh

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/sh
2+
3+
# This script prepares a package tree for building on different target
4+
# distributions
5+
6+
if [ $# -lt 1 ]
7+
then
8+
echo "Syntax: $0 <distribution> [target]" >&2
9+
echo "" >&2
10+
echo "Prepares a package tree in <target> (default package-<distribution>) ready for building" >&2
11+
exit 1
12+
fi
13+
14+
export DEBFULLNAME="${DEBFULLNAME:-FlightAware build automation}"
15+
export DEBEMAIL="${DEBEMAIL:-adsb-devs@flightaware.com}"
16+
17+
TOP=`dirname $0`
18+
DIST=$1
19+
OUT=$2
20+
21+
if [ -n "$OUT" ]
22+
then
23+
OUT=$(realpath $OUT)
24+
else
25+
OUT=$(realpath package-$DIST)
26+
fi
27+
28+
if [ -e $OUT ]
29+
then
30+
echo "$OUT already exists, refusing to overwrite it" >&2
31+
exit 1
32+
fi
33+
34+
FILES=$(find $TOP -mindepth 1 -maxdepth 1 -name .git -prune -o -name 'debian*' -prune -o -name 'package-*' -prune -o -print)
35+
mkdir -p $OUT
36+
cp -a $FILES $OUT
37+
cp -a $TOP/debian $OUT
38+
[ -d $TOP/debian-$DIST ] && cp -a $TOP/debian-$DIST/* $OUT/debian/
39+
40+
case "$DIST" in
41+
bullseye)
42+
echo "Updating changelog for bullseye backport build" >&2
43+
dch --changelog $OUT/debian/changelog --local ~bpo11+ --force-distribution --distribution bullseye-backports "Automated backport build for bullseye"
44+
;;
45+
46+
bookworm)
47+
# Bookworm full sdcard image support isn't ready yet, but we still
48+
# consider older distributions to be "backports" for the sake of
49+
# consistent version numbers
50+
echo "Bookworm support isn't done yet!" >&2
51+
exit 1
52+
;;
53+
54+
*)
55+
echo "Don't know how to build for a distribution named $DIST" >&2
56+
exit 1
57+
esac
58+
59+
echo "Package tree prepared in $OUT" >&2

0 commit comments

Comments
 (0)