X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/d8971ff1526d4698ee00f9fca864beed5a9d7498..dd481ab3359f1b360a22d03c09d8035ef5db1f38:/build/run-build-packages-one-target.sh diff --git a/build/run-build-packages-one-target.sh b/build/run-build-packages-one-target.sh index aa8d15bbc8..31a546fd35 100755 --- a/build/run-build-packages-one-target.sh +++ b/build/run-build-packages-one-target.sh @@ -21,8 +21,12 @@ Syntax: Build only a specific package --only-test Test only a specific package +--force-test + Test even if there is no new untested package --build-version - Version to build (default: \$ARVADOS_BUILDING_VERSION or 0.1.timestamp.commithash) + Version to build (default: + \$ARVADOS_BUILDING_VERSION-\$ARVADOS_BUILDING_ITERATION or + 0.1.timestamp.commithash) WORKSPACE=path Path to the Arvados source tree to build packages from @@ -47,7 +51,7 @@ if ! [[ -d "$WORKSPACE" ]]; then fi PARSEDOPTS=$(getopt --name "$0" --longoptions \ - help,debug,test-packages,target:,command:,only-test:,only-build:,build-version: \ + help,debug,test-packages,target:,command:,only-test:,force-test,only-build:,build-version: \ -- "" "$@") if [ $? -ne 0 ]; then exit 1 @@ -72,6 +76,9 @@ while [ $# -gt 0 ]; do test_packages=1 packages="$2"; shift ;; + --force-test) + FORCE_TEST=true + ;; --only-build) ONLY_BUILD="$2"; shift ;; @@ -86,7 +93,15 @@ while [ $# -gt 0 ]; do test_packages=1 ;; --build-version) - ARVADOS_BUILDING_VERSION="$2" + if [[ -z "$2" ]]; then + : + elif ! [[ "$2" =~ (.*)-(.*) ]]; then + echo >&2 "FATAL: --build-version '$2' does not include an iteration. Try '${2}-1'?" + exit 1 + else + ARVADOS_BUILDING_VERSION="${BASH_REMATCH[1]}" + ARVADOS_BUILDING_ITERATION="${BASH_REMATCH[2]}" + fi shift ;; --) @@ -102,18 +117,20 @@ done set -e if [[ -n "$ARVADOS_BUILDING_VERSION" ]]; then - IFS=- read ARVADOS_BUILDING_VERSION ARVADOS_BUILDING_ITERATION <&2 "FATAL: version does not include an iteration. Try --build-version ${ARVADOS_BUILDING_VERSION}-1" - exit 1 - fi + echo "build version='$ARVADOS_BUILDING_VERSION', package iteration='$ARVADOS_BUILDING_ITERATION'" fi - if [[ -n "$test_packages" ]]; then if [[ -n "$(find $WORKSPACE/packages/$TARGET -name '*.rpm')" ]] ; then + set +e + /usr/bin/which createrepo >/dev/null + if [[ "$?" != "0" ]]; then + echo >&2 + echo >&2 "Error: please install createrepo. E.g. sudo apt-get install createrepo" + echo >&2 + exit 1 + fi + set -e createrepo $WORKSPACE/packages/$TARGET fi @@ -149,6 +166,7 @@ popd if test -z "$packages" ; then packages="arvados-api-server + arvados-client arvados-docker-cleaner arvados-git-httpd arvados-node-manager @@ -164,14 +182,10 @@ if test -z "$packages" ; then keep-rsync keepstore keep-web - libarvados-perl" - - case "$TARGET" in - *) - packages="$packages python-arvados-fuse - python-arvados-python-client python-arvados-cwl-runner" - ;; - esac + libarvados-perl + python-arvados-fuse + python-arvados-python-client + python-arvados-cwl-runner" fi FINAL_EXITCODE=0 @@ -195,6 +209,14 @@ if [[ -n "$test_packages" ]]; then if [[ -n "$ONLY_BUILD" ]] && [[ "$p" != "$ONLY_BUILD" ]]; then continue fi + if [[ -e "${WORKSPACE}/packages/.last_test_${TARGET}" ]] && [[ -z "$FORCE_TEST" ]]; then + MATCH=`find ${WORKSPACE}/packages/ -newer ${WORKSPACE}/packages/.last_test_${TARGET} -regex .*${TARGET}/$p.*` + if [[ "$MATCH" == "" ]]; then + # No new package has been built that needs testing + echo "Skipping $p test because no new package was built since the last test." + continue + fi + fi echo echo "START: $p test on $IMAGE" >&2 if docker run --rm \ @@ -211,6 +233,8 @@ if [[ -n "$test_packages" ]]; then echo "ERROR: $p test on $IMAGE failed with exit status $FINAL_EXITCODE" >&2 fi done + + touch ${WORKSPACE}/packages/.last_test_${TARGET} else echo echo "START: build packages on $IMAGE" >&2