19146: Remove unneeded special case checks, explain the needed one.
[arvados.git] / build / run-build-test-packages-one-target.sh
index 16f14426e98aeb5ec40d342ca4b35ddc639978c9..aa4acb6a2bf7817f933f9bdb85b74789c91b154b 100755 (executable)
@@ -10,10 +10,23 @@ Syntax:
         WORKSPACE=/path/to/arvados $(basename $0) [options]
 
 --target <target>
-    Distribution to build packages for (default: debian8)
+    Distribution to build packages for (default: debian10)
+--only-build <package>
+    Build only a specific package (or ONLY_BUILD from environment)
+--arch <arch>
+    Build a specific architecture (or ARCH from environment, defaults to native architecture)
+--force-build
+    Build even if the package exists upstream or if it has already been
+    built locally
+--force-test
+    Test even if there is no new untested package
 --upload
     If the build and test steps are successful, upload the packages
     to a remote apt repository (default: false)
+--debug
+    Output debug information (default: false)
+--rc
+    Optional Parameter to build Release Candidate
 --build-version <version>
     Version to build (default:
     \$ARVADOS_BUILDING_VERSION-\$ARVADOS_BUILDING_ITERATION or
@@ -40,14 +53,16 @@ if ! [[ -d "$WORKSPACE" ]]; then
 fi
 
 PARSEDOPTS=$(getopt --name "$0" --longoptions \
-    help,upload,rc,target:,build-version: \
+    help,debug,upload,rc,target:,force-test,only-build:,force-build,arch:,build-version: \
     -- "" "$@")
 if [ $? -ne 0 ]; then
     exit 1
 fi
 
-TARGET=debian8
+TARGET=debian10
 UPLOAD=0
+RC=0
+DEBUG=
 
 declare -a build_args=()
 
@@ -62,12 +77,27 @@ while [ $# -gt 0 ]; do
         --target)
             TARGET="$2"; shift
             ;;
+        --force-test)
+            FORCE_TEST=1
+            ;;
+        --force-build)
+            FORCE_BUILD=1
+            ;;
+        --only-build)
+            ONLY_BUILD="$2"; shift
+            ;;
+        --arch)
+            ARCH="$2"; shift
+            ;;
+        --debug)
+            DEBUG=" --debug"
+            ;;
         --upload)
             UPLOAD=1
             ;;
         --rc)
             RC=1
-            ;;    
+            ;;
         --build-version)
             build_args+=("$1" "$2")
             shift
@@ -84,6 +114,22 @@ done
 
 build_args+=(--target "$TARGET")
 
+if [[ -n "$ONLY_BUILD" ]]; then
+  build_args+=(--only-build "$ONLY_BUILD")
+fi
+
+if [[ -n "$FORCE_BUILD" ]]; then
+  build_args+=(--force-build)
+fi
+
+if [[ -n "$FORCE_TEST" ]]; then
+  build_args+=(--force-test)
+fi
+
+if [[ -n "$ARCH" ]]; then
+  build_args+=(--arch "$ARCH")
+fi
+
 exit_cleanly() {
     trap - INT
     report_outcomes
@@ -96,7 +142,7 @@ COLUMNS=80
 title "Start build packages"
 timer_reset
 
-$WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}"
+$WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}"$DEBUG
 
 checkexit $? "build packages"
 title "End of build packages (`timer`)"
@@ -105,7 +151,7 @@ title "Start test packages"
 timer_reset
 
 if [ ${#failures[@]} -eq 0 ]; then
-  $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}" --test-packages
+  $WORKSPACE/build/run-build-packages-one-target.sh "${build_args[@]}" --test-packages$DEBUG
 else
   echo "Skipping package upload, there were errors building the packages"
 fi
@@ -119,11 +165,11 @@ if [[ "$UPLOAD" != 0 ]]; then
 
   if [ ${#failures[@]} -eq 0 ]; then
     if [[ "$RC" != 0 ]]; then
-      echo "/usr/local/arvados-dev/jenkins/run_upload_packages_testing.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET"
-      /usr/local/arvados-dev/jenkins/run_upload_packages_testing.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET
+      echo "/usr/local/arvados-dev/jenkins/run_upload_packages.py --repo testing -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET"
+      /usr/local/arvados-dev/jenkins/run_upload_packages.py --repo testing -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET
     else
-      echo "/usr/local/arvados-dev/jenkins/run_upload_packages.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET"
-      /usr/local/arvados-dev/jenkins/run_upload_packages.py -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET
+      echo "/usr/local/arvados-dev/jenkins/run_upload_packages.py --repo dev -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET"
+      /usr/local/arvados-dev/jenkins/run_upload_packages.py --repo dev -H jenkinsapt@apt.arvados.org -o Port=2222 --workspace $WORKSPACE $TARGET
     fi
   else
     echo "Skipping package upload, there were errors building and/or testing the packages"