X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/461fdaa1b96142b8065c131ae0334046fc71ea56..cdbbd5b29a0f2056ef52f23489a29af6d116a94f:/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 12ed10bcb8..857e9c112d 100755 --- a/build/run-build-packages-one-target.sh +++ b/build/run-build-packages-one-target.sh @@ -7,10 +7,10 @@ read -rd "\000" helpmessage < [options] --target - Distribution to build packages for (default: debian10) + Distribution to build packages for --command Build command to execute (default: use built-in Docker image command) --test-packages @@ -64,10 +64,10 @@ if [ $? -ne 0 ]; then exit 1 fi -TARGET=debian10 FORCE_BUILD=0 COMMAND= DEBUG= +TARGET= eval set -- "$PARSEDOPTS" while [ $# -gt 0 ]; do @@ -137,12 +137,27 @@ while [ $# -gt 0 ]; do done set -e +orig_umask="$(umask)" + +if [[ -z "$TARGET" ]]; then + echo "FATAL: --target must be specified" >&2 + exit 2 +elif [[ ! -d "$WORKSPACE/build/package-build-dockerfiles/$TARGET" ]]; then + echo "FATAL: unknown build target '$TARGET'" >&2 + exit 2 +fi if [[ -n "$ARVADOS_BUILDING_VERSION" ]]; then echo "build version='$ARVADOS_BUILDING_VERSION', package iteration='$ARVADOS_BUILDING_ITERATION'" fi if [[ -n "$test_packages" ]]; then + # Packages are built world-readable, so package indexes should be too, + # especially because since 2022 apt uses an unprivileged user `_apt` to + # retrieve everything. Ensure it has permissions to read the packages + # when mounted as a volume inside the Docker container. + chmod a+rx "$WORKSPACE" "$WORKSPACE/packages" "$WORKSPACE/packages/$TARGET" + umask 022 if [[ -n "$(find $WORKSPACE/packages/$TARGET -name '*.rpm')" ]] ; then CREATEREPO="$(command -v createrepo createrepo_c | tail -n1)" if [[ -z "$CREATEREPO" ]]; then @@ -179,6 +194,7 @@ if [[ -n "$test_packages" ]]; then COMMAND="/jenkins/package-testing/test-packages-$TARGET.sh" IMAGE="arvados/package-test:$TARGET" + umask "$orig_umask" else IMAGE="arvados/build:$TARGET" if [[ "$COMMAND" != "" ]]; then