Skip to contentSkip to conversation

Makefile.legacy: fix recursive invocation with BUILDROOT_DL_DIR and _CONFIG

PATCH New Arnout Vandecappelle (Essensium/Mind) 3 participants 5 messages Feb 10, 2014 – Feb 11, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile.legacy: fix recursive invocation with BUILDROOT_DL_DIR and _CONFIG

The legacy support for the old BUILDROOT_DL_DIR and BUILDROOT_CONFIG breaks down when make is invoked recursively - which is done in a few cases, e.g. silentoldconfig, external-defs, ... These targets always give a legacy error.

For BUILDROOT_DL_DIR, this is fixed by making sure that the original value of BR2_DL_DIR taken from the environment is also exported again.

For BUILDROOT_CONFIG, this is fixed with an additional comparison of the environment variable's value with the fake value that we introduce ourselves.

---
 Makefile.legacy         | 10 +++++++---
 package/pkg-download.mk |  5 +++++
 2 files changed, 12 insertions(+), 3 deletions(-)
Makefile.legacy +7 -3
index ea18bc6..764cfcd 100644
@@ -28,16 +28,20 @@ $(error "The BUILDROOT_DL_DIR environment variable was renamed to BR2_DL_DIR.")
 endif
 endif
 
+# If a script is using the deprecated BUILDROOT_CONFIG, make sure it fails.
+# Add some directories in front just in case someone used dirname on it.
+BUILDROOT_CONFIG_FAKE = /tmp/deprecated/The-BUILDROOT_CONFIG-environment-variable-was-renamed-to-BR2_CONFIG
+
 # Similar to above for BUILDROOT_CONFIG, but here we have no .config equivalent.
 ifneq ($(BUILDROOT_CONFIG),)
 ifneq ($(BUILDROOT_CONFIG),$(BR2_CONFIG))
+ifneq ($(BUILDROOT_CONFIG),$(BUILDROOT_CONFIG_FAKE))
 $(error "The BUILDROOT_CONFIG environment variable was renamed to BR2_CONFIG.")
 endif
 endif
+endif
 
-# If a script is using the deprecated BUILDROOT_CONFIG, make sure it fails.
-# Add some directories in front just in case someone used dirname on it.
-BUILDROOT_CONFIG = /tmp/deprecated/The-BUILDROOT_CONFIG-environment-variable-was-renamed-to-BR2_CONFIG
+BUILDROOT_CONFIG = $(BUILDROOT_CONFIG_FAKE)
 export BUILDROOT_CONFIG
 
 #
package/pkg-download.mk +5 -0
index 84598d5..6d4cbcd 100644
@@ -24,10 +24,15 @@ LOCALFILES := $(call qstrip,$(BR2_LOCALFILES))
 DL_MODE=DOWNLOAD
 
 # DL_DIR may have been set already from the environment
+ifeq ($(origin DL_DIR),undefined)
 DL_DIR ?= $(call qstrip,$(BR2_DL_DIR))
 ifeq ($(DL_DIR),)
 DL_DIR := $(TOPDIR)/dl
 endif
+else
+# Restore the BR2_DL_DIR that was overridden by the .config file
+BR2_DL_DIR = $(DL_DIR)
+endif
 
 # ensure it exists and a absolute path
 DL_DIR := $(shell mkdir -p $(DL_DIR) && cd $(DL_DIR) >/dev/null && pwd)
Signature · 1 line
1.9.rc1
#1 lore raw

PATCH 1/1 Makefile.legacy: fix recursive invocation with BUILDROOT_DL_DIR and _CONFIG

Arnout, All,

On 2014-02-10 22:48 +0100, Arnout Vandecappelle (Essensium/Mind) spake thusly:

Quoted 5 lines

The legacy support for the old BUILDROOT_DL_DIR and BUILDROOT_CONFIG breaks down when make is invoked recursively - which is done in a few cases, e.g. silentoldconfig, external-defs, ... These targets always give a legacy error.

Quoted 8 lines

