]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
CI: add prefix 'ci_' to env var 'builddir'
authorRalf Habacker <ralf.habacker@freenet.de>
Fri, 4 Aug 2023 09:56:12 +0000 (11:56 +0200)
committerRalf Habacker <ralf.habacker@freenet.de>
Mon, 7 Aug 2023 17:49:53 +0000 (19:49 +0200)
This customization simplifies their use, e.g. when outputting the command
line used. Because of FreeBSD, 'awk' is used instead of 'gawk' to make
sure that the tool is available.

.gitlab-ci.yml
tools/ci-build.sh
tools/ci-install.sh

index 7ab797575824f77152a07b41560848560b9d66b7..a56a3e367e24843d398d0622550b4b386ac71d2f 100644 (file)
@@ -40,7 +40,7 @@ stages:
   - build
 
 variables:
-  builddir: "build"
+  ci_builddir: "build"
   ci_in_docker: "yes"
   ci_local_packages: "yes"
   ci_parallel: "2"
@@ -439,12 +439,11 @@ freebsd image:
     # Variables are not forwarded to the vm automatically so we forward the
     # ones starting with ci_ to ci-build.sh manually. This works because
     # $(env | grep "ci_.*=") is evaluated on the current host not in the VM.
-    # We also have to forward builddir since this is required by ci-build.sh.
-    - /app/vmctl exec "cd $CI_PROJECT_NAME && env make=gmake builddir=$builddir $(echo $(env | grep "ci_.*=")) bash -x ./tools/ci-build.sh $CI_BUILD_ARGS"
+    - /app/vmctl exec "cd $CI_PROJECT_NAME && env make=gmake $(echo $(env | grep "ci_.*=")) bash -x ./tools/ci-build.sh $CI_BUILD_ARGS"
     # Copy build artifacts from the VM for archiving/JUnit XML display
-    - mkdir -p "$builddir"
-    - rsync -av "vm:$CI_PROJECT_NAME/$builddir/meson-logs" "$builddir/" || true
-    - scp -v "vm:$CI_PROJECT_NAME/$builddir/config.h" . || true
+    - mkdir -p "$ci_builddir"
+    - rsync -av "vm:$CI_PROJECT_NAME/$ci_builddir/meson-logs" "$ci_builddir/" || true
+    - scp -v "vm:$CI_PROJECT_NAME/$ci_builddir/config.h" . || true
     - scp -v "vm:$ci_cmake_junit_output" "$ci_cmake_junit_output" || true
     # Finally, shut down the VM.
     - /app/vmctl stop
index df7ada2c1be6b02fc6b99a6c85b750a0752fdbe7..ba981579d9bbf52c735f4ca59c6800e81261f776 100755 (executable)
@@ -129,7 +129,8 @@ init_wine() {
 # One of static, shared; used for windows cross builds
 : "${ci_runtime:=static}"
 
-echo "ci_buildsys=$ci_buildsys ci_distro=$ci_distro ci_host=$ci_host ci_local_packages=$ci_local_packages ci_parallel=$ci_parallel ci_suite=$ci_suite ci_test=$ci_test ci_test_fatal=$ci_test_fatal ci_variant=$ci_variant ci_runtime=$ci_runtime $0"
+# print used command line
+set +x; env | awk 'BEGIN { s = "" } $1 ~ /^ci_/ { s=s " " $0} END { print s " " SCRIPT }' SCRIPT=$0; set -x
 
 # choose distribution
 if [ "$ci_distro" = "auto" ]; then
@@ -155,11 +156,11 @@ maybe_fail_tests () {
 NOCONFIGURE=1 ./autogen.sh
 
 # clean up directories from possible previous builds
-if [ -z "$builddir" ]; then
-  echo "ERROR: builddir environment variable must be set!"
+if [ -z "$ci_builddir" ]; then
+  echo "ERROR: ci_builddir environment variable must be set!"
   exit 1
 fi
-rm -rf "$builddir"
+rm -rf "$ci_builddir"
 rm -rf ci-build-dist
 rm -rf src-from-dist
 
@@ -180,8 +181,8 @@ case "$ci_buildsys" in
         ;;
 esac
 
-mkdir -p "$builddir"
-builddir="$(realpath "$builddir")"
+mkdir -p "$ci_builddir"
+ci_builddir="$(realpath "$ci_builddir")"
 
 #
 # cross compile setup
@@ -212,7 +213,7 @@ case "$ci_host" in
         ;;
 esac
 
-cd "$builddir"
+cd "$ci_builddir"
 
 case "$ci_host" in
     (*-w64-mingw32)
@@ -226,13 +227,13 @@ case "$ci_host" in
                 libgcc_path=$(dirname "$("${ci_host}-gcc" -print-libgcc-file-name)")
             fi
             init_wine \
-                "${builddir}/bin" \
-                "${builddir}/subprojects/expat-2.4.8" \
-                "${builddir}/subprojects/glib-2.72.2/gio" \
-                "${builddir}/subprojects/glib-2.72.2/glib" \
-                "${builddir}/subprojects/glib-2.72.2/gmodule" \
-                "${builddir}/subprojects/glib-2.72.2/gobject" \
-                "${builddir}/subprojects/glib-2.72.2/gthread" \
+                "${ci_builddir}/bin" \
+                "${ci_builddir}/subprojects/expat-2.4.8" \
+                "${ci_builddir}/subprojects/glib-2.72.2/gio" \
+                "${ci_builddir}/subprojects/glib-2.72.2/glib" \
+                "${ci_builddir}/subprojects/glib-2.72.2/gmodule" \
+                "${ci_builddir}/subprojects/glib-2.72.2/gobject" \
+                "${ci_builddir}/subprojects/glib-2.72.2/gthread" \
                 "${dep_prefix}/bin" \
                 ${libgcc_path:+"$libgcc_path"}
         fi
@@ -437,7 +438,7 @@ case "$ci_buildsys" in
                 ;;
         esac
 
-        $cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON -S "$srcdir" -B "$builddir" "$@"
+        $cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON -S "$srcdir" -B "$ci_builddir" "$@"
 
         ${make}
         # The test coverage for OOM-safety is too verbose to be useful on
index 8abbc6d00739de90c8c403bb39489b9ebd80f47f..716c6422b93ea39e96f3ebc73d5ff62356a92ca8 100755 (executable)
@@ -54,7 +54,8 @@ NULL=
 # One of debug, reduced, legacy, production
 : "${ci_variant:=production}"
 
-echo "ci_distro=$ci_distro ci_in_docker=$ci_in_docker ci_host=$ci_host ci_local_packages=$ci_local_packages ci_suite=$ci_suite ci_variant=$ci_variant $0"
+# print used command line
+set +x; env | awk 'BEGIN { s = "" } $1 ~ /^ci_/ { s=s " " $0} END { print s " " SCRIPT }' SCRIPT=$0; set -x
 
 if [ $(id -u) = 0 ]; then
     sudo=