diff mbox

docker: Fix git-archive for submodules

Message ID 1464943364-32199-1-git-send-email-famz@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fam Zheng June 3, 2016, 8:42 a.m. UTC
If dtc or pixman submodule is initialized, "git archive" in the subshell
gets a relative filename against $(SRC_PATH), while we have already
cd'ed into the submodule directory.

Prefix it with $(CURDIR), which is the full path to the working
directory.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 tests/docker/Makefile.include | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jason Wang June 3, 2016, 9:22 a.m. UTC | #1
On 2016年06月03日 16:42, Fam Zheng wrote:
> If dtc or pixman submodule is initialized, "git archive" in the subshell
> gets a relative filename against $(SRC_PATH), while we have already
> cd'ed into the submodule directory.
>
> Prefix it with $(CURDIR), which is the full path to the working
> directory.
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>   tests/docker/Makefile.include | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
> index 2fd2ca3..3788cd8 100644
> --- a/tests/docker/Makefile.include
> +++ b/tests/docker/Makefile.include
> @@ -29,7 +29,7 @@ make-archive-maybe = $(if $(wildcard $1/*), \
>   
>   CUR_TIME := $(shell date +%Y-%m-%d-%H.%M.%S.$$$$)
>   # Makes the definition constant after the first expansion
> -DOCKER_SRC_COPY = $(eval DOCKER_SRC_COPY := docker-src.$(CUR_TIME))$(DOCKER_SRC_COPY)
> +DOCKER_SRC_COPY = $(eval DOCKER_SRC_COPY := $(CURDIR)/docker-src.$(CUR_TIME))$(DOCKER_SRC_COPY)
>   
>   $(DOCKER_SRC_COPY):
>   	@mkdir $@

Tested-by: Jason Wang <jasowang@redhat.com>
Paolo Bonzini June 6, 2016, 1:43 p.m. UTC | #2
On 03/06/2016 10:42, Fam Zheng wrote:
> If dtc or pixman submodule is initialized, "git archive" in the subshell
> gets a relative filename against $(SRC_PATH), while we have already
> cd'ed into the submodule directory.
> 
> Prefix it with $(CURDIR), which is the full path to the working
> directory.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  tests/docker/Makefile.include | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
> index 2fd2ca3..3788cd8 100644
> --- a/tests/docker/Makefile.include
> +++ b/tests/docker/Makefile.include
> @@ -29,7 +29,7 @@ make-archive-maybe = $(if $(wildcard $1/*), \
>  
>  CUR_TIME := $(shell date +%Y-%m-%d-%H.%M.%S.$$$$)
>  # Makes the definition constant after the first expansion
> -DOCKER_SRC_COPY = $(eval DOCKER_SRC_COPY := docker-src.$(CUR_TIME))$(DOCKER_SRC_COPY)
> +DOCKER_SRC_COPY = $(eval DOCKER_SRC_COPY := $(CURDIR)/docker-src.$(CUR_TIME))$(DOCKER_SRC_COPY)
>  
>  $(DOCKER_SRC_COPY):
>  	@mkdir $@
> 

Good, another possibility is to use "> $2" instead of "-o $2" in
git-archive.  I was going to send a patch now for this possibility, you
can choose the one you prefer.

Thanks,

Paolo
diff mbox

Patch

diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index 2fd2ca3..3788cd8 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -29,7 +29,7 @@  make-archive-maybe = $(if $(wildcard $1/*), \
 
 CUR_TIME := $(shell date +%Y-%m-%d-%H.%M.%S.$$$$)
 # Makes the definition constant after the first expansion
-DOCKER_SRC_COPY = $(eval DOCKER_SRC_COPY := docker-src.$(CUR_TIME))$(DOCKER_SRC_COPY)
+DOCKER_SRC_COPY = $(eval DOCKER_SRC_COPY := $(CURDIR)/docker-src.$(CUR_TIME))$(DOCKER_SRC_COPY)
 
 $(DOCKER_SRC_COPY):
 	@mkdir $@