From 8c59211afc9b8a39f7eca23043132b5bcccbc6e4 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Sun, 28 Jan 2024 21:40:36 -0500 Subject: [PATCH] 21392: Package build scripts require --target Now that we no longer support debian10, it doesn't make sense as a default. Rather than continue updating the default at arbitrary points in time, remove it and require the user to specify their target. Arvados-DCO-1.1-Signed-off-by: Brett Smith --- build/README | 11 +++++------ build/run-build-packages-one-target.sh | 14 +++++++++++--- build/run-build-packages.sh | 14 +++++++++++--- build/run-build-test-packages-one-target.sh | 14 +++++++++++--- 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/build/README b/build/README index 66ca509552..e6d14cf664 100644 --- a/build/README +++ b/build/README @@ -11,15 +11,14 @@ In order to build packages, you will need: Quickstart ========== -Build and test all the packages for debian10 on your architecture by +Build and test all the packages for a distribution on your architecture by running: - ./run-build-test-packages-one-target.sh + ./run-build-test-packages-one-target.sh --target DISTRO -This will build package build and test Docker images for debian10, build all -packages in a build container, then test all packages in a test container. - -Use a different distro by adding the `--target TARGET` option. +This will build package build and test Docker images for the named target +distribution, build all packages in a build container, then test all +packages in a test container. Limit the build to a single architecture by adding the `--arch ARCH` option. Supported architectures are amd64 and arm64. Note cross-compilation diff --git a/build/run-build-packages-one-target.sh b/build/run-build-packages-one-target.sh index be97ef0d13..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 @@ -139,6 +139,14 @@ 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 diff --git a/build/run-build-packages.sh b/build/run-build-packages.sh index df7031fca5..77ce054318 100755 --- a/build/run-build-packages.sh +++ b/build/run-build-packages.sh @@ -9,7 +9,7 @@ read -rd "\000" helpmessage < [options] Options: @@ -18,7 +18,7 @@ Options: --debug Output debug information (default: false) --target - Distribution to build packages for (default: debian10) + Distribution to build packages for --only-build Build only a specific package (or ONLY_BUILD from environment) --arch @@ -47,8 +47,8 @@ VENDOR="The Arvados Project" DEBUG=${ARVADOS_DEBUG:-0} FORCE_BUILD=${FORCE_BUILD:-0} EXITCODE=0 -TARGET=debian10 COMMAND= +TARGET= PARSEDOPTS=$(getopt --name "$0" --longoptions \ help,build-bundle-packages,debug,target:,only-build:,arch:,force-build \ @@ -93,6 +93,14 @@ while [ $# -gt 0 ]; do shift done +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 [[ "$COMMAND" != "" ]]; then COMMAND="/usr/local/rvm/bin/rvm-exec default bash /jenkins/$COMMAND --target $TARGET" fi diff --git a/build/run-build-test-packages-one-target.sh b/build/run-build-test-packages-one-target.sh index 9af95d13d3..d1217162e6 100755 --- a/build/run-build-test-packages-one-target.sh +++ b/build/run-build-test-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 --only-build Build only a specific package (or ONLY_BUILD from environment) --arch @@ -61,10 +61,10 @@ if [ $? -ne 0 ]; then exit 1 fi -TARGET=debian10 UPLOAD=0 RC=0 DEBUG= +TARGET= declare -a build_args=() @@ -117,6 +117,14 @@ while [ $# -gt 0 ]; do shift done +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 + build_args+=(--target "$TARGET") if [[ -n "$ONLY_BUILD" ]]; then -- 2.30.2