diff mbox series

[1/6] core: add a variable that points to the package's hash file

Message ID cfde037a6eb1c1fe64bb3c5ad9b6e490ad22be8f.1538913431.git.yann.morin.1998@free.fr
State Changes Requested
Headers show
Series [1/6] core: add a variable that points to the package's hash file | expand

Commit Message

Yann E. MORIN Oct. 7, 2018, 11:57 a.m. UTC
When a package has a version selection (e.g. Qt5), the licensing terms
may be different across versions, but lie in similarly named files (e.g.
'LICENSE').

However, when we check a file, all the hashes for it must match. So, we
can't have the hashes for two different content of the same file. We
overcame that limitation in the legal-license-file macro, which checks
whether a package has a .hash file in a versioned subdir.

For consistency, we would like to also store the source hashes in that
per-version subdir.

Rather than reconstruct the path to the hash file everywhere we need it,
add a variable that points to it.

Existing users will be converted over in followup patches.

Note: the check for a missing hash file is done in the check-hash helper
script, so this variable must always yield a filename, even of a missing
file, thus we do not use $(wildcard...) to resolve the hash file path;
we use $(wildcard...) only to check if the versioned .hash file exists.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Cc: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Baruch Siach <baruch@tkos.co.il>
---
 package/pkg-generic.mk | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Luca Ceresoli Oct. 12, 2018, 7:43 a.m. UTC | #1
Hi,

On 07/10/2018 13:57, Yann E. MORIN wrote:
> When a package has a version selection (e.g. Qt5), the licensing terms
> may be different across versions, but lie in similarly named files (e.g.
> 'LICENSE').
> 
> However, when we check a file, all the hashes for it must match. So, we
> can't have the hashes for two different content of the same file. We
> overcame that limitation in the legal-license-file macro, which checks
> whether a package has a .hash file in a versioned subdir.
> 
> For consistency, we would like to also store the source hashes in that
> per-version subdir.
> 
> Rather than reconstruct the path to the hash file everywhere we need it,
> add a variable that points to it.
> 
> Existing users will be converted over in followup patches.
> 
> Note: the check for a missing hash file is done in the check-hash helper
> script, so this variable must always yield a filename, even of a missing
> file, thus we do not use $(wildcard...) to resolve the hash file path;
> we use $(wildcard...) only to check if the versioned .hash file exists.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Cc: Arnout Vandecappelle <arnout@mind.be>
> Cc: Luca Ceresoli <luca@lucaceresoli.net>
> Cc: Baruch Siach <baruch@tkos.co.il>

Reviewed-by: Luca Ceresoli <luca@lucaceresoli.net>
diff mbox series

Patch

diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 91b61c6de0..b3d9ffe932 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -434,6 +434,12 @@  else
 endif
 $(2)_VERSION := $$(call sanitize,$$($(2)_DL_VERSION))
 
+$(2)_HASH_FILE = \
+	$$(strip \
+		$$(if $$(wildcard $$($(2)_PKGDIR)/$$($(2)_VERSION)/$$($(2)_RAWNAME).hash),\
+			$$($(2)_PKGDIR)/$$($(2)_VERSION)/$$($(2)_RAWNAME).hash,\
+			$$($(2)_PKGDIR)/$$($(2)_RAWNAME).hash))
+
 ifdef $(3)_OVERRIDE_SRCDIR
   $(2)_OVERRIDE_SRCDIR ?= $$($(3)_OVERRIDE_SRCDIR)
 endif