core/download: fix extra downloads for scm-based main downloads
cover core/download: fix extra downloads for scm-based main downloads
Hello All!
As reported by Luca [0], when the main download for a package is from an SCM (gt, hg...), then extra downloads are also attempted using the same site method.
This is due to the big rework of the download infra, when we introduced the git cache feature.
It is to be noted that, before that big rewrite, the error was a silent failure (and would have thus failed later), while we now detect that failure at download time (rather than at extract or later).
Regards,
Yann E. MORIN.
The following changes since commit babc94e9dd4a1a04c4a0befdb6d32236a30b8ea8
mbedtls: security bump to version 2.7.2 (2018-04-25 15:29:57 +0200)
are available in the git repository at:
git://git.buildroot.org/~ymorin/git/buildroot.git
for you to fetch changes up to 58a86c2e2f56abb66012e88c26f5e8c1d6737a2d
core/pkg-infra: don't enforce site-method for extra downloads (2018-04-25 21:28:49 +0200)
----------------------------------------------------------------
Yann E. MORIN (2):
core/pkg-infra: set no-check-hash only for main download core/pkg-infra: don't enforce site-method for extra downloads
package/pkg-download.mk | 4 +--- package/pkg-generic.mk | 7 ++++++- 2 files changed, 7 insertions(+), 4 deletions(-)
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. | '------------------------------^-------^------------------^--------------------'
PATCH 1/2 core/pkg-infra: set no-check-hash only for main download
Currently, when the main download if from an SCM, we exclude all downloads from being hash-checked, on the assumption that we don't have hashes for downloads from an SCM.
However, the exclusion s computed on the DOWNLOAD macro, which is called for each download of a package, thus effectively disabling hash checks for extra downloads, even though those are only ever download with wget.
What we really wanted to do, in fact, was to exclude just the main download.
We fix that by appending the main source file to the global list of excluded files, from within the generic-package infra itself.
--- package/pkg-download.mk | 2 -- package/pkg-generic.mk | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-)
package/pkg-download.mk +0 -2
@@ -92,8 +92,6 @@ endif define DOWNLOAD $(Q)mkdir -p $($(PKG)_DL_DIR) - $(Q)$(if $(filter bzr cvs hg svn,$($(PKG)_SITE_METHOD)), - BR_NO_CHECK_HASH_FOR=$(notdir $(call qstrip,$(1)))) \ $(EXTRA_ENV) $(FLOCK) $(DL_WRAPPER) \ -c '$($(PKG)_DL_VERSION)' \ -d '$($(PKG)_DL_DIR)' \
package/pkg-generic.mk +4 -0
@@ -481,6 +481,10 @@ ifndef $(2)_PATCH endif endif +ifneq ($$(filter bzr cvs hg svn,$$($(2)_SITE)),) +BR_NO_CHECK_HASH_FOR += $$($(2)_SOURCE) +endif + $(2)_ALL_DOWNLOADS = \ $$(foreach p,$$($(2)_SOURCE) $$($(2)_PATCH) $$($(2)_EXTRA_DOWNLOADS),\ $$(if $$(findstring ://,$$(p)),$$(p),\
Signature · 1 line
2.14.1
PATCH 1/2 core/pkg-infra: set no-check-hash only for main download
Hi Yann,
Quoted 12 lines · Yann E. MORIN
Currently, when the main download if from an SCM, we exclude all downloads from being hash-checked, on the assumption that we don't have hashes for downloads from an SCM.
However, the exclusion s computed on the DOWNLOAD macro, which is called for each download of a package, thus effectively disabling hash checks for extra downloads, even though those are only ever download with wget.
What we really wanted to do, in fact, was to exclude just the main download.
Quoted 8 lines
We fix that by appending the main source file to the global list of excluded files, from within the generic-package infra itself.
Reported-by Luca Ceresoli <[email protected]>Signed-off-by "Yann E. MORIN" <[email protected]>Cc Luca Ceresoli <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Maxime Hadjinlian <[email protected]>
Signature · 1 line
Luca
Thomas Petazzoni
AppliedPATCH 1/2 core/pkg-infra: set no-check-hash only for main download
In reply to Yann E. MORINHello,
Quoted 20 lines · Yann E. MORIN
Currently, when the main download if from an SCM, we exclude all downloads from being hash-checked, on the assumption that we don't have hashes for downloads from an SCM.
However, the exclusion s computed on the DOWNLOAD macro, which is called for each download of a package, thus effectively disabling hash checks for extra downloads, even though those are only ever download with wget.
What we really wanted to do, in fact, was to exclude just the main download.
We fix that by appending the main source file to the global list of excluded files, from within the generic-package infra itself.
Reported-by Luca Ceresoli <[email protected]>Signed-off-by "Yann E. MORIN" <[email protected]>Cc Luca Ceresoli <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Maxime Hadjinlian <[email protected]>
Quoted 4 lines
--- package/pkg-download.mk | 2 -- package/pkg-generic.mk | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-)
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 2/2 core/pkg-infra: don't enforce site-method for extra downloads
In reply to Yann E. MORINThe site method only ever applies to the main download, while extra downloads are always to be fetches with wget.
However, the site method is prepended to the URL from within the DOWNLOAD macro (well, a variable evaluated in the DOWNLOAD macro), which is called for each download of a package, thus effectively prepending the site method to all downloads, even the extra ones (and the patches).
We fix that by prepending the site method from within the generic-package infra, so that it only applies to the main download.
For that, we move the main _SOURCE out of the foreach loop, so that we can prepend the site-method to it, without impacting the other downloads.
--- package/pkg-download.mk | 2 +- package/pkg-generic.mk | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
package/pkg-download.mk +1 -1
@@ -82,7 +82,7 @@ endif ifeq ($(BR2_PRIMARY_SITE_ONLY),) DOWNLOAD_URIS += \ - -u $($(PKG)_SITE_METHOD)+$(patsubst %/,%,$(dir $(call qstrip,$(1)))) + -u $(patsubst %/,%,$(dir $(call qstrip,$(1)))) ifneq ($(call qstrip,$(BR2_BACKUP_SITE)),) DOWNLOAD_URIS += \ -u $(call getschemeplusuri,$(call qstrip,$(BR2_BACKUP_SITE)/$($(PKG)_DL_SUBDIR)),urlencode) \
package/pkg-generic.mk +2 -1
@@ -486,7 +486,8 @@ BR_NO_CHECK_HASH_FOR += $$($(2)_SOURCE) endif $(2)_ALL_DOWNLOADS = \ - $$(foreach p,$$($(2)_SOURCE) $$($(2)_PATCH) $$($(2)_EXTRA_DOWNLOADS),\ + $$($(2)_SITE_METHOD)+$$($(2)_SITE)/$$($(2)_SOURCE) \ + $$(foreach p,$$($(2)_PATCH) $$($(2)_EXTRA_DOWNLOADS),\ $$(if $$(findstring ://,$$(p)),$$(p),\ $$($(2)_SITE)/$$(p)))
Signature · 1 line
2.14.1
PATCH 2/2 core/pkg-infra: don't enforce site-method for extra downloads
Hi Yann,
Quoted 16 lines · Yann E. MORIN
The site method only ever applies to the main download, while extra downloads are always to be fetches with wget.
However, the site method is prepended to the URL from within the DOWNLOAD macro (well, a variable evaluated in the DOWNLOAD macro), which is called for each download of a package, thus effectively prepending the site method to all downloads, even the extra ones (and the patches).
We fix that by prepending the site method from within the generic-package infra, so that it only applies to the main download.
For that, we move the main
_SOURCEout of the foreach loop, so that we can prepend the site-method to it, without impacting the other downloads.
Quoted 5 lines
Reported-by Luca Ceresoli <[email protected]>Signed-off-by "Yann E. MORIN" <[email protected]>Cc Luca Ceresoli <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Maxime Hadjinlian <[email protected]>
Thanks for such a prompt fix!
Signature · 1 line
Luca
Thomas Petazzoni
AppliedPATCH 2/2 core/pkg-infra: don't enforce site-method for extra downloads
In reply to Yann E. MORINHello,
Quoted 21 lines · Yann E. MORIN
The site method only ever applies to the main download, while extra downloads are always to be fetches with wget.
However, the site method is prepended to the URL from within the DOWNLOAD macro (well, a variable evaluated in the DOWNLOAD macro), which is called for each download of a package, thus effectively prepending the site method to all downloads, even the extra ones (and the patches).
We fix that by prepending the site method from within the generic-package infra, so that it only applies to the main download.
For that, we move the main
_SOURCEout of the foreach loop, so that we can prepend the site-method to it, without impacting the other downloads.Reported-by Luca Ceresoli <[email protected]>Signed-off-by "Yann E. MORIN" <[email protected]>Cc Luca Ceresoli <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Maxime Hadjinlian <[email protected]>
Quoted 4 lines
--- package/pkg-download.mk | 2 +- package/pkg-generic.mk | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com