| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
if [ -z ${JENKINS_DEBIAN_GLUE_QUIET:-} ]; then |
| 4 |
set -x |
| 5 |
fi |
| 6 |
set -u |
| 7 |
|
| 8 |
# Debian bug #531885: cowbuilder build fails with restrictive umask |
| 9 |
umask 022 |
| 10 |
|
| 11 |
# make sure cowbuilder/pbuilder/... are available |
| 12 |
PATH='/bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin' |
| 13 |
|
| 14 |
# make sure qemu doesn't give us the "out of memory issue" when compiling |
| 15 |
export QEMU_RESERVED_VA=0x0 |
| 16 |
|
| 17 |
# we assume to be running inside a dumb terminal inside Jenkins |
| 18 |
export TERM=dumb |
| 19 |
|
| 20 |
echo "*** Starting $0 at $(date) ***" |
| 21 |
start_seconds=$(sed -e 's/^\([0-9]*\).*/\1/' < /proc/uptime) |
| 22 |
|
| 23 |
JENKINS_DEBIAN_GLUE_VERSION=$(dpkg --list jenkins-debian-glue 2>/dev/null | awk '/^ii/ {print $3}') |
| 24 |
if [ -n "${JENKINS_DEBIAN_GLUE_VERSION:-}" ] ; then |
| 25 |
echo "*** Running jenkins-debian-glue version $JENKINS_DEBIAN_GLUE_VERSION ***" |
| 26 |
fi |
| 27 |
|
| 28 |
HOST_ARCH="$(dpkg --print-architecture)" |
| 29 |
if [ -n "${HOST_ARCH:-}" ] ; then |
| 30 |
echo "*** Identified host architecture ${HOST_ARCH} ***" |
| 31 |
fi |
| 32 |
|
| 33 |
set_debootstrap() { |
| 34 |
if [ -n "${DEBOOTSTRAP:-}" ] ; then |
| 35 |
echo "*** Using provided ${DEBOOTSTRAP} as DEBOOTSTRAP ***" |
| 36 |
return 0 |
| 37 |
fi |
| 38 |
|
| 39 |
if [ "${architecture:-}" = "${HOST_ARCH:-}" ] || \ |
| 40 |
[ "${architecture:-}" = "all" ] ; then |
| 41 |
DEBOOTSTRAP="debootstrap" |
| 42 |
return 0 |
| 43 |
fi |
| 44 |
|
| 45 |
# we can compile i386 packages on amd64, so don't use qemu-debootstrap there |
| 46 |
# and the same goes for armhf/armel on arm64 |
| 47 |
case "$HOST_ARCH" in |
| 48 |
amd64) |
| 49 |
if [ "${architecture:-}" = "i386" ] ; then |
| 50 |
DEBOOTSTRAP="debootstrap" |
| 51 |
return 0 |
| 52 |
fi |
| 53 |
;; |
| 54 |
arm64) |
| 55 |
if [ "${architecture:-}" = "armhf" ] || [ "${architecture:-}" = "armel" ] ; then |
| 56 |
DEBOOTSTRAP="debootstrap" |
| 57 |
return 0 |
| 58 |
fi |
| 59 |
;; |
| 60 |
esac |
| 61 |
|
| 62 |
# otherwise assume we're building for a foreign architecture |
| 63 |
if [ -x "$(which qemu-debootstrap)" ] ; then |
| 64 |
DEBOOTSTRAP="qemu-debootstrap" |
| 65 |
else |
| 66 |
echo "Error: qemu-debootstrap not available, please install qemu-user-static." >&2 |
| 67 |
exit 1 |
| 68 |
fi |
| 69 |
} |
| 70 |
|
| 71 |
checks_and_defaults() { |
| 72 |
# backwards compatibility, see PR#94 |
| 73 |
if [ -z "${REPOSITORY:-}" ] ; then |
| 74 |
local repository_is_missing_in_env=true |
| 75 |
else |
| 76 |
local repository_is_missing_in_env=false |
| 77 |
fi |
| 78 |
|
| 79 |
if [ -r /etc/jenkins/debian_glue ] ; then |
| 80 |
. /etc/jenkins/debian_glue |
| 81 |
fi |
| 82 |
|
| 83 |
# backwards compatibility, see PR#94 |
| 84 |
if [ -n "${REPOSITORY:-}" ] && $repository_is_missing_in_env ; then |
| 85 |
echo "*** WARNING: 'REPOSITORY' set in /etc/jenkins/debian_glue but should be DEFAULT_REPOSITORY ***" |
| 86 |
echo "*** WARNING: Setting DEFAULT_REPOSITORY to $REPOSITORY for backwards compatibility ***" |
| 87 |
echo "*** WARNING: Please replace REPOSITORY=... in /etc/jenkins/debian_glue with DEFAULT_REPOSITORY=... ***" |
| 88 |
DEFAULT_REPOSITORY="${REPOSITORY}" |
| 89 |
fi |
| 90 |
|
| 91 |
# make sure cowbuilder/pbuilder has access to the variable |
| 92 |
if [ -n "${DEB_KEEP_BUILD_ENV:-}" ] ; then |
| 93 |
export DEB_KEEP_BUILD_ENV |
| 94 |
fi |
| 95 |
|
| 96 |
if [ -z "${JOB_NAME:-}" ] ; then |
| 97 |
echo "Error: No JOB_NAME defined, please run it in jenkins." >&2 |
| 98 |
exit 1 |
| 99 |
fi |
| 100 |
|
| 101 |
if [ -z "${architecture:-}" ] ; then |
| 102 |
echo "*** No architecture defined. Consider running it with matrix configuration. ***" |
| 103 |
architecture="${HOST_ARCH}" |
| 104 |
echo "*** Falling back to default, using host architecture ${architecture}. ***" |
| 105 |
fi |
| 106 |
|
| 107 |
set_debootstrap |
| 108 |
|
| 109 |
if [ -z "${REPREPRO_OPTS:-}" ] ; then |
| 110 |
REPREPRO_OPTS='-v --waitforlock 1000' |
| 111 |
echo "*** REPREPRO_OPTS is unset, using default: $REPREPRO_OPTS ***" |
| 112 |
fi |
| 113 |
|
| 114 |
# support usage of a reprepro wrapper |
| 115 |
REPREPRO_CMD="${REPREPRO_CMD:-reprepro}" |
| 116 |
|
| 117 |
if [ -z "${DEFAULT_REPOSITORY:-}" ] ; then |
| 118 |
DEFAULT_REPOSITORY='/srv/repository' |
| 119 |
fi |
| 120 |
|
| 121 |
# REPOSITORY can overwrite DEFAULT_REPOSITORY, so define only if unset |
| 122 |
if [ -z "${REPOSITORY:-}" ] ; then |
| 123 |
REPOSITORY="${DEFAULT_REPOSITORY}" |
| 124 |
fi |
| 125 |
|
| 126 |
if [ -z "${PBUILDER_HOOKDIR:-}" ] ; then |
| 127 |
PBUILDER_HOOKDIR='/usr/share/jenkins-debian-glue/pbuilder-hookdir/' |
| 128 |
fi |
| 129 |
|
| 130 |
# Evaluate Freight default options - we use the system wide freight |
| 131 |
# directories and configuration, unless either $FREIGHT_REPOSITORY or |
| 132 |
# $FREIGHT_BASE are specified. |
| 133 |
if [ -z "${FREIGHT_REPOSITORY:-}" ] && [ -z "${FREIGHT_BASE:-}" ] ; then |
| 134 |
FREIGHT_VARLIB=/var/lib/freight |
| 135 |
FREIGHT_VARCACHE=/var/cache/freight |
| 136 |
FREIGHT_CONF=/etc/freight.conf |
| 137 |
elif [ -z "${FREIGHT_REPOSITORY:-}" ] && [ -n "${FREIGHT_BASE:-}" ] ; then |
| 138 |
FREIGHT_VARLIB=${FREIGHT_BASE}/default-source |
| 139 |
FREIGHT_VARCACHE=${FREIGHT_BASE}/default |
| 140 |
FREIGHT_CONF=${FREIGHT_BASE}/default.conf |
| 141 |
else |
| 142 |
# Default to /srv/freight unless specified |
| 143 |
if [ -z "${FREIGHT_BASE:-}" ] ; then |
| 144 |
FREIGHT_BASE=/srv/freight |
| 145 |
fi |
| 146 |
|
| 147 |
FREIGHT_VARLIB=${FREIGHT_BASE}/${FREIGHT_REPOSITORY}-source |
| 148 |
FREIGHT_VARCACHE=${FREIGHT_BASE}/${FREIGHT_REPOSITORY} |
| 149 |
FREIGHT_CONF=${FREIGHT_BASE}/${FREIGHT_REPOSITORY}.conf |
| 150 |
fi |
| 151 |
|
| 152 |
if [ "${LINTIAN:-}" = 'true' ] ; then |
| 153 |
# Will run lintian and we need pbuilder to copy the result file to |
| 154 |
# $BUILDRESULT. |
| 155 |
ADDITIONAL_BUILDRESULTS+=('../*lintian.txt') |
| 156 |
fi |
| 157 |
} |
| 158 |
|
| 159 |
clean_workspace() { |
| 160 |
echo "*** The following files have been noticed in the workspace [$(pwd)]: ***" |
| 161 |
ls -la ./ |
| 162 |
|
| 163 |
# echo "*** Cleaning workspace in $(pwd) to make sure we're building from scratch. ***" |
| 164 |
# rm -f ./* || true |
| 165 |
} |
| 166 |
|
| 167 |
# make sure we don't leave files for next run |
| 168 |
bailout() { |
| 169 |
[ -n "${1:-}" ] && EXIT="${1}" || EXIT=0 |
| 170 |
[ -n "${2:-}" ] && echo "$2" >&2 |
| 171 |
|
| 172 |
rm -f "${build_lockfile}" |
| 173 |
# if we have an aborted build we have to clean up left behinds, |
| 174 |
# but we have to make sure we only clean up the files from our run |
| 175 |
if [ -r "${update_lockfile_pid}" ] ; then |
| 176 |
rm -f "${update_lockfile_pid}" |
| 177 |
rm -f "${update_lockfile}" |
| 178 |
fi |
| 179 |
|
| 180 |
if [ "${SKIP_BINARY_REMOVAL:-}" = "true" ] ; then |
| 181 |
echo "*** Skipping binary removal as requested via SKIP_BINARY_REMOVAL=true. ***" |
| 182 |
else |
| 183 |
echo "*** Getting rid of files in $WORKSPACE/binaries/ to avoid problems in next run. ***" |
| 184 |
rm -f "$WORKSPACE"/binaries/* |
| 185 |
fi |
| 186 |
|
| 187 |
[ -n "${pbuilderrc:-}" ] && rm -rf "${pbuilderrc}" |
| 188 |
|
| 189 |
[ -n "${tmpaptdir:-}" ] && ${SUDO_CMD:-} rm -rf "${tmpaptdir}" |
| 190 |
|
| 191 |
[ -n "$start_seconds" ] && SECONDS="$[$(sed -e 's/^\([0-9]*\).*/\1/' < /proc/uptime)-$start_seconds]" || SECONDS="unknown" |
| 192 |
echo "*** Finished execution of $0 at $(date) [running ${SECONDS} seconds] ***" |
| 193 |
|
| 194 |
exit $EXIT |
| 195 |
} |
| 196 |
|
| 197 |
identify_package_name() { |
| 198 |
# make sure we get rid of 'repos' and 'binaries' from Jenkins job name |
| 199 |
PACKAGE=${JOB_NAME%-repos*} |
| 200 |
PACKAGE=${PACKAGE%-binaries*} |
| 201 |
|
| 202 |
if [ -n "${PACKAGE:-}" ] ; then |
| 203 |
echo "*** Identified Debian package name $PACKAGE ***" |
| 204 |
else |
| 205 |
bailout 1 "Error: could not identify Debian package name based on job name ${JOB_NAME:-}." |
| 206 |
fi |
| 207 |
} |
| 208 |
|
| 209 |
set_base_path() { |
| 210 |
# when BASE_PATH is set in the build step then don't default to $WORKSPACE |
| 211 |
if [ -n "${BASE_PATH:-}" ] ; then |
| 212 |
echo "*** Using provided ${BASE_PATH} as BASE_PATH ***" |
| 213 |
else |
| 214 |
BASE_PATH="${WORKSPACE}" |
| 215 |
echo "*** Using \$WORKSPACE [$BASE_PATH] as default for BASE_PATH ***" |
| 216 |
fi |
| 217 |
|
| 218 |
} |
| 219 |
|
| 220 |
build_info() { |
| 221 |
if [ -n "${REPOS:-}" ] ; then |
| 222 |
echo "*** Using supplied repository name $REPOS ***" |
| 223 |
else |
| 224 |
REPOS="${JOB_NAME%-binaries*}" |
| 225 |
REPOS="${REPOS%-repos*}" |
| 226 |
|
| 227 |
if [ -z "${distribution:-}" ]; then |
| 228 |
echo "*** No repository supplied, using repository name $REPOS ***" |
| 229 |
else |
| 230 |
REPOS="${REPOS}-${distribution}" |
| 231 |
echo "*** No repository supplied but distribution has been set, using repository name $REPOS ***" |
| 232 |
fi |
| 233 |
fi |
| 234 |
} |
| 235 |
|
| 236 |
identify_sourcefile() { |
| 237 |
if [ -n "${sources:-}" ] ; then |
| 238 |
echo "*** WARNING: sources variable [$sources] is set, please use BASE_PATH variable instead ***" |
| 239 |
echo "*** If \$sources is unrelated to jdg-build-and-provide-package you can ignore this warning ***" |
| 240 |
fi |
| 241 |
|
| 242 |
echo "*** Identifying newest package version ***" |
| 243 |
newest_version='' |
| 244 |
|
| 245 |
for file in "${BASE_PATH}/"*.dsc ; do |
| 246 |
SOURCE_PACKAGE="$(awk '/^Source: / {print $2}' $file)" |
| 247 |
p="$(basename $file .dsc)" |
| 248 |
if [ "$p" = '*' ] ; then |
| 249 |
bailout 1 "Error: No source package found (forgot to configure source files deployment?)" |
| 250 |
fi |
| 251 |
cur_version="${p#*_}" |
| 252 |
if [ -z "${newest_version}" ] || dpkg --compare-versions "${cur_version}" gt "${newest_version}" ; then |
| 253 |
newest_version="${cur_version}" |
| 254 |
fi |
| 255 |
done |
| 256 |
|
| 257 |
echo "*** Found package version $newest_version ***" |
| 258 |
|
| 259 |
sourcefile="${BASE_PATH}/${SOURCE_PACKAGE}"_*"${newest_version}".dsc |
| 260 |
|
| 261 |
echo "*** Using $sourcefile (version: ${newest_version})" |
| 262 |
} |
| 263 |
|
| 264 |
dist_and_arch_settings() { |
| 265 |
if [ -z "${architecture:-}" ] || [ "${architecture:-}" = "all" ] ; then |
| 266 |
arch="${HOST_ARCH}" |
| 267 |
echo "*** No architecture set or architecture set to 'all', using system arch ${arch} ***" |
| 268 |
else |
| 269 |
arch="${architecture}" |
| 270 |
echo "*** architecture is set to ${architecture} ***" |
| 271 |
fi |
| 272 |
|
| 273 |
if [ -n "${distribution:-}" ] ; then |
| 274 |
local DIST="${distribution}" |
| 275 |
else |
| 276 |
# default to the currently running distribution to avoid hardcoding |
| 277 |
# a distribution which might not be supported by the running system |
| 278 |
local distribution=$(lsb_release --short --codename 2>/dev/null) |
| 279 |
[ -n "${distribution}" ] || distribution="sid" # fallback to "sid" iff lsb_release fails |
| 280 |
local DIST="$distribution" |
| 281 |
fi |
| 282 |
|
| 283 |
# if COWBUILDER_DIST is set it overrides distribution then |
| 284 |
if [ -n "${COWBUILDER_DIST:-}" ]; then |
| 285 |
echo "*** COWBUILDER_DIST is set to $COWBUILDER_DIST - using it for base.cow if it does not exist yet. ***" |
| 286 |
else |
| 287 |
echo "*** Using cowbuilder base for distribution ${DIST} ***" |
| 288 |
COWBUILDER_DIST="${DIST}" |
| 289 |
fi |
| 290 |
|
| 291 |
if [ -n "${COWBUILDER_BASE:-}" ] ; then |
| 292 |
echo "*** COWBUILDER_BASE is set to $COWBUILDER_BASE - using as cowbuilder base.cow ***" |
| 293 |
else |
| 294 |
COWBUILDER_BASE="/var/cache/pbuilder/base-${COWBUILDER_DIST}-${arch}.cow" |
| 295 |
echo "*** No COWBUILDER_BASE set, using $COWBUILDER_BASE as cowbuilder base.cow ***" |
| 296 |
fi |
| 297 |
|
| 298 |
local lockfiles="/run/lock/${COWBUILDER_DIST}-${arch}" |
| 299 |
build_lockfile="${lockfiles}.building.$$" |
| 300 |
update_lockfile="${lockfiles}.update" |
| 301 |
update_lockfile_pid="${lockfiles}.update.$$" |
| 302 |
} |
| 303 |
|
| 304 |
cowbuilder_init() { |
| 305 |
|
| 306 |
pbuilderrc=$(mktemp) |
| 307 |
echo "# pbuilder config file generated by jenkins-debian-glue on $(date)" > "$pbuilderrc" |
| 308 |
|
| 309 |
# allow pbuilder networking |
| 310 |
if [ -n "${PBUILDER_USENETWORK:-}" ] ; then |
| 311 |
echo "USENETWORK=yes" >> "$pbuilderrc" |
| 312 |
fi |
| 313 |
|
| 314 |
# Will run lintian and we need pbuilder to copy the result file to $BUILDRESULT |
| 315 |
if [ "${LINTIAN:-}" = 'true' ] ; then |
| 316 |
echo "ADDITIONAL_BUILDRESULTS+=('../*lintian.txt')" >> "$pbuilderrc" |
| 317 |
fi |
| 318 |
|
| 319 |
use_eatmydata |
| 320 |
use_ccache |
| 321 |
|
| 322 |
# allow setting main pbuilder configuration file from outside, then append data |
| 323 |
# as needed without actually writing anything to user-provided $PBUILDER_CONFIG |
| 324 |
if [ -n "${PBUILDER_CONFIG:-}" ] ; then |
| 325 |
echo "*** PBUILDER_CONFIG is set, considering $PBUILDER_CONFIG for pbuilder config ***" |
| 326 |
if [ -r "${PBUILDER_CONFIG:-}" ] ; then |
| 327 |
echo "*** Adding content of $PBUILDER_CONFIG to pbuilder configfile ***" |
| 328 |
echo "# $PBUILDER_CONFIG added via jenkins-debian-glue:" >> "$pbuilderrc" |
| 329 |
cat $PBUILDER_CONFIG >> "$pbuilderrc" |
| 330 |
else |
| 331 |
echo "*** WARNING: File $PBUILDER_CONFIG could not be read, ignoring ***" |
| 332 |
fi |
| 333 |
fi |
| 334 |
|
| 335 |
if [ -n "${COMPONENTS:-}" ] ; then |
| 336 |
echo "*** COMPONENTS is set [$COMPONENTS], using for pbuilder configuration ***" |
| 337 |
echo "# COMPONENTS set by jenkins-debian-glue:" >> "$pbuilderrc" |
| 338 |
echo "COMPONENTS=\"${COMPONENTS}\"" >> "$pbuilderrc" |
| 339 |
else |
| 340 |
# workaround for Ubuntu problem, as cowdancer is available only in universe :( |
| 341 |
# https://bugs.launchpad.net/ubuntu/+source/cowdancer/+bug/237591 |
| 342 |
# https://bugs.launchpad.net/ubuntu/+source/cowdancer/+bug/747053 |
| 343 |
echo "*** COMPONENTS is not set, checking whether we need to enable Ubuntu workaround ***" |
| 344 |
|
| 345 |
if [ -n "${PBUILDER_CONFIG:-}" ] ; then |
| 346 |
echo "*** PBUILDER_CONFIG is set, not overwriting COMPONENTS for Ubuntu workaround ***" |
| 347 |
echo "*** NOTE: If you want to build for Ubuntu make sure COMPONENTS also includes 'universe' ***" |
| 348 |
else |
| 349 |
echo "*** PBUILDER_CONFIG is not set, continuing with checks for Ubuntu workaround ***" |
| 350 |
|
| 351 |
if ! [ -r "/usr/share/debootstrap/scripts/${COWBUILDER_DIST}" ] ; then |
| 352 |
echo "*** WARNING: distribution ${COWBUILDER_DIST} not supported by debootstrap, not considering Ubuntu workaround ***" |
| 353 |
else |
| 354 |
# debootstrap scripts for recent versions of Ubuntu are all pointing to gutsy, use that |
| 355 |
# to identify Ubuntu as the distribution we want to build instead of hardcoding all |
| 356 |
# the Ubuntu release names here |
| 357 |
if [ "$(readlink -f /usr/share/debootstrap/scripts/${COWBUILDER_DIST})" != '/usr/share/debootstrap/scripts/gutsy' ] ; then |
| 358 |
echo "*** Doesn't look like we're building for Ubuntu, not considering Ubuntu workaround ***" |
| 359 |
else |
| 360 |
echo "*** Building for Ubuntu detected, enabling universe repository component to work around cowdancer issue ***" |
| 361 |
echo "# Building for Ubuntu detected, enabling universe repository component to work around cowdancer issue:" >> "$pbuilderrc" |
| 362 |
echo 'COMPONENTS="main universe"' >> "$pbuilderrc" |
| 363 |
fi |
| 364 |
fi |
| 365 |
fi |
| 366 |
fi |
| 367 |
|
| 368 |
# ensure that we've access to Debian's archive keyring if we're |
| 369 |
# building for recent Debian releases on Ubuntu, see issue#130 |
| 370 |
if lsb_release --id 2>/dev/null | grep -q Ubuntu ; then |
| 371 |
echo "*** Looks like we're building on Ubuntu, checking for distribution target ***" |
| 372 |
if [ "$(readlink -f /usr/share/debootstrap/scripts/${COWBUILDER_DIST})" != '/usr/share/debootstrap/scripts/sid' ] ; then |
| 373 |
echo "*** Doesn't look like we're building for Debian, not considering Debian archive keyring workaround ***" |
| 374 |
else |
| 375 |
if ! [ -r /usr/share/keyrings/debian-archive-keyring.gpg ] ; then |
| 376 |
echo "*** WARNING: /usr/share/keyrings/debian-archive-keyring.gpg does not exist. ***" |
| 377 |
echo "*** If building fails with 'E: Release signed by unknown key ...' please ensure package debian-archive-keyring is installed ***" |
| 378 |
else |
| 379 |
echo "*** Package debian-archive-keyring is present, enabling its usage for keyring ***" |
| 380 |
echo "DEBOOTSTRAPOPTS=(${DEBOOTSTRAPOPTS[@]:-} '--keyring' '/usr/share/keyrings/debian-archive-keyring.gpg' )" >> "$pbuilderrc" |
| 381 |
fi |
| 382 |
fi |
| 383 |
fi |
| 384 |
|
| 385 |
echo "*** Listing pbuilder configuration file as reference: ***" |
| 386 |
cat "$pbuilderrc" |
| 387 |
|
| 388 |
if ls "${COWBUILDER_BASE}.building."* >/dev/null 2>&1 ; then |
| 389 |
echo "*** Skipping update run because a build is in progress ***" |
| 390 |
return 0 |
| 391 |
fi |
| 392 |
|
| 393 |
if ls "${update_lockfile}"* >/dev/null 2>&1 ; then |
| 394 |
echo "*** Update run already taking place, skipping ***" |
| 395 |
return 0 |
| 396 |
fi |
| 397 |
|
| 398 |
( |
| 399 |
# if we cannot get the lock then somebody else is already running |
| 400 |
if ! flock --nonblock 9 ; then |
| 401 |
exit 1 |
| 402 |
fi |
| 403 |
|
| 404 |
# in order to be able to clean up aborted runs we need to |
| 405 |
# mark that this file is ours |
| 406 |
touch "${update_lockfile_pid}" |
| 407 |
|
| 408 |
if [ ! -d "${COWBUILDER_BASE}" ]; then |
| 409 |
echo "*** Creating cowbuilder base $COWBUILDER_BASE for arch $arch and distribution $COWBUILDER_DIST ***" |
| 410 |
sudo DIST="${distribution:-}" ARCH="${architecture:-}" ${ADT:+ADT=$ADT} \ |
| 411 |
cowbuilder --create --basepath "${COWBUILDER_BASE}" --distribution "${COWBUILDER_DIST}" \ |
| 412 |
--debootstrap "${DEBOOTSTRAP}" --architecture "${architecture:-}" \ |
| 413 |
--debootstrapopts --arch --debootstrapopts "$arch" \ |
| 414 |
--debootstrapopts --variant=buildd --configfile="${pbuilderrc}" \ |
| 415 |
--hookdir "${PBUILDER_HOOKDIR}" |
| 416 |
[ $? -eq 0 ] || exit 2 |
| 417 |
else |
| 418 |
if [ "${SKIP_COWBUILDER_UPDATE:-}" = "true" ] ; then |
| 419 |
echo "*** Skipping cowbuilder update as requested via SKIP_COWBUILDER_UPDATE ***" |
| 420 |
else |
| 421 |
echo "*** Updating cowbuilder cow base ***" |
| 422 |
sudo DIST="${distribution:-}" ARCH="${architecture:-}" ${ADT:+ADT=$ADT} \ |
| 423 |
cowbuilder --update --basepath "${COWBUILDER_BASE}" --configfile="${pbuilderrc}" |
| 424 |
[ $? -eq 0 ] || exit 3 |
| 425 |
fi |
| 426 |
fi |
| 427 |
) 9>"${update_lockfile}" || |
| 428 |
{ |
| 429 |
# depending on the exit code we have to distinguish between different failures |
| 430 |
case "$?" in |
| 431 |
1) |
| 432 |
echo "*** Someone else is holding the lock file ${update_lockfile}, skipping create/update ***" |
| 433 |
return 0 |
| 434 |
;; |
| 435 |
2) |
| 436 |
echo "*** Something went wrong with the creation of the cowbuilder environment. Cleaning up. ***" |
| 437 |
rm -rf "${COWBUILDER_BASE}" |
| 438 |
bailout 1 "Error: Failed to create cowbuilder base ${COWBUILDER_BASE}." |
| 439 |
;; |
| 440 |
3) |
| 441 |
bailout 1 "Error: Failed to update cowbuilder base ${COWBUILDER_BASE}." |
| 442 |
;; |
| 443 |
esac |
| 444 |
} |
| 445 |
|
| 446 |
rm -f "${update_lockfile_pid}" "${update_lockfile}" |
| 447 |
} |
| 448 |
|
| 449 |
|
| 450 |
identify_build_type() { |
| 451 |
if [ -n "${DEBBUILDOPTS:-}" ] ; then |
| 452 |
echo "*** Using provided ${DEBBUILDOPTS} as DEBBUILDOPTS ***" |
| 453 |
echo "*** Please don't forget to set SKIP_ARCH_BUILD={true,false} as needed ***" |
| 454 |
return 0 |
| 455 |
fi |
| 456 |
|
| 457 |
# also support 'export FORCE_BINARY_ONLY=$label' use case with builds |
| 458 |
if [ -z "${FORCE_BINARY_ONLY:-}" ] ; then |
| 459 |
echo "*** FORCE_BINARY_ONLY is unset, continuing with checks for build type ***" |
| 460 |
else |
| 461 |
echo "*** FORCE_BINARY_ONLY is set to ${FORCE_BINARY_ONLY} ***" |
| 462 |
case "${FORCE_BINARY_ONLY}" in |
| 463 |
all) |
| 464 |
DEBBUILDOPTS="-A" |
| 465 |
echo "*** FORCE_BINARY_ONLY set to 'all', building with DEBBUILDOPTS=${DEBBUILDOPTS} ***" |
| 466 |
;; |
| 467 |
*) |
| 468 |
DEBBUILDOPTS="-B" |
| 469 |
echo "*** FORCE_BINARY_ONLY is NOT set to 'all', building with DEBBUILDOPTS=${DEBBUILDOPTS} ***" |
| 470 |
;; |
| 471 |
esac |
| 472 |
|
| 473 |
SKIP_ARCH_BUILD=false |
| 474 |
echo "*** Setting SKIP_ARCH_BUILD=$SKIP_ARCH_BUILD to skip further arch builds. ***" |
| 475 |
|
| 476 |
SKIP_SOURCE_REMOVAL=true |
| 477 |
echo "*** Setting SKIP_SOURCE_REMOVAL=$SKIP_SOURCE_REMOVAL to skip source removal in binary only build ***" |
| 478 |
return 0 |
| 479 |
fi |
| 480 |
|
| 481 |
# defaults |
| 482 |
DEBBUILDOPTS="-sa" |
| 483 |
SKIP_ARCH_BUILD=false |
| 484 |
|
| 485 |
if [ "${architecture:-}" = "all" ] ; then |
| 486 |
echo "*** \$architecture is set to 'all', skipping further identify_build_type checks. ***" |
| 487 |
echo "*** Consider setting \$architecture to amd64, i386,... instead. ***" |
| 488 |
return 0 |
| 489 |
fi |
| 490 |
|
| 491 |
if [ -z "${MAIN_ARCHITECTURE:-}" ] ; then |
| 492 |
if [ "${HOST_ARCH}" = "${architecture:-}" ] ; then |
| 493 |
echo "*** MAIN_ARCHITECTURE is unset. ***" |
| 494 |
echo "*** Host architecture [${HOST_ARCH}] matches \$architecture [${architecture:-}], using default ${DEBBUILDOPTS:-} buildoption ***" |
| 495 |
return 0 |
| 496 |
else |
| 497 |
echo "*** MAIN_ARCHITECTURE is unset. ***" |
| 498 |
echo "*** Host architecture [${HOST_ARCH}] does not match \$architecture [${architecture:-}] ... ***" |
| 499 |
echo "*** ... setting binary only build and continuing with identify_build_type ***" |
| 500 |
DEBBUILDOPTS="-B" |
| 501 |
|
| 502 |
SKIP_SOURCE_REMOVAL=true |
| 503 |
echo "*** Setting SKIP_SOURCE_REMOVAL=$SKIP_SOURCE_REMOVAL to skip source removal in binary only build ***" |
| 504 |
fi |
| 505 |
else |
| 506 |
if [ "${MAIN_ARCHITECTURE:-}" = "${architecture:-}" ] ;then |
| 507 |
echo "*** MAIN_ARCHITECTURE is set [${MAIN_ARCHITECTURE:-}]. ***" |
| 508 |
echo "*** MAIN_ARCHITECTURE matches \$architecture [${architecture:-}], using default ${DEBBUILDOPTS:-} buildoption ***" |
| 509 |
return 0 |
| 510 |
else |
| 511 |
echo "*** MAIN_ARCHITECTURE [${MAIN_ARCHITECTURE:-}] does not match \$architecture [${architecture:-}], setting binary only build and continuing with identify_build_type ***" |
| 512 |
DEBBUILDOPTS="-B" |
| 513 |
|
| 514 |
SKIP_SOURCE_REMOVAL=true |
| 515 |
echo "*** Setting SKIP_SOURCE_REMOVAL=$SKIP_SOURCE_REMOVAL to skip source removal in binary only build ***" |
| 516 |
fi |
| 517 |
fi |
| 518 |
|
| 519 |
local TMPDIR=$(mktemp -d) |
| 520 |
local old_dir=$(pwd) |
| 521 |
cd "$TMPDIR" |
| 522 |
for file in ${BASE_PATH}/${SOURCE_PACKAGE}_*.tar.* ; do |
| 523 |
if tar atf "$file" 2>/dev/null | grep -qE '^([^/]+/)?debian/control$' ; then |
| 524 |
# might be source/debian/control - so let's identify the path to debian/control |
| 525 |
# This assumes that no one will put `debian/debian/control` in debian tarball. |
| 526 |
local control_file=$(tar atf "$file" 2>/dev/null | grep -E '^([^/]+/)?debian/control$') |
| 527 |
tar axf "$file" "$control_file" || bailout 1 "Error while looking at debian/control in source archive." |
| 528 |
|
| 529 |
if grep -q '^Architecture: all' "$control_file" ; then |
| 530 |
if grep -q '^Architecture: .*any' "$control_file" ; then |
| 531 |
echo "*** Package provides arch 'all' + 'any', enabling -B buildoption for this architecture. ***" |
| 532 |
# -B -> binary-only build, limited to architecture dependent packages |
| 533 |
DEBBUILDOPTS="-B" |
| 534 |
|
| 535 |
SKIP_SOURCE_REMOVAL=true |
| 536 |
echo "*** Setting SKIP_SOURCE_REMOVAL=$SKIP_SOURCE_REMOVAL to skip source removal in binary only build ***" |
| 537 |
break |
| 538 |
else |
| 539 |
# only "Architecture: all", so no arch specific packages since |
| 540 |
# we aren't building for $MAIN_ARCHITECTURE |
| 541 |
SKIP_ARCH_BUILD=true |
| 542 |
break |
| 543 |
fi |
| 544 |
fi |
| 545 |
fi |
| 546 |
done |
| 547 |
cd "$old_dir" |
| 548 |
rm -rf "${TMPDIR}" |
| 549 |
} |
| 550 |
|
| 551 |
autopkg_run() { |
| 552 |
case "${ADT:-}" in |
| 553 |
skip) |
| 554 |
echo "*** Skipping external autopkgtests as ADT is set to 'skip' ***" |
| 555 |
return 0 |
| 556 |
;; |
| 557 |
internal) |
| 558 |
echo "*** Skipping external autopkgtests as ADT is set to 'internal' ***" |
| 559 |
return 0 |
| 560 |
;; |
| 561 |
external|all) |
| 562 |
echo "*** Executing external autopkgtests as ADT is set to $ADT ***" |
| 563 |
;; |
| 564 |
*) |
| 565 |
echo "*** Skipping external autopkgtests as ADT is neither set to 'external' nor 'all' ***" |
| 566 |
return 0 |
| 567 |
;; |
| 568 |
esac |
| 569 |
|
| 570 |
if [ -z "${ADT_RUNNER:-}" ] ; then |
| 571 |
bailout 1 "*** Error: ADT_RUNNER is unset, external autopkgtests depend on according ADT_RUNNER configuration ***" |
| 572 |
fi |
| 573 |
|
| 574 |
dsc_file="${WORKSPACE}/"*"_${newest_version}.dsc" |
| 575 |
if ! grep -q '^Testsuite: autopkgtest' ${dsc_file} ; then |
| 576 |
echo "*** No 'Testsuite: autopkgtest' present in ${dsc_file}, skipping external autopkgtests ***" |
| 577 |
return 0 |
| 578 |
fi |
| 579 |
|
| 580 |
changes_file="${WORKSPACE}/"*"_${newest_version}_${arch}.changes" |
| 581 |
|
| 582 |
if [ -x "$(which autopkgtest)" ] ; then |
| 583 |
# starting with autopkgtest 5.0 there's only the dedicated autopkgtest CLI |
| 584 |
local autopkg_binary="autopkgtest $changes_file" |
| 585 |
elif [ -x "$(which adt-run)" ] ; then |
| 586 |
# autopkgtest as in Debian/jessie (v3.6jessie1) and older doesn't provide |
| 587 |
# autopkgtest binary yet, but let's be backwards compatible |
| 588 |
local autopkg_binary="adt-run --changes $changes_file" |
| 589 |
else |
| 590 |
echo "Error: neither autopkgtest nor adt-run binary found." >&2 |
| 591 |
exit 1 |
| 592 |
fi |
| 593 |
|
| 594 |
if [ -n "${ADT_OPTIONS:-}" ] ; then |
| 595 |
echo "*** Using provided ADT_OPTIONS $ADT_OPTIONS ***" |
| 596 |
else |
| 597 |
# since autopkgtest 3.16 the --tmp-dir option is gone, make sure |
| 598 |
# we've --output-dir available though before using it |
| 599 |
if "$autopkg_binary" --help | grep -q -- --output-dir 2>/dev/null ; then |
| 600 |
local adt_output_option='--output-dir' |
| 601 |
else |
| 602 |
local adt_output_option='--tmp-dir' |
| 603 |
fi |
| 604 |
|
| 605 |
ADT_OPTIONS="$adt_output_option adt-external/out --summary adt-external/summary" |
| 606 |
rm -rf adt-external |
| 607 |
mkdir -p adt-external |
| 608 |
echo "*** Using default ADT_OPTIONS $ADT_OPTIONS ***" |
| 609 |
fi |
| 610 |
|
| 611 |
echo "*** Executing '$autopkg_binary ${ADT_OPTIONS:-} --- $ADT_RUNNER' ***" |
| 612 |
$autopkg_binary ${ADT_OPTIONS:-} --- $ADT_RUNNER || bailout $? |
| 613 |
} |
| 614 |
|
| 615 |
use_ccache() { |
| 616 |
if [ "${USE_CCACHE:-}" = 'true' ] ; then |
| 617 |
echo "*** USE_CCACHE is set to true, enabling ccache support ***" |
| 618 |
echo 'CCACHEDIR="/var/cache/pbuilder/ccache"' >> "$pbuilderrc" |
| 619 |
fi |
| 620 |
} |
| 621 |
|
| 622 |
enable_eatmydata() { |
| 623 |
echo 'EXTRAPACKAGES="$EXTRAPACKAGES eatmydata"' >> "$pbuilderrc" |
| 624 |
echo 'export LD_PRELOAD="${LD_PRELOAD:+$LD_PRELOAD:}libeatmydata.so"' >> "$pbuilderrc" |
| 625 |
echo '# builtin support available with pbuilder >=0.225 (otherwise ignored):' >> "$pbuilderrc" |
| 626 |
echo 'EATMYDATA=yes' >> "$pbuilderrc" |
| 627 |
} |
| 628 |
|
| 629 |
use_eatmydata() { |
| 630 |
if [ "${USE_EATMYDATA:-}" = 'false' ] ; then |
| 631 |
echo "*** eatmydata is disabled via USE_EATMYDATA [$USE_EATMYDATA] ***" |
| 632 |
return 0 |
| 633 |
fi |
| 634 |
|
| 635 |
if [ "${USE_EATMYDATA:-}" = 'true' ] ; then |
| 636 |
echo "*** eatmydata is enabled via USE_EATMYDATA [$USE_EATMYDATA], forcing usage (skipping host/distribution checks) ***" |
| 637 |
enable_eatmydata |
| 638 |
else |
| 639 |
if ! dpkg-query --show --showformat='${Status}' eatmydata | grep -q '^install' ; then |
| 640 |
echo "*** eatmydata missing on host system, not considering for usage (force via USE_EATMYDATA=true) ***" |
| 641 |
else |
| 642 |
if ! dpkg --compare-versions "$(dpkg-query --show --showformat='${Version}' eatmydata)" gt '26-2' ; then |
| 643 |
echo "*** eatmydata version on host needs to be newer than v26-2 (>=82-6 is recommended), skipping eatmydata ***" |
| 644 |
else |
| 645 |
echo "*** eatmydata is present on host system, now checking distribution support ***" |
| 646 |
case "${COWBUILDER_DIST}" in |
| 647 |
etch|lenny|squeeze|wheezy) |
| 648 |
echo "*** Debian release $COWBUILDER_DIST doesn't provide eatmydata >=82-6, skipping eatmydata ***" |
| 649 |
;; |
| 650 |
warty|hoary|breezy|dapper|edgy|feisty|gutsy|hardy|intrepid|jaunty|karmi|lucid|maverick|natty|oneiric|quantal|raring|saucy|utopic|precise|trusty) |
| 651 |
echo "*** Ubuntu release $COWBUILDER_DIST doesn't provide eatmydata >=82-6, skipping eatmydata ***" |
| 652 |
;; |
| 653 |
*) |
| 654 |
echo "*** Distribution ${COWBUILDER_DIST} should provide recent eatmydata support, enabling eatmydata ***" |
| 655 |
enable_eatmydata |
| 656 |
;; |
| 657 |
esac |
| 658 |
fi |
| 659 |
fi |
| 660 |
fi |
| 661 |
} |
| 662 |
|
| 663 |
autopkgtest_results() { |
| 664 |
if [ -n "${SKIP_AUTOPKGTEST_RESULTS:-}" ] ; then |
| 665 |
echo "** Skipping autopkgtest_results as requested via SKIP_AUTOPKGTEST_RESULTS ***" |
| 666 |
return 0 |
| 667 |
fi |
| 668 |
|
| 669 |
mkdir -p adt |
| 670 |
if [ -r autopkgtest.summary ] ; then |
| 671 |
mv autopkgtest.summary adt/summary |
| 672 |
else # do not fail if no autopkgtest run took place |
| 673 |
touch adt/summary |
| 674 |
fi |
| 675 |
} |
| 676 |
|
| 677 |
cowbuilder_run() { |
| 678 |
echo "*** cowbuilder build phase for arch $architecture ***" |
| 679 |
tmpaptdir=$(mktemp -d /tmp/apt-jdg_XXXXXX) |
| 680 |
mkdir -p "$WORKSPACE"/binaries/ "${tmpaptdir}" |
| 681 |
|
| 682 |
local BINDMOUNTS="${tmpaptdir} ${USER_BINDMOUNTS:-}" |
| 683 |
|
| 684 |
# make sure we build arch specific packages only when necessary |
| 685 |
identify_build_type |
| 686 |
|
| 687 |
if $SKIP_ARCH_BUILD ; then |
| 688 |
autopkgtest_results |
| 689 |
bailout 0 "Nothing to do, architecture all binary packages only for non-primary architecture." |
| 690 |
fi |
| 691 |
|
| 692 |
# For release builds use release repo to satisfy dependencies |
| 693 |
if [ -n "${release:-}" ] && [ "$release" != "none" ] && [ "$release" != "trunk" ] && \ |
| 694 |
[ "${release}" != '${release}' ] ; then |
| 695 |
if [ -n "${RELEASE_REPOSITORY:-}" ]; then |
| 696 |
local REPOSITORY="${RELEASE_REPOSITORY}" |
| 697 |
else |
| 698 |
local REPOSITORY="${REPOSITORY}/release/${release}" |
| 699 |
fi; |
| 700 |
|
| 701 |
if [ -d "${REPOSITORY}/dists/${release}" ]; then |
| 702 |
BINDMOUNTS="$BINDMOUNTS $REPOSITORY" |
| 703 |
local components="$(awk -F': ' '/^Components:/ { print $2 }' \ |
| 704 |
"${REPOSITORY}/dists/${release}/InRelease")" |
| 705 |
# Check if keyring is provided so the repository can be verified. |
| 706 |
if [ -n "${REPOSITORY_KEYRING:-}" ]; then |
| 707 |
local trusted= |
| 708 |
else |
| 709 |
# If no keyring is provided, just assume that the repository is |
| 710 |
# trustworthy. This option appeared in apt 0.8.16~exp3 which is not |
| 711 |
# available in Squeeze. |
| 712 |
local trusted="[trusted=yes]" |
| 713 |
fi |
| 714 |
cat > "${tmpaptdir}"/release.list <<EOF |
| 715 |
deb ${trusted} file://${REPOSITORY} ${release} ${components} |
| 716 |
EOF |
| 717 |
fi |
| 718 |
|
| 719 |
if [ -n "${REPOSITORY_KEYRING:-}" ]; then |
| 720 |
cp -a "${REPOSITORY_KEYRING}" "${tmpaptdir}"/keyring.gpg |
| 721 |
fi |
| 722 |
fi |
| 723 |
|
| 724 |
# Adding extra repository for resolving dependencies |
| 725 |
if [ -n "${REPOSITORY_EXTRA:-}" ]; then |
| 726 |
echo ${REPOSITORY_EXTRA} | tr ',' '\n' > "${tmpaptdir}"/extra.list |
| 727 |
fi |
| 728 |
|
| 729 |
if [ -n "${REPOSITORY_EXTRA_KEYS:-}" ]; then |
| 730 |
OIFS="$IFS" |
| 731 |
IFS=',' read -a array <<< "${REPOSITORY_EXTRA_KEYS}" |
| 732 |
for key in "${array[@]}" ; do |
| 733 |
curl -O "${key}" |
| 734 |
gpg --no-default-keyring --keyring "${tmpaptdir}"/keyring-temp.gpg --import "${key##*/}" |
| 735 |
done |
| 736 |
unset key |
| 737 |
IFS="$OIFS" |
| 738 |
gpg --no-default-keyring --keyring "${tmpaptdir}"/keyring-temp.gpg --export --output "${tmpaptdir}"/keyring.gpg |
| 739 |
rm "${tmpaptdir}"/keyring-temp.gpg |
| 740 |
fi |
| 741 |
|
| 742 |
echo "# pbuilder config file generated by jenkins-debian-glue on $(date)" > "$pbuilderrc" |
| 743 |
|
| 744 |
# allow pbuilder networking |
| 745 |
if [ -n "${PBUILDER_USENETWORK:-}" ] ; then |
| 746 |
echo "USENETWORK=yes" >> "$pbuilderrc" |
| 747 |
fi |
| 748 |
|
| 749 |
# Will run lintian and we need pbuilder to copy the result file to $BUILDRESULT |
| 750 |
if [ "${LINTIAN:-}" = 'true' ] ; then |
| 751 |
echo "ADDITIONAL_BUILDRESULTS+=('../*lintian.txt')" >> "$pbuilderrc" |
| 752 |
fi |
| 753 |
|
| 754 |
use_eatmydata |
| 755 |
use_ccache |
| 756 |
|
| 757 |
# allow setting main pbuilder configuration file from outside, then append data |
| 758 |
# as needed without actually writing anything to user-provided $PBUILDER_CONFIG |
| 759 |
if [ -n "${PBUILDER_CONFIG:-}" ] ; then |
| 760 |
echo "*** PBUILDER_CONFIG is set, considering $PBUILDER_CONFIG for pbuilder config ***" |
| 761 |
if [ -r "${PBUILDER_CONFIG:-}" ] ; then |
| 762 |
echo "*** Adding content of $PBUILDER_CONFIG to pbuilder configfile ***" |
| 763 |
cat $PBUILDER_CONFIG >> "$pbuilderrc" |
| 764 |
else |
| 765 |
echo "*** File $PBUILDER_CONFIG could not be read, ignoring ***" |
| 766 |
fi |
| 767 |
fi |
| 768 |
|
| 769 |
counter=3600 |
| 770 |
while ls "${update_lockfile}."* >/dev/null 2>&1 && [ $counter -gt 0 ] ; do |
| 771 |
echo "*** Update (or creation) of ${COWBUILDER_BASE} is in progress, waiting up to $counter seconds ***" |
| 772 |
sleep 1 |
| 773 |
counter=$(( counter - 1 )) |
| 774 |
done |
| 775 |
|
| 776 |
if [ $counter -eq 0 ] ; then |
| 777 |
bailout 1 "Error: ran into timeout because parallel create/update operation for ${COWBUILDER_BASE} didn't finish in time." |
| 778 |
fi |
| 779 |
|
| 780 |
touch "${build_lockfile}" |
| 781 |
|
| 782 |
case "$architecture" in |
| 783 |
i386) |
| 784 |
linux32 sudo DIST="${distribution:-}" ARCH="${architecture:-}" ${ADT:+ADT=$ADT} \ |
| 785 |
cowbuilder --buildresult "$WORKSPACE"/binaries/ \ |
| 786 |
--build $sourcefile \ |
| 787 |
--basepath "${COWBUILDER_BASE}" --debbuildopts "${DEBBUILDOPTS:-}" \ |
| 788 |
--hookdir "${PBUILDER_HOOKDIR}" --bindmounts "$BINDMOUNTS" --configfile="${pbuilderrc}" |
| 789 |
[ $? -eq 0 ] || bailout 1 "Error: Failed to build with cowbuilder." |
| 790 |
;; |
| 791 |
amd64|all|*) |
| 792 |
sudo DIST="${distribution:-}" ARCH="${architecture:-}" ${ADT:+ADT=$ADT} \ |
| 793 |
cowbuilder --buildresult "$WORKSPACE"/binaries/ \ |
| 794 |
--build $sourcefile \ |
| 795 |
--basepath "${COWBUILDER_BASE}" --debbuildopts "${DEBBUILDOPTS:-}" \ |
| 796 |
--hookdir "${PBUILDER_HOOKDIR}" --bindmounts "$BINDMOUNTS" --configfile="${pbuilderrc}" |
| 797 |
[ $? -eq 0 ] || bailout 1 "Error: Failed to build with cowbuilder." |
| 798 |
;; |
| 799 |
*) |
| 800 |
bailout 1 "Error: Unsupported architecture: $architecture" |
| 801 |
;; |
| 802 |
esac |
| 803 |
|
| 804 |
rm -f "${build_lockfile}" |
| 805 |
} |
| 806 |
|
| 807 |
# replacement for dcmd, sadly available only in the devscripts package |
| 808 |
list_deb_files() { |
| 809 |
if [ "$#" -lt 1 ] ; then |
| 810 |
echo "Error: list_deb_files function needs a file name as argument." >&2 |
| 811 |
return 1 |
| 812 |
fi |
| 813 |
|
| 814 |
local files |
| 815 |
|
| 816 |
for arg in "$@" ; do |
| 817 |
if ! [ -r "$arg" ] ; then |
| 818 |
echo "Error: could not read $arg" >&2 |
| 819 |
continue |
| 820 |
fi |
| 821 |
|
| 822 |
# cmdline based on usage in dcmd, we're interested only in .deb files though |
| 823 |
sed --regexp-extended -n 's,^ [0-9a-f]{32} [0-9]+ ((([a-zA-Z0-9_.-]+/)?[a-zA-Z0-9_.-]+|-) ([a-zA-Z]+|-) )?(.*.deb)$,\5,p' "$arg" |
| 824 |
done |
| 825 |
} |
| 826 |
|
| 827 |
remove_packages() { |
| 828 |
if [ -n "${SKIP_REMOVAL:-}" ] ; then |
| 829 |
echo "*** Skipping removal of existing packages as requested via SKIP_REMOVAL ***" |
| 830 |
return 0 |
| 831 |
fi |
| 832 |
|
| 833 |
if [ -n "${SKIP_SOURCE_REMOVAL:-}" ] ; then |
| 834 |
echo "*** Skipping removal of existing source package as requested via SKIP_SOURCE_REMOVAL ***" |
| 835 |
else |
| 836 |
echo "*** Removing source package version from repository ***" |
| 837 |
${SUDO_CMD:-} ${REPREPRO_CMD} -A source -b "${REPOSITORY}" ${REPREPRO_OPTS} remove "${REPOS}" "${SOURCE_PACKAGE}" |
| 838 |
fi |
| 839 |
|
| 840 |
echo "*** Removing previous binary package versions from repository ***" |
| 841 |
for p in $(list_deb_files "${WORKSPACE}/binaries/"*"_${newest_version}_${arch}.changes") ; do |
| 842 |
file="$(basename $p)" |
| 843 |
binpackage="${file%%_*}" |
| 844 |
binary_list="${binary_list:-} ${binpackage}" |
| 845 |
|
| 846 |
skip=false # don't skip any package(s) unless it's listed in SKIP_PACKAGE_FROM_REMOVAL |
| 847 |
|
| 848 |
if [ -n "${SKIP_PACKAGE_FROM_REMOVAL:-}" ] ; then |
| 849 |
echo "*** SKIP_PACKAGE_FROM_REMOVAL is set [${SKIP_PACKAGE_FROM_REMOVAL}]" |
| 850 |
for package in $SKIP_PACKAGE_FROM_REMOVAL ; do |
| 851 |
if echo "${package}" | grep -q "${binpackage}" ; then |
| 852 |
skip=true |
| 853 |
fi |
| 854 |
done |
| 855 |
fi |
| 856 |
|
| 857 |
if $skip ; then |
| 858 |
echo "*** Package '$binpackage' listed in SKIP_PACKAGE_FROM_REMOVAL - skipping removal therefore ***" |
| 859 |
elif echo "$file" | grep -qE '_all.u?deb$'; then |
| 860 |
# note: "removesrc" would remove foreign arch files (of different builds) |
| 861 |
echo "*** Removing existing package ${binpackage} from repository ${REPOS} (arch all) ***" |
| 862 |
${SUDO_CMD:-} ${REPREPRO_CMD} -b "${REPOSITORY}" ${REPREPRO_OPTS} remove "${REPOS}" "${binpackage}" |
| 863 |
else |
| 864 |
echo "*** Removing existing package ${binpackage} from repository ${REPOS} for arch ${arch} ***" |
| 865 |
${SUDO_CMD:-} ${REPREPRO_CMD} -A "${arch}" -b "${REPOSITORY}" ${REPREPRO_OPTS} remove "${REPOS}" "${binpackage}" |
| 866 |
fi |
| 867 |
|
| 868 |
done |
| 869 |
|
| 870 |
} |
| 871 |
|
| 872 |
remove_missing_binary_packages() { |
| 873 |
if [ -n "${SKIP_MISSING_BINARY_REMOVAL:-${SKIP_REMOVAL:-}}" ] ; then |
| 874 |
echo "*** Skipping removal of existing packages as requested via SKIP_MISSING_BINARY_REMOVAL or SKIP_REMOVAL ***" |
| 875 |
return 0 |
| 876 |
fi |
| 877 |
|
| 878 |
echo "*** Checking for missing binary packages to be considered for removal ***" |
| 879 |
|
| 880 |
# In a binary-only build we don't get any arch-all (*_all.deb) packages and |
| 881 |
# therefore they won't be listed in the changes file. As a result they would |
| 882 |
# be reported as missing from the build and to be considered for removal. |
| 883 |
# As we don't want to remove the arch-all package e.g. from the amd64 repos |
| 884 |
# in the i386 run we've to skip the removal procedure then. |
| 885 |
case "${DEBBUILDOPTS:-}" in |
| 886 |
*-B*) |
| 887 |
echo "*** Skipping removal of missing binaries as being a binary-only build ***" |
| 888 |
return 0 |
| 889 |
;; |
| 890 |
esac |
| 891 |
|
| 892 |
for p in $(${SUDO_CMD:-} ${REPREPRO_CMD} -b "${REPOSITORY}" ${REPREPRO_OPTS} --list-format '${package}\n' listmatched "${REPOS}" '*' | sort -u); do |
| 893 |
echo " $binary_list " | grep -q " $p " || missing_packages="${missing_packages:-} $p" |
| 894 |
done |
| 895 |
|
| 896 |
if echo "${missing_packages:-}" | grep -q '.' ; then |
| 897 |
echo "*** Binary package(s) found, missing in build version: ${missing_packages:-} ***" |
| 898 |
|
| 899 |
for p in $missing_packages ; do |
| 900 |
skip=false # don't skip any package(s) unless it's listed in SKIP_PACKAGE_FROM_REMOVAL |
| 901 |
|
| 902 |
if [ -n "${SKIP_PACKAGE_FROM_REMOVAL:-}" ] ; then |
| 903 |
echo "*** SKIP_PACKAGE_FROM_REMOVAL is set [${SKIP_PACKAGE_FROM_REMOVAL}]" |
| 904 |
for package in $SKIP_PACKAGE_FROM_REMOVAL ; do |
| 905 |
if echo "${package}" | grep -q "${p}" ; then |
| 906 |
skip=true |
| 907 |
fi |
| 908 |
done |
| 909 |
fi |
| 910 |
|
| 911 |
if $skip ; then |
| 912 |
echo "*** Package '$p' listed in SKIP_PACKAGE_FROM_REMOVAL - skipping removal therefore ***" |
| 913 |
else |
| 914 |
echo "*** Removing $p from $REPOS to avoid out-of-date data ***" |
| 915 |
${SUDO_CMD:-} ${REPREPRO_CMD} -b "${REPOSITORY}" ${REPREPRO_OPTS} remove "${REPOS}" "${p}" |
| 916 |
fi |
| 917 |
done |
| 918 |
|
| 919 |
fi |
| 920 |
} |
| 921 |
|
| 922 |
get_arch_changes() { |
| 923 |
case ${architecture} in |
| 924 |
all) echo '*';; # support as file expansion in reprepro cmdline |
| 925 |
*) echo "${architecture}";; |
| 926 |
esac |
| 927 |
} |
| 928 |
|
| 929 |
reprepro_wrapper() { |
| 930 |
if [ -n "${SKIP_REPREPRO_WRAPPER:-}" ] ; then |
| 931 |
echo "*** Skipping reprepro_wrapper as requested via SKIP_REPREPRO_WRAPPER ***" |
| 932 |
return |
| 933 |
fi |
| 934 |
|
| 935 |
if ! [ -d "$REPOSITORY" ] ; then |
| 936 |
bailout 1 "Error: repository ${REPOSITORY} does not exist." |
| 937 |
fi |
| 938 |
|
| 939 |
if ! [ -r "${REPOSITORY}"/conf/distributions ] ; then |
| 940 |
echo "*** reprepro configuration file ${REPOSITORY}/conf/distributions does not exist, generating now ***" |
| 941 |
${SUDO_CMD:-} jdg-generate-reprepro-codename "${REPOS}" |
| 942 |
elif ! ${SUDO_CMD:-} grep -q "^\(Codename\|Suite\): ${REPOS}$" "${REPOSITORY}"/conf/distributions ; then |
| 943 |
echo "*** Codename ${REPOS} does not exist in repository ${REPOSITORY}, generating now ***" |
| 944 |
${SUDO_CMD:-} jdg-generate-reprepro-codename "${REPOS}" |
| 945 |
fi |
| 946 |
|
| 947 |
remove_packages |
| 948 |
remove_missing_binary_packages |
| 949 |
|
| 950 |
echo "*** Including packages in repository $REPOS ***" |
| 951 |
${SUDO_CMD:-} ${REPREPRO_CMD} -b "${REPOSITORY}" ${REPREPRO_OPTS} \ |
| 952 |
--ignore=wrongdistribution --ignore=uploaders --ignore=surprisingbinary \ |
| 953 |
include "${REPOS}" "${WORKSPACE}/binaries/"*"_${newest_version}_$(get_arch_changes).changes" |
| 954 |
[ $? -eq 0 ] || bailout 1 "Error: Failed to include binary package in $REPOS repository." |
| 955 |
} |
| 956 |
|
| 957 |
dput_wrapper() { |
| 958 |
command -v dput || bailout 1 "Error: dput not found." |
| 959 |
|
| 960 |
echo "*** Including packages in repository $REPOS ***" |
| 961 |
${SUDO_CMD:-} dput -U -u "${DPUT_HOST:-}" "${WORKSPACE}/binaries/"*"_${newest_version}_$(get_arch_changes).changes" |
| 962 |
[ $? -eq 0 ] || bailout 1 "Error: Failed to upload binary package to $DPUT_HOST dput host." |
| 963 |
} |
| 964 |
|
| 965 |
freight_ensure_repo() { |
| 966 |
local varlib |
| 967 |
local varcache |
| 968 |
|
| 969 |
if [ ! -f "$FREIGHT_CONF" ] ; then |
| 970 |
echo "*** Creating freight repository configuration in $FREIGHT_CONF ***" |
| 971 |
|
| 972 |
${SUDO_CMD:-} mkdir -p "$(dirname ${FREIGHT_CONF})" |
| 973 |
${SUDO_CMD:-} sh -c "cat > ${FREIGHT_CONF}" <<EOF |
| 974 |
# Generated by jenkins-debian-glue |
| 975 |
# |
| 976 |
# Directories for the Freight library and Freight cache. |
| 977 |
# Your web server's document root should point to \$VARCACHE. |
| 978 |
VARLIB="${FREIGHT_VARLIB:-/var/lib/freight}" |
| 979 |
VARCACHE="${FREIGHT_VARCACHE:-/var/cache/freight}" |
| 980 |
|
| 981 |
# Default 'Origin' and 'Label' fields for 'Release' files. |
| 982 |
ORIGIN="Freight" |
| 983 |
LABEL="Freight" |
| 984 |
|
| 985 |
# Cache the control files after each run (on), or regenerate them every |
| 986 |
# time (off). |
| 987 |
CACHE="off" |
| 988 |
|
| 989 |
# GPG key to sign repositories, derived from jenkins-debian-glue's \$KEY_ID setting |
| 990 |
GPG="${KEY_ID:-}" |
| 991 |
|
| 992 |
# Whether to follow symbolic links in \$VARLIB to produce extra components |
| 993 |
# in the cache directory (on) or not (off). |
| 994 |
SYMLINKS="off" |
| 995 |
EOF |
| 996 |
fi |
| 997 |
|
| 998 |
[ -f "$FREIGHT_CONF" ] || bailout 1 "Error: Failed to create freight configuration in $FREIGHT_CONF" |
| 999 |
|
| 1000 |
echo "*** Creating freight directory structure ***" |
| 1001 |
varlib=$(grep ^VARLIB "$FREIGHT_CONF" | cut -f 2 -d = | sed -e 's,",,g') |
| 1002 |
varcache=$(grep ^VARCACHE "$FREIGHT_CONF" | cut -f 2 -d = | sed -e 's,",,g') |
| 1003 |
${SUDO_CMD:-} mkdir -p "${varcache}" "${varlib}" |
| 1004 |
${SUDO_CMD:-} chmod o-rwx "${varlib}" |
| 1005 |
} |
| 1006 |
|
| 1007 |
freight_wrapper() { |
| 1008 |
freight_ensure_repo |
| 1009 |
|
| 1010 |
echo "*** Including packages via freight in repository ${FREIGHT_VARLIB}/${REPOS} ***" |
| 1011 |
${SUDO_CMD:-} freight add -v -c "$FREIGHT_CONF" "${WORKSPACE}/binaries/"*"_${newest_version}"*"deb" "apt/${REPOS}" |
| 1012 |
[ $? -eq 0 ] || bailout 1 "Error: Failed to add binary package to repository." |
| 1013 |
|
| 1014 |
echo "*** Generating freight cache ***" |
| 1015 |
${SUDO_CMD:-} freight cache -v -c "$FREIGHT_CONF" |
| 1016 |
[ $? -eq 0 ] || bailout 1 "Error: Failed to generate freight cache for ${FREIGHT_VARCACHE}." |
| 1017 |
} |
| 1018 |
|
| 1019 |
trunk_release() { |
| 1020 |
# setting TRUNK_RELEASE=true enables release-trunk repository, |
| 1021 |
# to always get a copy of the package(s) to a central place |
| 1022 |
if [ -z "${TRUNK_RELEASE:-}" ] ; then |
| 1023 |
echo "*** TRUNK_RELEASE is not enabled ***" |
| 1024 |
elif [ "${IGNORE_RELEASE_TRUNK:-}" = "true" ] ; then |
| 1025 |
echo "*** IGNORE_RELEASE_TRUNK is set, ignoring request to add package(s) to $TRUNK_RELEASE repos ***" |
| 1026 |
else |
| 1027 |
echo "*** TRUNK_RELEASE is enabled ($TRUNK_RELEASE) ***" |
| 1028 |
|
| 1029 |
${SUDO_CMD:-} jdg-generate-reprepro-codename "$TRUNK_RELEASE" |
| 1030 |
|
| 1031 |
|
| 1032 |
if [ -n "${SKIP_REPREPRO_WRAPPER:-}" ] ; then |
| 1033 |
${SUDO_CMD:-} ${REPREPRO_CMD} -b "${REPOSITORY}" ${REPREPRO_OPTS} \ |
| 1034 |
--ignore=wrongdistribution --ignore=uploaders --ignore=surprisingbinary \ |
| 1035 |
include "${TRUNK_RELEASE}" "${WORKSPACE}/binaries/"*"_${newest_version}_$(get_arch_changes).changes" |
| 1036 |
[ $? -eq 0 ] || bailout 1 "Error: Failed to include binary package in ${TRUNK_RELEASE} repository." |
| 1037 |
else |
| 1038 |
${SUDO_CMD:-} ${REPREPRO_CMD} -b "${REPOSITORY}" ${REPREPRO_OPTS} \ |
| 1039 |
--ignore=wrongdistribution copymatched "$TRUNK_RELEASE" "$REPOS" '*' |
| 1040 |
[ $? -eq 0 ] || bailout 1 "Error: Failed to copy packages from ${REPOS} to ${TRUNK_RELEASE}." |
| 1041 |
fi |
| 1042 |
fi |
| 1043 |
} |
| 1044 |
|
| 1045 |
# Get rid of *unused* files to avoid uploading unreferenced files to incoming |
| 1046 |
# directory. When generating the source package on jessie this might result in |
| 1047 |
# a *.tar.xz file. But when building the binary package for an older release |
| 1048 |
# like wheezy this might generate a *.tar.gz file. When directly copying those |
| 1049 |
# files into reprepro's incoming directory (e.g. for release builds) the |
| 1050 |
# *unused* tarball will be kept around, so let's avoid that. |
| 1051 |
drop_unused_debfiles() { |
| 1052 |
if [ "${DROP_UNUSED_DEBFILES:-}" = "false" ] ; then |
| 1053 |
echo "*** DROP_UNUSED_DEBFILES is disabled, not removing unreferenced artifact files. ***" |
| 1054 |
return 0 |
| 1055 |
fi |
| 1056 |
|
| 1057 |
if ! [ -x "$(which dcmd)" ] ; then |
| 1058 |
echo "Error: dcmd executable not available, please install devscripts package." >&2 |
| 1059 |
exit 1 |
| 1060 |
fi |
| 1061 |
|
| 1062 |
( |
| 1063 |
cd "${WORKSPACE}/binaries/" |
| 1064 |
for file in ./* ; do |
| 1065 |
filename="$(basename "${file}")" # get rid of trailing ./ |
| 1066 |
if ! dcmd ./*.changes | grep -q -- "${filename}" ; then |
| 1067 |
echo "*** Removing file ${filename} ***" |
| 1068 |
rm -f "./${filename}" |
| 1069 |
fi |
| 1070 |
done |
| 1071 |
) |
| 1072 |
} |
| 1073 |
|
| 1074 |
release_repos() { |
| 1075 |
echo "*** Environment variable 'release' is set, running through release steps. ***" |
| 1076 |
|
| 1077 |
# if codename should be different from release |
| 1078 |
if [ -z "${RELEASE_DISTRIBUTION:-}" ] ; then |
| 1079 |
RELEASE_DISTRIBUTION="$release" |
| 1080 |
echo "*** Environment variable 'RELEASE_DISTRIBUTION' is unset, defaulting to $RELEASE_DISTRIBUTION ***" |
| 1081 |
fi |
| 1082 |
|
| 1083 |
if [ -n "${RELEASE_REPOSITORY:-}" ]; then |
| 1084 |
local REPOSITORY="${RELEASE_REPOSITORY}" |
| 1085 |
else |
| 1086 |
local REPOSITORY="${REPOSITORY}/release/${release}" |
| 1087 |
fi; |
| 1088 |
|
| 1089 |
mkdir -p "${REPOSITORY}/incoming/${RELEASE_DISTRIBUTION}" |
| 1090 |
mkdir -p "${REPOSITORY}/conf" |
| 1091 |
|
| 1092 |
if [ "${REMOVE_FROM_RELEASE:-}" = 'true' ]; then |
| 1093 |
echo "*** REMOVE_FROM_RELEASE is set, trying to remove package(s) from release repository" |
| 1094 |
REPOS="${release}" remove_packages |
| 1095 |
fi |
| 1096 |
|
| 1097 |
# get rid of files that aren't mentioned in the changes files before copying to incoming directory |
| 1098 |
drop_unused_debfiles |
| 1099 |
|
| 1100 |
cp "${WORKSPACE}/binaries/"* "${REPOSITORY}/incoming/${RELEASE_DISTRIBUTION}/" |
| 1101 |
[ $? -eq 0 ] || bailout 1 "Error: Failed to copy binary packages to release directory." |
| 1102 |
|
| 1103 |
REPOSITORY=$REPOSITORY jdg-generate-reprepro-codename "${RELEASE_DISTRIBUTION}" |
| 1104 |
|
| 1105 |
# lock access to file to avoid duplicate entries when two jdg-build-and-provide-package |
| 1106 |
# runs happen at the very same time with regard to conf/incoming setup |
| 1107 |
( |
| 1108 |
flock --timeout 5 9 || bailout 1 "Error: could not lock file ${REPOSITORY}/conf/incoming, giving up." |
| 1109 |
|
| 1110 |
if ! grep -q "^Name: $RELEASE_DISTRIBUTION$" "${REPOSITORY}/conf/incoming" 2>/dev/null ; then |
| 1111 |
cat >> "${REPOSITORY}/conf/incoming" << EOF |
| 1112 |
|
| 1113 |
Name: ${RELEASE_DISTRIBUTION} |
| 1114 |
IncomingDir: incoming/${RELEASE_DISTRIBUTION} |
| 1115 |
TempDir: tmp |
| 1116 |
LogDir: log |
| 1117 |
MorgueDir: ${REPOSITORY}/morgue |
| 1118 |
Default: ${RELEASE_DISTRIBUTION} |
| 1119 |
Permit: unused_files |
| 1120 |
Cleanup: unused_files on_deny on_error |
| 1121 |
|
| 1122 |
EOF |
| 1123 |
fi |
| 1124 |
) 9>/var/lock/jdg-build-and-provide-incoming."$(id -un)" || bailout 1 "Error while setting up incoming repository." |
| 1125 |
|
| 1126 |
local old_dir=$(pwd) |
| 1127 |
cd "${REPOSITORY}/incoming/${RELEASE_DISTRIBUTION}" |
| 1128 |
${SUDO_CMD:-} ${REPREPRO_CMD} -b "${REPOSITORY}" ${REPREPRO_OPTS} --ignore=wrongdistribution \ |
| 1129 |
processincoming "${RELEASE_DISTRIBUTION}" "$(basename ${WORKSPACE}/binaries/*.changes)" |
| 1130 |
local RC=$? |
| 1131 |
cd "$old_dir" |
| 1132 |
|
| 1133 |
if [ $RC -ne 0 ] ; then |
| 1134 |
bailout 1 "Error: Failed to execute processincoming for release ${release}." |
| 1135 |
fi |
| 1136 |
} |
| 1137 |
|
| 1138 |
deploy_to_releases() { |
| 1139 |
|
| 1140 |
# support usage of same source package to build binaries for different distributions |
| 1141 |
if [ -n "${ADJUST_DISTRIBUTION_ONTHEFLY:-}" ] ; then |
| 1142 |
echo "*** ADJUST_DISTRIBUTION_ONTHEFLY is set, setting Distribution in changes file as requested to ${distribution} ***" |
| 1143 |
sed -i "s/Distribution: .*/Distribution: ${distribution}/" "${WORKSPACE}/binaries/"*"_${newest_version}"_${architecture}.changes |
| 1144 |
fi |
| 1145 |
|
| 1146 |
if [ -n "${USE_FREIGHT:-}" ] ; then |
| 1147 |
freight_wrapper |
| 1148 |
# Freight is currently not able to manage release or trunk release repos, |
| 1149 |
# so this is the stage where we exit in that case. |
| 1150 |
return 0 |
| 1151 |
fi |
| 1152 |
if [ -n "${USE_DPUT:-}" ] ; then |
| 1153 |
dput_wrapper |
| 1154 |
return 0 |
| 1155 |
fi |
| 1156 |
|
| 1157 |
if [ -n "${release:-}" ] && [ "$release" != "none" ] && [ "$release" != "trunk" ] && \ |
| 1158 |
# '${release}' is a hidden bomb: when provided through predefined parameters |
| 1159 |
# from an upstream jenkins job (like foo-binaries receiving the parameters |
| 1160 |
# from foo-source) but the job (foo-binaries) gets triggered manually (without |
| 1161 |
# setting the predefined parameters therefore) then ${release} is set to |
| 1162 |
# '${release}' instead of being empty |
| 1163 |
[ "${release}" != '${release}' ] ; then |
| 1164 |
|
| 1165 |
if [ -z "${RELEASE_REPOSITORIES:-}" ] ; then |
| 1166 |
release_repos |
| 1167 |
else |
| 1168 |
# allow pushing packages to multiple release repositories, like: |
| 1169 |
# RELEASE_REPOSITORIES="/srv/repository/release/ce/${release} /srv/repository/release/pro/${release}" |
| 1170 |
for release_repository in ${RELEASE_REPOSITORIES:-} ; do |
| 1171 |
RELEASE_REPOSITORY="$release_repository" release_repos |
| 1172 |
done |
| 1173 |
fi |
| 1174 |
else |
| 1175 |
reprepro_wrapper |
| 1176 |
trunk_release |
| 1177 |
fi |
| 1178 |
} |
| 1179 |
|
| 1180 |
# make them available for the Jenkin's 'Archiving artifacts' |
| 1181 |
binaries_to_workspace() { |
| 1182 |
echo "*** Moving binaries files to workspace. ***" |
| 1183 |
mv "${WORKSPACE}/binaries/"* "${WORKSPACE}/" |
| 1184 |
rmdir "${WORKSPACE}/binaries/" |
| 1185 |
} |
| 1186 |
|
| 1187 |
# main execution |
| 1188 |
trap bailout SIGHUP SIGINT SIGQUIT SIGABRT SIGALRM SIGTERM |
| 1189 |
|
| 1190 |
checks_and_defaults |
| 1191 |
clean_workspace |
| 1192 |
identify_package_name |
| 1193 |
set_base_path |
| 1194 |
build_info |
| 1195 |
identify_sourcefile |
| 1196 |
dist_and_arch_settings |
| 1197 |
|
| 1198 |
# do not run in repos job? |
| 1199 |
if [ -n "${PROVIDE_ONLY:-}" ] ; then |
| 1200 |
echo "*** Config variable 'PROVIDE_ONLY' is set, ignoring request to run cowbuilder. ***" |
| 1201 |
else |
| 1202 |
cowbuilder_init |
| 1203 |
cowbuilder_run |
| 1204 |
fi |
| 1205 |
|
| 1206 |
# do not run in binaries job? |
| 1207 |
if [ -n "${BUILD_ONLY:-}" ] ; then |
| 1208 |
echo "*** Config variable 'BUILD_ONLY' is set, ignoring request to use local repository. ***" |
| 1209 |
else |
| 1210 |
deploy_to_releases |
| 1211 |
fi |
| 1212 |
|
| 1213 |
binaries_to_workspace |
| 1214 |
autopkg_run |
| 1215 |
autopkgtest_results |
| 1216 |
|
| 1217 |
if [ -n "${POST_BUILD_HOOK:-}" ] ; then |
| 1218 |
echo "*** Found environment variable POST_BUILD_HOOK, set to ${POST_BUILD_HOOK:-} ***" |
| 1219 |
sh ${POST_BUILD_HOOK:-} |
| 1220 |
fi |
| 1221 |
|
| 1222 |
bailout 0 |
| 1223 |
|
| 1224 |
# vim:foldmethod=marker ts=2 ft=sh ai expandtab sw=2 |