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)
18 WORKSPACE=path Path to the Arvados source tree to build packages from
22 if ! [[ -n "$WORKSPACE" ]]; then
23 echo >&2 "$helpmessage"
25 echo >&2 "Error: WORKSPACE environment variable not set"
30 if ! [[ -d "$WORKSPACE" ]]; then
31 echo >&2 "$helpmessage"
33 echo >&2 "Error: $WORKSPACE is not a directory"
38 PARSEDOPTS=$(getopt --name "$0" --longoptions \
48 eval set -- "$PARSEDOPTS"
49 while [ $# -gt 0 ]; do
52 echo >&2 "$helpmessage"
64 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
79 . $WORKSPACE/build/run-library.sh
81 title "Start build packages"
84 $WORKSPACE/build/run-build-packages-one-target.sh --target $TARGET
86 checkexit $? "build packages"
87 title "End of build packages (`timer`)"
89 title "Start test packages"
92 if [ ${#failures[@]} -eq 0 ]; then
93 $WORKSPACE/build/run-build-packages-one-target.sh --target $TARGET --test-packages
95 echo "Skipping package upload, there were errors building the packages"
98 checkexit $? "test packages"
99 title "End of test packages (`timer`)"
101 if [[ "$UPLOAD" != 0 ]]; then
102 title "Start upload packages"
105 if [ ${#failures[@]} -eq 0 ]; then
106 /usr/local/arvados-dev/jenkins/run_upload_packages.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET
108 echo "Skipping package upload, there were errors building and/or testing the packages"
110 checkexit $? "upload packages"
111 title "End of upload packages (`timer`)"