[Buildroot] [PATCH 2/7] pkg-infra: assign BR_NO_CHECK_HASH_FOR so it is recursively-expanded

Yann E. MORIN yann.morin.1998 at free.fr
Tue Apr 28 22:39:59 UTC 2015


Currently, assigning to BR_NO_CHECK_HASH_FOR in conditionals, but
referencing vairaible assigned to later, fails. Here's a failing
test-case, which is the reduced test-case of how we handle
BR_NO_CHECK_HASH_FOR for now:

    export FOO

    ifeq ($(BAR_V),)
    BAR_V=1
    else
    FOO += $(BAR_S)
    endif

    BAR_S = bar-$(BAR_V).tar

    all:
        @echo "BAR_S=\"$(BAR_S)\""
        @$(SHELL) -c 'echo "FOO=\"$${FOO}\""'

Run it with:

    $ make
    BAR_S="bar-1.tar"
    FOO=""
    $ make BAR_V=2
    BAR_S="bar-2.tar"
    FOO=" "

Now, change the firstline to read:

    export FOO =

And we now get:

    $ make
    BAR_S="bar-1.tar"
    FOO=""
    $ make BAR_V=2
    BAR_S="bar-2.tar"
    FOO=" bar-2.tar"

This new behaviour will be needed later for Xenomai, which handles the
version string in an unusual way.

(Note how there's a leading space in both cases? In Buildroot, we do not
care that extra space, it is simply ignored).

Signed-off-by: "Yann E. MORIN" <yann.morin.1998 at free.fr>
Cc: Arnout Vandecappelle <arnout at mind.be>
Cc: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
---
 package/pkg-download.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/package/pkg-download.mk b/package/pkg-download.mk
index a38062e..f0651db 100644
--- a/package/pkg-download.mk
+++ b/package/pkg-download.mk
@@ -56,7 +56,9 @@ domainseparator = $(if $(1),$(1),/)
 github = https://github.com/$(1)/$(2)/archive/$(3)
 
 # Expressly do not check hashes for those files
-export BR_NO_CHECK_HASH_FOR
+# It needs to be assigned so as to be a recursively-expanded variable, and
+# so that it can be assigned inside conditionals.
+export BR_NO_CHECK_HASH_FOR =
 
 ################################################################################
 # The DOWNLOAD_* helpers are in charge of getting a working copy
-- 
1.9.1




More information about the buildroot mailing list