X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/56c4d0c08266cacbca73e77aa82939e00a0bb69e..28f892a37c81486a3fc353fdb6c875e708e0f7c9:/build/run-library.sh diff --git a/build/run-library.sh b/build/run-library.sh index 8a228622af..fa2be6ac7a 100755 --- a/build/run-library.sh +++ b/build/run-library.sh @@ -170,35 +170,48 @@ package_go_binary() { native_arch=$(get_native_arch) if [[ "$native_arch" != "amd64" ]] && [[ -n "$target_arch" ]] && [[ "$native_arch" != "$target_arch" ]]; then - echo "Error: no cross compilation support for Go on $native_arch yet, can not build $prog for $target_arch" + echo "Error: no cross compilation support for Go on $native_arch, can not build $prog for $target_arch" return 1 fi + cross_compilation=1 + if [[ "$TARGET" == "centos7" ]]; then + 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" + return 1 + fi + cross_compilation=0 + fi + + if [[ "$package_format" == "deb" ]] && + [[ "$TARGET" == "debian10" ]] || [[ "$TARGET" == "ubuntu1804" ]] || [[ "$TARGET" == "ubuntu2004" ]]; then + # Due to bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983477 the libfuse-dev package for arm64 does + # not install properly side by side with the amd64 version before Debian 11. + 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" + return 1 + fi + cross_compilation=0 + fi + if [[ -n "$target_arch" ]]; then - # A target architecture has been specified - package_go_binary_worker "$src_path" "$prog" "$package_format" "$description" "$native_arch" "$target_arch" "$license_file" - return $? + archs=($target_arch) else - # No target architecture specified, default to native target. When on amd64 also crosscompile arm64 - # but only when building deb packages (centos does not have support for crosscompiling userspace). + # No target architecture specified, default to native target. When on amd64 + # also crosscompile arm64 (when supported). archs=($native_arch) - if [[ "$native_arch" == "amd64" ]] && - [[ "$package_format" == "deb" ]] && - [[ "$TARGET" != "debian10" ]] && - [[ "$TARGET" != "ubuntu1804" ]] && - [[ "$TARGET" != "ubuntu2004" ]]; then - # Due to bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983477 the libfuse-dev package for arm64 does - # not install properly side by side with the amd64 version before Debian 11. + if [[ $cross_compilation -ne 0 ]]; then archs+=("arm64") fi - for ta in ${archs[@]}; do - package_go_binary_worker "$src_path" "$prog" "$package_format" "$description" "$native_arch" "$ta" "$license_file" - retval=$? - if [[ $retval -ne 0 ]]; then - return $retval - fi - done fi + + for ta in ${archs[@]}; do + package_go_binary_worker "$src_path" "$prog" "$package_format" "$description" "$native_arch" "$ta" "$license_file" + retval=$? + if [[ $retval -ne 0 ]]; then + return $retval + fi + done } # Usage: package_go_binary services/foo arvados-foo deb "Compute foo to arbitrary precision" [amd64/arm64] [amd64/arm64] [apache-2.0.txt] @@ -211,11 +224,6 @@ package_go_binary_worker() { local target_arch="${1:-amd64}"; shift local license_file="${1:-agpl-3.0.txt}"; shift - if [[ "$native_arch" != "$target_arch" ]] && [[ "$package_format" == "rpm" ]]; then - echo "Error: no cross compilation support for Go on $native_arch ($package_format), can not build $prog for $target_arch" - return 1 - fi - debug_echo "package_go_binary $src_path as $prog (native arch: $native_arch, target arch: $target_arch)" local basename="${src_path##*/}" calculate_go_package_version go_package_version $src_path @@ -484,7 +492,8 @@ handle_rails_package() { cd "$srcdir" mkdir -p tmp git rev-parse HEAD >git-commit.version - bundle package --all + bundle config set cache_all true + bundle package ) if [[ 0 != "$?" ]] || ! cd "$WORKSPACE/packages/$TARGET"; then echo "ERROR: $pkgname package prep failed" >&2 @@ -570,12 +579,12 @@ handle_workbench () { # Build the workbench server package test_rails_package_presence arvados-workbench "$WORKSPACE/apps/workbench" if [[ "$?" == "0" ]] ; then + calculate_go_package_version arvados_server_version cmd/arvados-server + arvados_server_iteration=$(default_iteration "arvados-server" "$arvados_server_version" "go") + ( set -e - calculate_go_package_version arvados_server_version cmd/arvados-server - arvados_server_iteration=$(default_iteration "arvados-server" "$arvados_server_version" "go") - # The workbench package has a build-time dependency on the arvados-server # package for config manipulation, so install it first. cd $WORKSPACE/cmd/arvados-server @@ -595,7 +604,8 @@ handle_workbench () { # We need to bundle to be ready even when we build a package without vendor directory # because asset compilation requires it. - bundle install --system >"$STDOUT_IF_DEBUG" + bundle config set --local system 'true' >"$STDOUT_IF_DEBUG" + bundle install >"$STDOUT_IF_DEBUG" # clear the tmp directory; the asset generation step will recreate tmp/cache/assets, # and we want that in the package, so it's easier to not exclude the tmp directory @@ -779,7 +789,7 @@ fpm_build_virtualenv_worker () { ARVADOS_BUILDING_ITERATION=1 fi - local python=python3 + local python=$PYTHON3_EXECUTABLE pip=pip3 PACKAGE_PREFIX=$PYTHON3_PKG_PREFIX