Merge branch '8784-dir-listings'
[arvados.git] / build / run-build-packages-one-target.sh
index 6a1ec9ca6d75b622abe37cb71b7773bd3efd60b6..7f75624af64351a293f57d723d87962223b4805f 100755 (executable)
@@ -1,4 +1,7 @@
 #!/bin/bash
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
 
 read -rd "\000" helpmessage <<EOF
 $(basename $0): Orchestrate run-build-packages.sh for one target
@@ -11,7 +14,7 @@ Syntax:
 --command
     Build command to execute (default: use built-in Docker image command)
 --test-packages
-    Run package install test script "test-packages-$target.sh"
+    Run package install test script "test-packages-[target].sh"
 --debug
     Output debug information (default: false)
 --only-build <package>
@@ -99,7 +102,8 @@ if [[ -n "$test_packages" ]]; then
 
     if [[ -n "$(find $WORKSPACE/packages/$TARGET -name '*.deb')" ]] ; then
         (cd $WORKSPACE/packages/$TARGET
-         dpkg-scanpackages .  2> >(grep -v 'warning' 1>&2) | gzip -c > Packages.gz
+          dpkg-scanpackages .  2> >(grep -v 'warning' 1>&2) | tee Packages | gzip -c > Packages.gz
+          apt-ftparchive -o APT::FTPArchive::Release::Origin=Arvados release . > Release
         )
     fi
 
@@ -193,6 +197,14 @@ if [[ -n "$test_packages" ]]; then
 else
     echo
     echo "START: build packages on $IMAGE" >&2
+    # Move existing packages and other files into the processed/ subdirectory
+    if [[ ! -e "${WORKSPACE}/packages/${TARGET}/processed" ]]; then
+      mkdir -p "${WORKSPACE}/packages/${TARGET}/processed"
+    fi
+    set +e
+    mv -f ${WORKSPACE}/packages/${TARGET}/* ${WORKSPACE}/packages/${TARGET}/processed/ 2>/dev/null
+    set -e
+    # Build packages
     if docker run --rm \
         "${docker_volume_args[@]}" \
         --env ARVADOS_DEBUG=$ARVADOS_DEBUG \