21453: Install Python package virtualenvs under /usr/lib
[arvados.git] / build / run-library.sh
index bb224a71724ed79a91e87e99eb91c96c06817a78..a395db8b773b30a781a5606e736ec92c4b33c875 100755 (executable)
@@ -190,12 +190,12 @@ package_go_binary() {
   fi
 
   case "$package_format-$TARGET" in
-    # Older Debian/Ubuntu do not support cross compilation because the
+    # Ubuntu 20.04 does not support cross compilation because the
     # libfuse package does not support multiarch. See
     # <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983477>.
     # Red Hat-based distributions do not support native cross compilation at
     # all (they use a qemu-based solution we haven't implemented yet).
-    deb-debian10|deb-ubuntu1804|deb-ubuntu2004|rpm-*)
+    deb-ubuntu2004|rpm-*)
       cross_compilation=0
       if [[ "$native_arch" == "amd64" ]] && [[ -n "$target_arch" ]] && [[ "$native_arch" != "$target_arch" ]]; then
         echo "Error: no cross compilation support for Go on $native_arch for $TARGET, can not build $prog for $target_arch"
@@ -440,10 +440,8 @@ test_package_presence() {
       echo "Package $full_pkgname build forced with --force-build, building"
     elif [[ "$FORMAT" == "deb" ]]; then
       declare -A dd
-      dd[debian10]=buster
       dd[debian11]=bullseye
       dd[debian12]=bookworm
-      dd[ubuntu1804]=bionic
       dd[ubuntu2004]=focal
       dd[ubuntu2204]=jammy
       D=${dd[$TARGET]}
@@ -469,7 +467,6 @@ test_package_presence() {
     else
       local rpm_root
       case "$TARGET" in
-        centos7) rpm_root="CentOS/7/dev" ;;
         rocky8) rpm_root="CentOS/8/dev" ;;
         *)
           echo "FIXME: Don't know RPM URL path for $TARGET, building"
@@ -705,7 +702,7 @@ fpm_build_virtualenv_worker () {
   cd $WORKSPACE/$PKG_DIR
 
   rm -rf dist/*
-  local venv_dir="dist/build/usr/share/python$PYTHON3_VERSION/dist/$PYTHON_PKG"
+  local venv_dir="dist/build/usr/lib/$PYTHON_PKG"
   echo "Creating virtualenv..."
   if ! "$PYTHON3_EXECUTABLE" -m venv "$venv_dir"; then
     printf "Error, unable to run\n  %s -m venv %s\n" "$PYTHON3_EXECUTABLE" "$venv_dir"
@@ -868,17 +865,18 @@ fpm_build_virtualenv_worker () {
   # make sure the systemd service file ends up in the right place
   # used by arvados-docker-cleaner
   if [[ -e "${systemd_unit}" ]]; then
-    COMMAND_ARR+=("usr/share/python$PYTHON3_VERSION/dist/$PKG/share/doc/$PKG/$PKG.service=/lib/systemd/system/$PKG.service")
+    COMMAND_ARR+=("$sys_venv_dir/share/doc/$PKG/$PKG.service=/lib/systemd/system/$PKG.service")
   fi
 
   COMMAND_ARR+=("${fpm_args[@]}")
 
-  # Make sure to install all our package binaries in /usr/bin.
-  # We have to walk $WORKSPACE/$PKG_DIR/bin rather than
-  # $WORKSPACE/build/usr/share/$python/dist/$PYTHON_PKG/bin/ to get the list
-  # because the latter also includes all the python binaries for the virtualenv.
-  # We have to take the copies of our binaries from the latter directory, though,
-  # because those are the ones we rewrote the shebang line of, above.
+  # Make sure to install all our package binaries in /usr/bin. We have to
+  # walk $WORKSPACE/$PKG_DIR/bin rather than $venv_dir/bin to get the list
+  # because the latter also includes scripts installed by all the
+  # dependencies in the virtualenv, which may conflict with other
+  # packages. We have to take the copies of our binaries from the latter
+  # directory, though, because those are the ones we rewrote the shebang
+  # line of, above.
   if [[ -e "$WORKSPACE/$PKG_DIR/bin" ]]; then
     for binary in `ls $WORKSPACE/$PKG_DIR/bin`; do
       COMMAND_ARR+=("$sys_venv_dir/bin/$binary=/usr/bin/")