diff --git a/scripts/build-container.sh b/scripts/build-container.sh index 58932e52..0a3a1bfe 100755 --- a/scripts/build-container.sh +++ b/scripts/build-container.sh @@ -37,6 +37,7 @@ usage() "\t\tstarting the build and do not use image cache\n" printf "%b" "--debian-tag\tUse specified tag for Debian base image\n" \ "\t\t(default=$DEFAULT_DEBIAN_TAG)\n" + printf "%b" "--git-refspec\tUse specified revision/branch of kas repository (default=HEAD)\n" printf "%b" "--tag\t\tTag container with specified name (default=next)\n" printf "%b" "--target\tBuild specified target(s) (default=\"kas kas-isar\")\n" } @@ -79,6 +80,7 @@ build_image() ARCH= CLEAN= DEBIAN_TAG= +GIT_REFSPEC=HEAD TARGETS= TAG=next while [ $# -gt 0 ]; do @@ -94,6 +96,10 @@ while [ $# -gt 0 ]; do shift DEBIAN_TAG="$1" ;; + --git-refspec) + shift + GIT_REFSPEC="$1" + ;; --tag) shift TAG="$1" @@ -127,6 +133,7 @@ fi KAS_CLONE=$(mktemp -d --tmpdir kas-tmp.XXXXXXXXXX) git clone . "$KAS_CLONE" cd "$KAS_CLONE" || exit 1 +git checkout -q "$GIT_REFSPEC" RESULT=0 for TARGET in $TARGETS; do diff --git a/scripts/reproduce-container.sh b/scripts/reproduce-container.sh index a15742d3..a478fc9d 100755 --- a/scripts/reproduce-container.sh +++ b/scripts/reproduce-container.sh @@ -50,9 +50,15 @@ if [ -z "$DEBIAN_TAG" ]; then exit 1 fi +GIT_REFSPEC="$TAG" +if [ "$GIT_REFSPEC" = "latest" ]; then + GIT_REFSPEC=master +fi + # shellcheck disable=SC2086 "$(dirname "$0")/build-container.sh" $ARCH_OPT --target "$TARGET" \ - --tag repro-test --debian-tag "$DEBIAN_TAG" --clean || exit 1 + --tag repro-test --git-refspec "$GIT_REFSPEC" \ + --debian-tag "$DEBIAN_TAG" --clean || exit 1 echo ""