3 read -rd "\000" helpmessage <<EOF
4 $(basename $0): Orchestrate run-build-packages.sh for one target
7 WORKSPACE=/path/to/arvados $(basename $0) [options]
10 Distribution to build packages for (default: debian7)
12 Build command to execute (default: use built-in Docker image command)
14 Run package install test script "test-packages-$target.sh"
16 Output debug information (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 \
39 help,debug,test-packages,target:,command: \
49 eval set -- "$PARSEDOPTS"
50 while [ $# -gt 0 ]; do
53 echo >&2 "$helpmessage"
71 echo >&2 "$0: unrecognized argument '$2'. Try: $0 --help"
81 if [[ -n "$test_packages" ]]; then
82 if [[ -n "$(find $WORKSPACE/packages/$TARGET -name *.rpm)" ]] ; then
83 createrepo $WORKSPACE/packages/$TARGET
86 if [[ -n "$(find $WORKSPACE/packages/$TARGET -name *.deb)" ]] ; then
87 (cd $WORKSPACE/packages/$TARGET
88 dpkg-scanpackages . 2> >(grep -v 'warning' 1>&2) | gzip -c > Packages.gz
92 COMMAND="/jenkins/test-packages-$TARGET.sh"
93 IMAGE="arvados/package-test:$TARGET"
95 IMAGE="arvados/build:$TARGET"
96 if [[ "$COMMAND" != "" ]]; then
97 COMMAND="/usr/local/rvm/bin/rvm-exec default bash /jenkins/$COMMAND --target $TARGET$DEBUG"
101 JENKINS_DIR=$(dirname "$(readlink -e "$0")")
103 if [[ -n "$test_packages" ]]; then
104 pushd "$JENKINS_DIR/package-test-dockerfiles"
106 pushd "$JENKINS_DIR/dockerfiles"
111 time docker build --tag=$IMAGE .
116 if docker run --rm -v "$JENKINS_DIR:/jenkins" -v "$WORKSPACE:/arvados" \
117 --env ARVADOS_DEBUG=1 "$IMAGE" $COMMAND; then
118 # Success - nothing more to do.
122 echo "ERROR: $tag build failed with exit status $FINAL_EXITCODE." >&2