2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: AGPL-3.0
6 read -rd "\000" helpmessage <<EOF
7 $(basename $0): Build, test and (optionally) upload packages for one target
10 WORKSPACE=/path/to/arvados $(basename $0) [options]
13 Distribution to build packages for (default: debian8)
15 If the build and test steps are successful, upload the packages
16 to a remote apt repository (default: false)
17 --build-version <version>
18 Version to build (default:
19 \$ARVADOS_BUILDING_VERSION-\$ARVADOS_BUILDING_ITERATION or
20 0.1.timestamp.commithash)
22 WORKSPACE=path Path to the Arvados source tree to build packages from
26 if ! [[ -n "$WORKSPACE" ]]; then
27 echo >&2 "$helpmessage"
29 echo >&2 "Error: WORKSPACE environment variable not set"
34 if ! [[ -d "$WORKSPACE" ]]; then
35 echo >&2 "$helpmessage"
37 echo >&2 "Error: $WORKSPACE is not a directory"
42 PARSEDOPTS=$(getopt --name "$0" --longoptions \
43 help,upload,target:,build-version: \
52 declare -a build_args=()
54 eval set -- "$PARSEDOPTS"
55 while [ $# -gt 0 ]; do
58 echo >&2 "$helpmessage"
69 build_args+=("$1" "$2")
74 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
82 build_args+=(--target "$TARGET")
91 . $WORKSPACE/build/run-library.sh
93 title "Start build packages"
96 $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}"
98 checkexit $? "build packages"
99 title "End of build packages (`timer`)"
101 title "Start test packages"
104 if [ ${#failures[@]} -eq 0 ]; then
105 $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}" --test-packages
107 echo "Skipping package upload, there were errors building the packages"
110 checkexit $? "test packages"
111 title "End of test packages (`timer`)"
113 if [[ "$UPLOAD" != 0 ]]; then
114 title "Start upload packages"
117 if [ ${#failures[@]} -eq 0 ]; then
118 echo "/usr/local/arvados-dev/jenkins/run_upload_packages.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET"
119 /usr/local/arvados-dev/jenkins/run_upload_packages.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET
121 echo "Skipping package upload, there were errors building and/or testing the packages"
123 checkexit $? "upload packages"
124 title "End of upload packages (`timer`)"