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: debian10)
14 --only-build <package>
15 Build only a specific package (or ONLY_BUILD from environment)
17 Build a specific architecture (or ARCH from environment, defaults to native architecture)
19 If the build and test steps are successful, upload the packages
20 to a remote apt repository (default: false)
22 Output debug information (default: false)
24 Optional Parameter to build Release Candidate
25 --build-version <version>
26 Version to build (default:
27 \$ARVADOS_BUILDING_VERSION-\$ARVADOS_BUILDING_ITERATION or
28 0.1.timestamp.commithash)
30 WORKSPACE=path Path to the Arvados source tree to build packages from
34 if ! [[ -n "$WORKSPACE" ]]; then
35 echo >&2 "$helpmessage"
37 echo >&2 "Error: WORKSPACE environment variable not set"
42 if ! [[ -d "$WORKSPACE" ]]; then
43 echo >&2 "$helpmessage"
45 echo >&2 "Error: $WORKSPACE is not a directory"
50 PARSEDOPTS=$(getopt --name "$0" --longoptions \
51 help,debug,upload,rc,target:,only-build:,arch:,build-version: \
62 declare -a build_args=()
64 eval set -- "$PARSEDOPTS"
65 while [ $# -gt 0 ]; do
68 echo >&2 "$helpmessage"
76 ONLY_BUILD="$2"; shift
91 build_args+=("$1" "$2")
96 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
104 build_args+=(--target "$TARGET")
106 if [[ -n "$ONLY_BUILD" ]]; then
107 build_args+=(--only-build "$ONLY_BUILD")
110 if [[ -n "$ARCH" ]]; then
111 build_args+=(--arch "$ARCH")
121 . $WORKSPACE/build/run-library.sh
123 title "Start build packages"
126 $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}"$DEBUG
128 checkexit $? "build packages"
129 title "End of build packages (`timer`)"
131 title "Start test packages"
134 if [ ${#failures[@]} -eq 0 ]; then
135 $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}" --test-packages$DEBUG
137 echo "Skipping package upload, there were errors building the packages"
140 checkexit $? "test packages"
141 title "End of test packages (`timer`)"
143 if [[ "$UPLOAD" != 0 ]]; then
144 title "Start upload packages"
147 if [ ${#failures[@]} -eq 0 ]; then
148 if [[ "$RC" != 0 ]]; then
149 echo "/usr/local/arvados-dev/jenkins/run_upload_packages.py --repo testing -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET"
150 /usr/local/arvados-dev/jenkins/run_upload_packages.py --repo testing -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET
152 echo "/usr/local/arvados-dev/jenkins/run_upload_packages.py --repo dev -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET"
153 /usr/local/arvados-dev/jenkins/run_upload_packages.py --repo dev -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET
156 echo "Skipping package upload, there were errors building and/or testing the packages"
158 checkexit $? "upload packages"
159 title "End of upload packages (`timer`)"