For BUILDROOT_DL_DIR, this is fixed by making sure that the original value of BR2_DL_DIR taken from the environment is also exported again.

For BUILDROOT_CONFIG, this is fixed with an additional comparison of the environment variable's value with the fake value that we introduce ourselves.

Fixes (at least):
make graph-depends
make PKG-graph-depends

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 Makefile.legacy: fix recursive invocation with BUILDROOT_DL_DIR and _CONFIG

In reply to Arnout Vandecappelle (Essensium/Mind)

Arnout, All,

On 2014-02-10 22:48 +0100, Arnout Vandecappelle (Essensium/Mind) spake thusly:

Quoted 5 lines

The legacy support for the old BUILDROOT_DL_DIR and BUILDROOT_CONFIG breaks down when make is invoked recursively - which is done in a few cases, e.g. silentoldconfig, external-defs, ... These targets always give a legacy error.

Quoted 8 lines

For BUILDROOT_DL_DIR, this is fixed by making sure that the original value of BR2_DL_DIR taken from the environment is also exported again.

For BUILDROOT_CONFIG, this is fixed with an additional comparison of the environment variable's value with the fake value that we introduce ourselves.

I gave my Tested-by earlier (and I am *not* withdrawing it) since I think this is a valid stop-gap fix which should go before -rc1 is cut.

However, I wonder how appropriate this implementation is. I am not really convinced by this hack (although I can't see a better alternative).

Another solution (which I do not like much, either) would be to enclose these checks in:

ifeq ($(ALREADY_IN_BUILDROOT),)
blabla legacy stuff blabla
endif

and at the end of the main Makefile, add:

export ALREADY_IN_BUILDROOT=y

But, this is hacky too, and I'm not fond of it either.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 1/1 Makefile.legacy: fix recursive invocation with BUILDROOT_DL_DIR and _CONFIG

Quoted 30 lines · Yann E. MORIN

Arnout, All,

On 2014-02-10 22:48 +0100, Arnout Vandecappelle (Essensium/Mind) spake thusly:

Quoted 5 lines

The legacy support for the old BUILDROOT_DL_DIR and BUILDROOT_CONFIG breaks down when make is invoked recursively - which is done in a few cases, e.g. silentoldconfig, external-defs, ... These targets always give a legacy error.

Quoted 8 lines

For BUILDROOT_DL_DIR, this is fixed by making sure that the original value of BR2_DL_DIR taken from the environment is also exported again.

For BUILDROOT_CONFIG, this is fixed with an additional comparison of the environment variable's value with the fake value that we introduce ourselves.

I gave my Tested-by earlier (and I am *not* withdrawing it) since I think this is a valid stop-gap fix which should go before -rc1 is cut.

However, I wonder how appropriate this implementation is. I am not really convinced by this hack (although I can't see a better alternative).

Another solution (which I do not like much, either) would be to enclose these checks in:

ifeq ($(ALREADY_IN_BUILDROOT),)
blabla legacy stuff blabla
endif

Quoted 5 lines

and at the end of the main Makefile, add:

export ALREADY_IN_BUILDROOT=y

But, this is hacky too, and I'm not fond of it either.

Yeah, it's not really an improvement.

We could also just throw away those legacy checks.

Regards,
Arnout

Quoted 4 lines

Regards,
Yann E. MORIN.

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#4 lore raw

PATCH 1/1 Makefile.legacy: fix recursive invocation with BUILDROOT_DL_DIR and _CONFIG

In reply to Arnout Vandecappelle (Essensium/Mind)
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle (Essensium/Mind) <[email protected]> writes:

The legacy support for the old BUILDROOT_DL_DIR and BUILDROOT_CONFIG breaks down when make is invoked recursively - which is done in a few cases, e.g. silentoldconfig, external-defs, ... These targets always give a legacy error.

Quoted 8 lines

For BUILDROOT_DL_DIR, this is fixed by making sure that the original value of BR2_DL_DIR taken from the environment is also exported again.

For BUILDROOT_CONFIG, this is fixed with an additional comparison of the environment variable's value with the fake value that we introduce ourselves.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard