[Buildroot] [git commit] core/pkg-infra: prepare for alternate default source archives

From: Yann E. MORIN <hidden>
Date: 2021-01-10 18:42:04
Subsystem: the rest · Maintainer: Linus Torvalds

commit: https://git.buildroot.net/buildroot/commit/?id=38a9fdd02f57871835572ffebf8f47e38fc28002
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

The .tar.gz default extension is historical, and we initially used
to only fetch tarballs from remote sites.

When we introduced downloads from VCS repositories, we kept that
extension, and kept compressing with gz, by lack of good reason to
switch to some other compression scheme.

However, nowadays, we will want to change the way we construct the
tarballs we generate from VCS. This will de facto change the hashes
of those tarballs.

So we will want that the archives we generate do not clash with the
existing ones, so we need another filename. Thus, we need a way to
be able to use a different extension when we generate archives from
VCS.

Use a macro as suggested by Arnout.

Signed-off-by: "Yann E. MORIN" <redacted>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Vincent Fazio <redacted>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <redacted>
Reviewed-by: Vincent Fazio <redacted>
---
 package/pkg-generic.mk | 2 +-
 package/pkg-utils.mk   | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 621fb91424..c46c742352 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -518,7 +518,7 @@ ifndef $(2)_SOURCE
  ifdef $(3)_SOURCE
   $(2)_SOURCE = $$($(3)_SOURCE)
  else ifdef $(2)_VERSION
-  $(2)_SOURCE			?= $$($(2)_BASENAME_RAW).tar.gz
+  $(2)_SOURCE			?= $$($(2)_BASENAME_RAW)$$(call pkg_source_ext,$(2))
  endif
 endif
 
diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index a2cc160d0b..c7597a3a45 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -40,6 +40,11 @@ KCONFIG_DISABLE_OPT = $(call KCONFIG_MUNGE_DOT_CONFIG, $(1), $(SHARP_SIGN) $(1)
 pkgdir = $(dir $(lastword $(MAKEFILE_LIST)))
 pkgname = $(lastword $(subst /, ,$(pkgdir)))
 
+# Helper to build the extension for a package archive, based on various
+# conditions.
+# $(1): upper-case package name
+pkg_source_ext = .tar.gz
+
 # Define extractors for different archive suffixes
 INFLATE.bz2  = $(BZCAT)
 INFLATE.gz   = $(ZCAT)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help