]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
ci: Introduce $(CI_PREPARE_SCRIPT)
authorAndrea Bolognani <abologna@redhat.com>
Thu, 15 Aug 2019 13:24:50 +0000 (15:24 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Wed, 21 Aug 2019 16:58:27 +0000 (18:58 +0200)
This script is run before $(CI_BUILD_SCRIPT) and can be used
to tweak the environment as necessary before the build starts.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Makefile.am
ci/Makefile
ci/prepare.sh [new file with mode: 0644]

index 96fac92186eba7f6631fd91fb221c3bea0ec542a..cf9ff94f4f401d4f8e8e2c04d3dc5352209d4d29 100644 (file)
@@ -52,6 +52,7 @@ EXTRA_DIST = \
   build-aux/vc-list-files \
   ci/Makefile \
   ci/build.sh \
+  ci/prepare.sh \
   $(NULL)
 
 pkgconfigdir = $(libdir)/pkgconfig
index 2170f5d3e41fb9f1161a99a692b4be7f77fd7cdf..67776c04049077f76ccfcd30fdc986ab6b2d541d 100644 (file)
@@ -41,6 +41,9 @@ CI_MAKE_ARGS =
 # Any extra arguments to pass to configure
 CI_CONFIGURE_ARGS =
 
+# Script containing environment preparation steps
+CI_PREPARE_SCRIPT = $(CI_ROOTDIR)/prepare.sh
+
 # Script containing build instructions
 CI_BUILD_SCRIPT = $(CI_ROOTDIR)/build.sh
 
@@ -100,6 +103,7 @@ CI_HOME_MOUNTS = \
        $(NULL)
 
 CI_SCRIPT_MOUNTS = \
+       --volume $(CI_SCRATCHDIR)/prepare:$(CI_USER_HOME)/prepare:z \
        --volume $(CI_SCRATCHDIR)/build:$(CI_USER_HOME)/build:z \
        $(NULL)
 
@@ -198,8 +202,9 @@ ci-prepare-tree: ci-check-engine
                cp /etc/passwd $(CI_SCRATCHDIR); \
                cp /etc/group $(CI_SCRATCHDIR); \
                mkdir -p $(CI_SCRATCHDIR)/home; \
+               cp "$(CI_PREPARE_SCRIPT)" $(CI_SCRATCHDIR)/prepare; \
                cp "$(CI_BUILD_SCRIPT)" $(CI_SCRATCHDIR)/build; \
-               chmod +x "$(CI_SCRATCHDIR)/build"; \
+               chmod +x "$(CI_SCRATCHDIR)/prepare" "$(CI_SCRATCHDIR)/build"; \
                echo "Cloning $(CI_GIT_ROOT) to $(CI_HOST_SRCDIR)"; \
                git clone $(CI_GIT_ARGS) $(CI_GIT_ROOT) $(CI_HOST_SRCDIR) || exit 1; \
                for mod in $$(git submodule | awk '{ print $$2 }' | sed -E 's,^../,,g') ; \
@@ -213,6 +218,7 @@ ci-prepare-tree: ci-check-engine
 ci-run-command@%: ci-prepare-tree
        $(CI_ENGINE) run $(CI_ENGINE_ARGS) $(CI_IMAGE_PREFIX)$*$(CI_IMAGE_TAG) \
                /bin/bash -c ' \
+               $(CI_USER_HOME)/prepare || exit 1; \
                export CI_CONT_SRCDIR="$(CI_CONT_SRCDIR)"; \
                export CI_CONT_BUILDDIR="$(CI_CONT_BUILDDIR)"; \
                export CI_SMP="$(CI_SMP)"; \
diff --git a/ci/prepare.sh b/ci/prepare.sh
new file mode 100644 (file)
index 0000000..f70107b
--- /dev/null
@@ -0,0 +1,9 @@
+# This script is used to prepare the environment that will be used
+# to build libvirt inside the container.
+#
+# You can customize it to your liking, or alternatively use a
+# completely different script by passing
+#
+#  CI_PREPARE_SCRIPT=/path/to/your/prepare/script
+#
+# to make.