From 56cc6fa2c71eff27efcb66d60f254da04439ac18 Mon Sep 17 00:00:00 2001 From: Dario Binacchi Date: Thu, 13 Feb 2025 19:09:08 +0100 Subject: [PATCH] package/pkg-download: don't export the download command variables Exporting the download variables can cause unfortunate name clashes, as occurred with the SCP variable used by Binman for compiling U-Boot [1]. Do not globally export the package download commands anymore; instead, pass them to the dl-wrapper environment. The issue can be reproduced by building the rock5b_defconfig. In that case, compilation fails with output: usage: binman [-h] [-B BUILD_DIR] [-D] [-H] [--tooldir TOOLDIR] [--toolpath TOOLPATH] [-T THREADS] [--test-section-timeout] [-v VERBOSITY] [-V] {build,bintool-docs,entry-docs,ls,extract,replace,sign,test,tool} ... binman: error: unrecognized arguments: -o ConnectTimeout=10 This build failure is due to the naming clash on the "SCP" environment variable. The "SCP" initially exported in package/pkg-download.mk refers to the SSH Secure File Copy command. While the "SCP" variable in U-Boot refers to the "System Control Processor firmware blob", which is a binary file used by u-boot to build a boot image. Even if the name clash has always been present, the build issues were occuring since commit [2]. Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/9122556697 (and many others) [1] https://lore.kernel.org/buildroot/a023971c7c8bfa4826a9a8721500c7ff@free.fr/T/ [2] https://gitlab.com/buildroot.org/buildroot/-/commit/4bce3270d68074d397b1ac9726f5c970eb517fcb Cc: Julien Olivain Suggested-by: Peter Korsgaard Signed-off-by: Dario Binacchi [Julien: - reorder variables alphabetically - add LOCALFILES variable - add info in commit log (build failure log, example to reproduce, details about the name clash) ] Signed-off-by: Julien Olivain --- package/pkg-download.mk | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/package/pkg-download.mk b/package/pkg-download.mk index ca01ff67a5..cf5959ea95 100644 --- a/package/pkg-download.mk +++ b/package/pkg-download.mk @@ -7,18 +7,6 @@ # ################################################################################ -# Download method commands -export CURL := $(call qstrip,$(BR2_CURL)) -export WGET := $(call qstrip,$(BR2_WGET)) -export SVN := $(call qstrip,$(BR2_SVN)) -export CVS := $(call qstrip,$(BR2_CVS)) -export BZR := $(call qstrip,$(BR2_BZR)) -export GIT := $(call qstrip,$(BR2_GIT)) -export HG := $(call qstrip,$(BR2_HG)) -export SCP := $(call qstrip,$(BR2_SCP)) -export SFTP := $(call qstrip,$(BR2_SFTP)) -export LOCALFILES := $(call qstrip,$(BR2_LOCALFILES)) - # Version of the format of the archives we generate in the corresponding # download backend and post-process: BR_FMT_VERSION_git = -git4 @@ -118,6 +106,16 @@ define DOWNLOAD $(Q)$(DOWNLOAD_SET_UMASK) $(EXTRA_ENV) \ $($(PKG)_DL_ENV) \ TAR="$(TAR)" \ + BZR="$(call qstrip,$(BR2_BZR))" \ + CURL="$(call qstrip,$(BR2_CURL))" \ + CVS="$(call qstrip,$(BR2_CVS))" \ + GIT="$(call qstrip,$(BR2_GIT))" \ + HG="$(call qstrip,$(BR2_HG))" \ + LOCALFILES="$(call qstrip,$(BR2_LOCALFILES))" \ + SCP="$(call qstrip,$(BR2_SCP))" \ + SFTP="$(call qstrip,$(BR2_SFTP))" \ + SVN="$(call qstrip,$(BR2_SVN))" \ + WGET="$(call qstrip,$(BR2_WGET))" \ BR_NO_CHECK_HASH_FOR="$(if $(BR2_DOWNLOAD_FORCE_CHECK_HASHES),,$(BR_NO_CHECK_HASH_FOR))" \ flock $($(PKG)_DL_DIR)/.lock $(DL_WRAPPER) \ -c '$($(PKG)_DL_VERSION)' \