Imported Upstream version 2.27.0
[platform/upstream/git.git] / ci / run-docker-build.sh
similarity index 63%
rename from ci/run-linux32-build.sh
rename to ci/run-docker-build.sh
index e3a193a..8d47a5f 100755 (executable)
@@ -1,25 +1,33 @@
 #!/bin/sh
 #
-# Build and test Git in a 32-bit environment
+# Build and test Git inside container
 #
 # Usage:
-#   run-linux32-build.sh <host-user-id>
+#   run-docker-build.sh <host-user-id>
 #
 
 set -ex
 
 if test $# -ne 1 || test -z "$1"
 then
-       echo >&2 "usage: run-linux32-build.sh <host-user-id>"
+       echo >&2 "usage: run-docker-build.sh <host-user-id>"
        exit 1
 fi
 
-# Update packages to the latest available versions
-linux32 --32bit i386 sh -c '
-    apt update >/dev/null &&
-    apt install -y build-essential libcurl4-openssl-dev libssl-dev \
-       libexpat-dev gettext python >/dev/null
-'
+case "$jobname" in
+Linux32)
+       switch_cmd="linux32 --32bit i386"
+       ;;
+linux-musl)
+       switch_cmd=
+       useradd () { adduser -D "$@"; }
+       ;;
+*)
+       exit 1
+       ;;
+esac
+
+"${0%/*}/install-docker-dependencies.sh"
 
 # If this script runs inside a docker container, then all commands are
 # usually executed as root. Consequently, the host user might not be
@@ -51,10 +59,17 @@ else
 fi
 
 # Build and test
-linux32 --32bit i386 su -m -l $CI_USER -c '
+command $switch_cmd su -m -l $CI_USER -c "
        set -ex
+       export DEVELOPER='$DEVELOPER'
+       export DEFAULT_TEST_TARGET='$DEFAULT_TEST_TARGET'
+       export GIT_PROVE_OPTS='$GIT_PROVE_OPTS'
+       export GIT_TEST_OPTS='$GIT_TEST_OPTS'
+       export GIT_TEST_CLONE_2GB='$GIT_TEST_CLONE_2GB'
+       export MAKEFLAGS='$MAKEFLAGS'
+       export cache_dir='$cache_dir'
        cd /usr/src/git
-       test -n "$cache_dir" && ln -s "$cache_dir/.prove" t/.prove
+       test -n '$cache_dir' && ln -s '$cache_dir/.prove' t/.prove
        make
        make test
-'
+"