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)
16 If the build and test steps are successful, upload the packages
17 to a remote apt repository (default: false)
19 WORKSPACE=path Path to the Arvados source tree to build packages from
23 if ! [[ -n "$WORKSPACE" ]]; then
24 echo >&2 "$helpmessage"
26 echo >&2 "Error: WORKSPACE environment variable not set"
31 if ! [[ -d "$WORKSPACE" ]]; then
32 echo >&2 "$helpmessage"
34 echo >&2 "Error: $WORKSPACE is not a directory"
39 PARSEDOPTS=$(getopt --name "$0" --longoptions \
40 help,target:,verno:,upload \
49 eval set -- "$PARSEDOPTS"
50 while [ $# -gt 0 ]; do
53 echo >&2 "$helpmessage"
69 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
84 . $WORKSPACE/build/run-library.sh
86 title "Start build packages"
89 $WORKSPACE/build/run-build-packages-one-target.sh --target $TARGET
91 checkexit $? "build packages"
92 title "End of build packages (`timer`)"
94 title "Start test packages"
97 if [ ${#failures[@]} -eq 0 ]; then
98 $WORKSPACE/build/run-build-packages-one-target.sh --target $TARGET --test-packages
100 echo "Skipping package upload, there were errors building the packages"
103 checkexit $? "test packages"
104 title "End of test packages (`timer`)"
106 if [[ "$UPLOAD" != 0 ]]; then
107 title "Start upload packages"
110 if [ ${#failures[@]} -eq 0 ]; then
111 /usr/local/arvados-dev/jenkins/run_upload_packages.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET
113 echo "Skipping package upload, there were errors building and/or testing the packages"
115 checkexit $? "upload packages"
116 title "End of upload packages (`timer`)"