Skip to contentSkip to conversation

docker: allow running from srcdir != builddir build

PATCH Applied Paolo Bonzini 3 participants 3 messages Oct 18, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docker: allow running from srcdir != builddir build

The new script uses "git submodule", which is picky about being invoked from the top of the git checkout. Invoke the script from $(SRC_PATH) to avoid git's wrath.

Fixes b7f404201e45e99da23b9764dec27ce5f965cdcd
Cc Fam Zheng <[email protected]>
---
 tests/docker/Makefile.include | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/docker/Makefile.include +2 -2
index 6f9ea19..b6d9fa3 100644
@@ -18,11 +18,11 @@ TESTS ?= %
 IMAGES ?= %
 
 CUR_TIME := $(shell date +%Y-%m-%d-%H.%M.%S.$$$$)
-DOCKER_SRC_COPY := docker-src.$(CUR_TIME)
+DOCKER_SRC_COPY := $(BUILD_DIR)/docker-src.$(CUR_TIME)
 
 $(DOCKER_SRC_COPY):
 	@mkdir $@
-	$(call quiet-command, $(SRC_PATH)/scripts/archive-source.sh $@/qemu.tar, \
+	$(call quiet-command, cd $(SRC_PATH) && scripts/archive-source.sh $@/qemu.tar, \
 		"GEN", "$@/qemu.tar")
 	$(call quiet-command, cp $(SRC_PATH)/tests/docker/run $@/run, \
 		"COPY","RUNNER")
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Paolo Bonzini

The new script uses "git submodule", which is picky about being invoked from the top of the git checkout. Invoke the script from $(SRC_PATH) to avoid git's wrath.

I wonder if there's interest in being "evil" and flat out refusing to ever build with srcdir==builddir. We have a never ending stream of bugs where we forget to consider one of the two possible scenarios.

Quoted 17 lines
Fixes b7f404201e45e99da23b9764dec27ce5f965cdcd
Cc Fam Zheng <[email protected]>
---
 tests/docker/Makefile.include | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/docker/Makefile.include +0 -0
index 6f9ea19..b6d9fa3 100644
@@ -18,11 +18,11 @@ TESTS ?= %
 IMAGES ?= %
 
 CUR_TIME := $(shell date +%Y-%m-%d-%H.%M.%S.$$$$)

tests/docker/Makefile.include TESTS ?= % · line 28

Quoted 10 lines
tests/docker/Makefile.include +2 -2
-DOCKER_SRC_COPY := docker-src.$(CUR_TIME)
+DOCKER_SRC_COPY := $(BUILD_DIR)/docker-src.$(CUR_TIME)
 
 $(DOCKER_SRC_COPY):
 	@mkdir $@
-	$(call quiet-command, $(SRC_PATH)/scripts/archive-source.sh $@/qemu.tar, \
+	$(call quiet-command, cd $(SRC_PATH) && scripts/archive-source.sh $@/qemu.tar, \
 		"GEN", "$@/qemu.tar")
 	$(call quiet-command, cp $(SRC_PATH)/tests/docker/run $@/run, \
 		"COPY","RUNNER")

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|