[libvirt] [PATCH 08/10] ci: Introduce $(CI_PREPARE_SCRIPT)

Andrea Bolognani abologna at redhat.com
Fri Aug 16 09:49:52 UTC 2019


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 at redhat.com>
---
 Makefile.am   | 1 +
 ci/Makefile   | 8 +++++++-
 ci/prepare.sh | 9 +++++++++
 3 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 ci/prepare.sh

diff --git a/Makefile.am b/Makefile.am
index 96fac92186..cf9ff94f4f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -52,6 +52,7 @@ EXTRA_DIST = \
   build-aux/vc-list-files \
   ci/Makefile \
   ci/build.sh \
+  ci/prepare.sh \
   $(NULL)
 
 pkgconfigdir = $(libdir)/pkgconfig
diff --git a/ci/Makefile b/ci/Makefile
index 2b5be97238..17d85d407f 100644
--- a/ci/Makefile
+++ b/ci/Makefile
@@ -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)
 
@@ -194,8 +198,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') ; \
@@ -209,6 +214,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
index 0000000000..f70107bd62
--- /dev/null
+++ b/ci/prepare.sh
@@ -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.
-- 
2.21.0




More information about the libvir-list mailing list