docker: Don't use eval trick on Makefile
PATCH 1/1 docker: Don't use eval trick on Makefile
The eval trick for defining DOCKER_SRC_COPY doesn't do anything useful, as DOCKER_SRC_COPY is immediately expanded just after it is defined, and CUR_TIME is already defined using ":=". Simply define it using ":=" so it is evaluated only once.
The eval trick was also triggering an weird error on Travis builds:
qemu/tests/docker/Makefile.include:34: *** unterminated variable reference. Stop.
The issue is not easily reproducible (maybe it's a bug in some versions of Make), but it is avoided if removing the eval trick.
--- tests/docker/Makefile.include | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tests/docker/Makefile.include +1 -2
@@ -28,8 +28,7 @@ make-archive-maybe = $(if $(wildcard $1/*), \ " ARCHIVE $(notdir $2)")) 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 := docker-src.$(CUR_TIME) $(DOCKER_SRC_COPY): @mkdir $@
Signature · 1 line
2.5.5
Fam Zheng
AppliedQuoted 33 lines · Eduardo Habkost
The eval trick for defining
DOCKER_SRC_COPYdoesn't do anything useful, asDOCKER_SRC_COPYis immediately expanded just after it is defined, andCUR_TIMEis already defined using ":=". Simply define it using ":=" so it is evaluated only once.The eval trick was also triggering an weird error on Travis builds:
qemu/tests/docker/Makefile.include:34: *** unterminated variable reference. Stop.The issue is not easily reproducible (maybe it's a bug in some versions of Make), but it is avoided if removing the eval trick.
Signed-off-by Eduardo Habkost <[email protected]>--- tests/docker/Makefile.include | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)tests/docker/Makefile.include +1
-2@@ -28,8 +28,7 @@ make-archive-maybe = $(if $(wildcard $1/*), \ " ARCHIVE $(notdir $2)")) 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 := docker-src.$(CUR_TIME) $(DOCKER_SRC_COPY): @mkdir $@Signature · 1 line
2.5.5
Applied, thanks.
Fam
Quoted 29 lines · Fam Zheng
Quoted 28 lines · Eduardo Habkost
The eval trick for defining
DOCKER_SRC_COPYdoesn't do anything useful, asDOCKER_SRC_COPYis immediately expanded just after it is defined, andCUR_TIMEis already defined using ":=". Simply define it using ":=" so it is evaluated only once.The eval trick was also triggering an weird error on Travis builds:
qemu/tests/docker/Makefile.include:34: *** unterminated variable reference. Stop.The issue is not easily reproducible (maybe it's a bug in some versions of Make), but it is avoided if removing the eval trick.
Signed-off-by Eduardo Habkost <[email protected]>--- tests/docker/Makefile.include | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)tests/docker/Makefile.include +1
-2@@ -28,8 +28,7 @@ make-archive-maybe = $(if $(wildcard $1/*), \ " ARCHIVE $(notdir $2)")) 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 := docker-src.$(CUR_TIME)
Quoted 7 lines
Quoted 5 lines
tests/docker/Makefile.include +0
-1$(DOCKER_SRC_COPY): @mkdir $@ --2.5.5
Applied, thanks.
Hi; I'd like to apply this direct to master, because one of my build test machines hits this error intermittently, and so without the fix I can't reliably process any other pull requests.
thanks
-- PMM
Quoted 10 lines · Peter Maydell
Quoted 9 lines · Fam Zheng
Quoted 8 lines · Eduardo Habkost
The eval trick for defining
DOCKER_SRC_COPYdoesn't do anything useful, asDOCKER_SRC_COPYis immediately expanded just after it is defined, andCUR_TIMEis already defined using ":=". Simply define it using ":=" so it is evaluated only once.The eval trick was also triggering an weird error on Travis builds:
qemu/tests/docker/Makefile.include:34: *** unterminated variable reference. Stop.
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
The issue is not easily reproducible (maybe it's a bug in some versions of Make), but it is avoided if removing the eval trick.
Hi; I'd like to apply this direct to master, because one of my build test machines hits this error intermittently, and so without the fix I can't reliably process any other pull requests.
Now applied, thanks.
-- PMM
Quoted 11 lines · Peter Maydell
Quoted 10 lines · Peter Maydell
Quoted 9 lines · Fam Zheng
Quoted 8 lines · Eduardo Habkost
The eval trick for defining
DOCKER_SRC_COPYdoesn't do anything useful, asDOCKER_SRC_COPYis immediately expanded just after it is defined, andCUR_TIMEis already defined using ":=". Simply define it using ":=" so it is evaluated only once.The eval trick was also triggering an weird error on Travis builds:
qemu/tests/docker/Makefile.include:34: *** unterminated variable reference. Stop.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
The issue is not easily reproducible (maybe it's a bug in some versions of Make), but it is avoided if removing the eval trick.
Hi; I'd like to apply this direct to master, because one of my build test machines hits this error intermittently, and so without the fix I can't reliably process any other pull requests.
Now applied, thanks.
No problem, sorry for the trouble!
Fam