Parcourir la source

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 <ju.o@free.fr>
Suggested-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
[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 <ju.o@free.fr>
Dario Binacchi il y a 5 mois
Parent
commit
56cc6fa2c7
1 fichiers modifiés avec 10 ajouts et 12 suppressions
  1. 10 12
      package/pkg-download.mk

+ 10 - 12
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)' \