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 If the build and test steps are successful, upload the packages
18 to a remote apt repository (default: false)
20 Output debug information (default: false)
22 Optional Parameter to build Release Candidate
23 --build-version <version>
24 Version to build (default:
25 \$ARVADOS_BUILDING_VERSION-\$ARVADOS_BUILDING_ITERATION or
26 0.1.timestamp.commithash)
28 WORKSPACE=path Path to the Arvados source tree to build packages from
32 if ! [[ -n "$WORKSPACE" ]]; then
33 echo >&2 "$helpmessage"
35 echo >&2 "Error: WORKSPACE environment variable not set"
40 if ! [[ -d "$WORKSPACE" ]]; then
41 echo >&2 "$helpmessage"
43 echo >&2 "Error: $WORKSPACE is not a directory"
48 PARSEDOPTS=$(getopt --name "$0" --longoptions \
49 help,debug,upload,rc,target:,only-build:,build-version: \
60 declare -a build_args=()
62 eval set -- "$PARSEDOPTS"
63 while [ $# -gt 0 ]; do
66 echo >&2 "$helpmessage"
74 ONLY_BUILD="$2"; shift
86 build_args+=("$1" "$2")
91 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
99 build_args+=(--target "$TARGET")
101 if [[ -n "$ONLY_BUILD" ]]; then
102 build_args+=(--only-build "$ONLY_BUILD")
112 . $WORKSPACE/build/run-library.sh
114 title "Start build packages"
117 $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}"$DEBUG
119 checkexit $? "build packages"
120 title "End of build packages (`timer`)"
122 title "Start test packages"
125 if [ ${#failures[@]} -eq 0 ]; then
126 $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}" --test-packages$DEBUG
128 echo "Skipping package upload, there were errors building the packages"
131 checkexit $? "test packages"
132 title "End of test packages (`timer`)"
134 if [[ "$UPLOAD" != 0 ]]; then
135 title "Start upload packages"
138 if [ ${#failures[@]} -eq 0 ]; then
139 if [[ "$RC" != 0 ]]; then
140 echo "/usr/local/arvados-dev/jenkins/run_upload_packages.py --repo testing -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET"
141 /usr/local/arvados-dev/jenkins/run_upload_packages.py --repo testing -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET
143 echo "/usr/local/arvados-dev/jenkins/run_upload_packages.py --repo dev -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET"
144 /usr/local/arvados-dev/jenkins/run_upload_packages.py --repo dev -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET
147 echo "Skipping package upload, there were errors building and/or testing the packages"
149 checkexit $? "upload packages"
150 title "End of upload packages (`timer`)"