This repository has been archived by the owner on Feb 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuild-binary.sh
executable file
·128 lines (105 loc) · 3.63 KB
/
build-binary.sh
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
#!/bin/bash
# Copyright (C) 2017,2018 Marius Gripsgard <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -ex
export PYTHONIOENCODING=UTF-8
export BUILD_ONLY=true
# Parallel option is overwritten by build-and-provide-package anyway, but in
# case we switch from it, let's leave it in.
DEB_BUILD_OPTIONS="parallel=$(nproc)"
DEB_BUILD_PROFILES=""
if [ -f ubports.no_test.buildinfo ]; then
DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS} nocheck"
DEB_BUILD_PROFILES="${DEB_BUILD_PROFILES} nocheck"
rm ubports.no_test.buildinfo
fi
if [ -f ubports.no_doc.buildinfo ]; then
DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS} nodoc"
DEB_BUILD_PROFILES="${DEB_BUILD_PROFILES} nodoc"
rm ubports.no_doc.buildinfo
fi
# Allow setting additional build profiles. Useful for bootstraping
# circular dependencies.
if [ -f ubports.build_profiles.buildinfo ]; then
DEB_BUILD_PROFILES="${DEB_BUILD_PROFILES} $(cat ubports.build_profiles.buildinfo)"
rm ubports.build_profiles.buildinfo
fi
export DEB_BUILD_OPTIONS DEB_BUILD_PROFILES
if [ -f ubports.architecture.buildinfo ]; then
THIS_ARCH=$(dpkg --print-architecture)
REQUEST_ARCH=$(cat ubports.architecture.buildinfo)
if [ ! "$THIS_ARCH" = "$REQUEST_ARCH" ]; then
echo "My arch $THIS_ARCH does not match requested arch $REQUEST_ARCH, quiting"
exit 0
fi
fi
if [ -f multidist.buildinfo ]; then
echo "Doing multibuild"
MULTI_DIST=$(cat multidist.buildinfo)
tar -xvzf multidist.tar.gz
rm multidist.tar.gz
rootwp=$(pwd)
export rootwp
# Moves orig to mbuild folder
find "$rootwp" \
-maxdepth 1 -type f \
'(' -name '*.orig.*' -o -name '*.orig-*.*' ')' \
-exec mv '{}' "$rootwp/mbuild" ';'
for d in $MULTI_DIST ; do
echo "Bulding for $d"
export distribution=$d
export WORKSPACE="$rootwp/mbuild/$d"
cd "$WORKSPACE"
rm -r adt ./*.gpg || true
# generate_repo_extra.py has to run inside the workspace dir
generate_repo_extra.py
if [ -f ubports.repos_extra ]; then
REPOSITORY_EXTRA="$(cat ubports.repos_extra)"
export REPOSITORY_EXTRA
REPOSITORY_EXTRA_KEYS="https://repo.ubports.com/keyring.gpg"
export REPOSITORY_EXTRA_KEYS
echo "INFO: Adding extra repo $REPOSITORY_EXTRA"
fi
# Ensure orig tarball exists
find ../ \
-maxdepth 1 -type f \
'(' -name '*.orig.*' -o -name '*.orig-*.*' ')' \
-exec ln -s '{}' ./ ';'
/usr/bin/build-and-provide-package
cd "$rootwp"
done
. /etc/jenkins/debian_glue
for d in $MULTI_DIST ; do
debsign -k"${KEY_ID:-}" "mbuild/$d/"*.changes
done
tar -zcvf "multidist-$architecture-$RANDOM.tar.gz" mbuild
else
if [ -f ubports.depends.buildinfo ]; then
mv ubports.depends.buildinfo ubports.depends
fi
generate_repo_extra.py
if [ -f ubports.repos_extra ]; then
REPOSITORY_EXTRA="$(cat ubports.repos_extra)"
export REPOSITORY_EXTRA
REPOSITORY_EXTRA_KEYS="https://repo.ubports.com/keyring.gpg"
export REPOSITORY_EXTRA_KEYS
echo "INFO: Adding extra repo $REPOSITORY_EXTRA"
fi
distribution=$(cat distribution.buildinfo)
export distribution
/usr/bin/build-and-provide-package
. /etc/jenkins/debian_glue
debsign -k"${KEY_ID:-}" ./*.changes
fi