11789: Merge branch 'master' into 11789-arvput-exclude-flag
[arvados.git] / build / run-build-packages.sh
index 490e4307ec68ab7cd11e18cd5d911bd91a578c6d..a8e730c27f562f14210a28c2ce2567d8a06933aa 100755 (executable)
@@ -1,7 +1,10 @@
 #!/bin/bash
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: AGPL-3.0
 
 . `dirname "$(readlink -f "$0")"`/run-library.sh
-. `dirname "$(readlink -f "$0")"`/libcloud-pin
+. `dirname "$(readlink -f "$0")"`/libcloud-pin.sh
 
 read -rd "\000" helpmessage <<EOF
 $(basename $0): Build Arvados packages
@@ -32,8 +35,6 @@ DEBUG=${ARVADOS_DEBUG:-0}
 TARGET=debian8
 COMMAND=
 
-RAILS_PACKAGE_ITERATION=7
-
 PARSEDOPTS=$(getopt --name "$0" --longoptions \
     help,build-bundle-packages,debug,target:,only-build: \
     -- "" "$@")
@@ -112,6 +113,9 @@ case "$TARGET" in
     ubuntu1404)
         FORMAT=deb
         ;;
+    ubuntu1604)
+        FORMAT=deb
+        ;;
     centos7)
         FORMAT=rpm
         PYTHON2_PACKAGE=$(rpm -qf "$(which python$PYTHON2_VERSION)" --queryformat '%{NAME}\n')
@@ -257,7 +261,7 @@ handle_python_package
     arvados_src_version="$(version_from_git)"
 
     cd $WORKSPACE/packages/$TARGET
-    test_package_presence arvados-src $arvados_src_version src
+    test_package_presence arvados-src $arvados_src_version src ""
 
     if [[ "$?" == "0" ]]; then
       cd "$WORKSPACE"
@@ -519,6 +523,16 @@ while read -r line || [[ -n "$line" ]]; do
   pkgtype=${arr[4]}
   arch=${arr[5]}
   extra=${arr[6]}
+  declare -a 'extra_arr=('"$extra"')'
+
+  if [[ "$FORMAT" == "rpm" ]]; then
+    if [[ "$arch" == "all" ]]; then
+      arch="noarch"
+    fi
+    if [[ "$arch" == "amd64" ]]; then
+      arch="x86_64"
+    fi
+  fi
 
   if [[ "$pkgtype" == "python" ]]; then
     outname=$(echo "$name" | sed -e 's/^python-//' -e 's/_/-/g' -e "s/^/${PYTHON2_PKG_PREFIX}-/")
@@ -548,7 +562,7 @@ while read -r line || [[ -n "$line" ]]; do
                 "python$PYTHON2_VERSION" setup.py $DASHQ_UNLESS_DEBUG egg_info build
                 chmod -R go+rX .
                 set +e
-                fpm_build . "$outname" "" "$pkgtype" "$version" --iteration "$iteration" $extra
+                fpm_build . "$outname" "" "$pkgtype" "$version" --iteration "$iteration" "${extra_arr[@]}"
                 # The upload step uses the package timestamp to determine
                 # if it is new.  --no-clobber plays nice with that.
                 mv --no-clobber "$outname"*.$FORMAT "$WORKSPACE/packages/$TARGET"
@@ -565,7 +579,7 @@ while read -r line || [[ -n "$line" ]]; do
       *)
           test_package_presence $outname $version $pkgtype $iteration $arch
           if [[ "$?" == "0" ]]; then
-            fpm_build "$name" "$outname" "" "$pkgtype" "$version" --iteration "$iteration" $extra
+            fpm_build "$name" "$outname" "" "$pkgtype" "$version" --iteration "$iteration" "${extra_arr[@]}"
           fi
           ;;
   esac