Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2 v2] core/legal: support multi-version packages
@ 2017-07-16 17:22 Yann E. MORIN
  2017-07-16 17:22 ` [Buildroot] [PATCH 1/2 v2] core/legal-info: properly check hashes of license files for host packages Yann E. MORIN
  2017-07-16 17:22 ` [Buildroot] [PATCH 2/2 v2] core/legal-info: use hash file from version sub-dir Yann E. MORIN
  0 siblings, 2 replies; 5+ messages in thread
From: Yann E. MORIN @ 2017-07-16 17:22 UTC (permalink / raw)
  To: buildroot

Hello All!

This small series fixes our legal-info license check for packages that
have different versions and for which the licensing information has
changed between the versions, but the license files are named the same.

This is the case for Qt5 for example, where some license files for 5.6
are different than for 5.8, but are named the same.

Also fix checking the hashes of license files for host packages.

Changes v1 -> v2:
  - fallback to the main hash file is the per-version file does not
    exist,
  - fix checking hashes of host license files


Regards,
Yann E. MORIN.


The following changes since commit 9a0a0a976bc1094719556065ab5e982c6ca27563

  arch/mips: add support for MIPS32 FP mode (2017-07-16 16:45:22 +0200)


are available in the git repository at:

  git://git.buildroot.org/~ymorin/git/buildroot.git

for you to fetch changes up to 868f6cd4d02b61525edf78c8a11afd2655be3425

  core/legal-info: use hash file from version sub-dir (2017-07-16 19:20:47 +0200)


----------------------------------------------------------------
Yann E. MORIN (2):
      core/legal-info: properly check hashes of license files for host packages
      core/legal-info: use hash file from version sub-dir

 docs/manual/adding-packages-directory.txt | 4 +++-
 package/pkg-generic.mk                    | 2 +-
 package/pkg-utils.mk                      | 9 ++++++---
 3 files changed, 10 insertions(+), 5 deletions(-)

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/2 v2] core/legal-info: properly check hashes of license files for host packages
  2017-07-16 17:22 [Buildroot] [PATCH 0/2 v2] core/legal: support multi-version packages Yann E. MORIN
@ 2017-07-16 17:22 ` Yann E. MORIN
  2017-07-29 20:36   ` Thomas Petazzoni
  2017-07-16 17:22 ` [Buildroot] [PATCH 2/2 v2] core/legal-info: use hash file from version sub-dir Yann E. MORIN
  1 sibling, 1 reply; 5+ messages in thread
From: Yann E. MORIN @ 2017-07-16 17:22 UTC (permalink / raw)
  To: buildroot

When called for a host package, we currently miss the hash file, because
it is named after the target package.

Fix that by using the package raw-name.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Luca Ceresoli <luca@lucaceresoli.net>
---
 package/pkg-generic.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 2916a7bbad..e4328be4ca 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -851,7 +851,7 @@ ifneq ($$(call qstrip,$$($(2)_SOURCE)),)
 ifeq ($$(call qstrip,$$($(2)_LICENSE_FILES)),)
 	@$$(call legal-warning-pkg,$$($(2)_RAW_BASE_NAME),cannot save license ($(2)_LICENSE_FILES not defined))
 else
-	@$$(foreach F,$$($(2)_LICENSE_FILES),$$(call legal-license-file,$$($(2)_NAME),$$($(2)_RAW_BASE_NAME),$$($(2)_PKGDIR),$$(F),$$($(2)_DIR)/$$(F),$$(call UPPERCASE,$(4)))$$(sep))
+	@$$(foreach F,$$($(2)_LICENSE_FILES),$$(call legal-license-file,$$($(2)_RAWNAME),$$($(2)_RAW_BASE_NAME),$$($(2)_PKGDIR),$$(F),$$($(2)_DIR)/$$(F),$$(call UPPERCASE,$(4)))$$(sep))
 endif # license files
 
 ifeq ($$($(2)_SITE_METHOD),local)
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 2/2 v2] core/legal-info: use hash file from version sub-dir
  2017-07-16 17:22 [Buildroot] [PATCH 0/2 v2] core/legal: support multi-version packages Yann E. MORIN
  2017-07-16 17:22 ` [Buildroot] [PATCH 1/2 v2] core/legal-info: properly check hashes of license files for host packages Yann E. MORIN
@ 2017-07-16 17:22 ` Yann E. MORIN
  2017-07-17 18:06   ` Joshua Henderson
  1 sibling, 1 reply; 5+ messages in thread
From: Yann E. MORIN @ 2017-07-16 17:22 UTC (permalink / raw)
  To: buildroot

When we have multiple versions for a package, and the licensing terms
depend on the version actually selected (e.g. like Qt5), storing the
hashes for those license files in the .hash file is broken: the infra
will ensure that all hashes for a file do match, which would not be the
case here.

We fix that by first looking for a hash file in the version sub-dir
first, and if that does not exist, then we use the main hash file.

Drop the useless intermediate variable 'ret'.

Update the documentation accordingly.

Reported-by: Joshua Henderson <joshua.henderson@microchip.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Joshua Henderson <joshua.henderson@microchip.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Luca Ceresoli <luca@lucaceresoli.net>

---
Changes v1 -> v2:
  - fallback to the main hash file iof the version-specific one does
    not exist  (Thomas, Peter, Joshua, Luca)
---
 docs/manual/adding-packages-directory.txt | 4 +++-
 package/pkg-utils.mk                      | 9 ++++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/docs/manual/adding-packages-directory.txt b/docs/manual/adding-packages-directory.txt
index 804946c504..809cc97389 100644
--- a/docs/manual/adding-packages-directory.txt
+++ b/docs/manual/adding-packages-directory.txt
@@ -482,7 +482,9 @@ this in a comment line above the hashes.
 
 .Note
 The hashes for license files are used to detect a license change when a
-package version is bumped.
+package version is bumped. For a package with multiple versions (like Qt5),
+create the hash file in a subdirectory +<packageversion>+ of that package
+(see also xref:patch-apply-order[]).
 
 .Note
 The number of spaces does not matter, so one can use spaces (or tabs) to
diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index accf48c464..c3acc22b17 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -86,9 +86,12 @@ endef
 define legal-license-file # pkgname, pkgname-pkgver, pkgdir, filename, file-fullpath, {HOST|TARGET}
 	mkdir -p $(LICENSE_FILES_DIR_$(6))/$(2)/$(dir $(4)) && \
 	{ \
-		support/download/check-hash $(3)/$(1).hash $(5) $(4); \
-		ret=$${?}; \
-		case $${ret} in (0|3) ;; (*) exit 1;; esac; \
+		if [ -f $(3)/$($(PKG)_VERSION)/$(1).hash ]; then \
+			support/download/check-hash $(3)/$($(PKG)_VERSION)/$(1).hash $(5) $(4); \
+		else \
+			support/download/check-hash $(3)/$(1).hash $(5) $(4); \
+		fi; \
+		case $${?} in (0|3) ;; (*) exit 1;; esac; \
 	} && \
 	cp $(5) $(LICENSE_FILES_DIR_$(6))/$(2)/$(4)
 endef
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 2/2 v2] core/legal-info: use hash file from version sub-dir
  2017-07-16 17:22 ` [Buildroot] [PATCH 2/2 v2] core/legal-info: use hash file from version sub-dir Yann E. MORIN
@ 2017-07-17 18:06   ` Joshua Henderson
  0 siblings, 0 replies; 5+ messages in thread
From: Joshua Henderson @ 2017-07-17 18:06 UTC (permalink / raw)
  To: buildroot

Yann, All,

On 07/16/2017 10:22 AM, Yann E. MORIN wrote:
> When we have multiple versions for a package, and the licensing terms
> depend on the version actually selected (e.g. like Qt5), storing the
> hashes for those license files in the .hash file is broken: the infra
> will ensure that all hashes for a file do match, which would not be the
> case here.
> 
> We fix that by first looking for a hash file in the version sub-dir
> first, and if that does not exist, then we use the main hash file.
> 
> Drop the useless intermediate variable 'ret'.
> 
> Update the documentation accordingly.
> 
> Reported-by: Joshua Henderson <joshua.henderson@microchip.com>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Joshua Henderson <joshua.henderson@microchip.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Luca Ceresoli <luca@lucaceresoli.net>
> 
> ---
> Changes v1 -> v2:
>   - fallback to the main hash file iof the version-specific one does
>     not exist  (Thomas, Peter, Joshua, Luca)
> ---
>  docs/manual/adding-packages-directory.txt | 4 +++-
>  package/pkg-utils.mk                      | 9 ++++++---
>  2 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/docs/manual/adding-packages-directory.txt b/docs/manual/adding-packages-directory.txt
> index 804946c504..809cc97389 100644
> --- a/docs/manual/adding-packages-directory.txt
> +++ b/docs/manual/adding-packages-directory.txt
> @@ -482,7 +482,9 @@ this in a comment line above the hashes.
>  
>  .Note
>  The hashes for license files are used to detect a license change when a
> -package version is bumped.
> +package version is bumped. For a package with multiple versions (like Qt5),
> +create the hash file in a subdirectory +<packageversion>+ of that package
> +(see also xref:patch-apply-order[]).
>  
>  .Note
>  The number of spaces does not matter, so one can use spaces (or tabs) to
> diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
> index accf48c464..c3acc22b17 100644
> --- a/package/pkg-utils.mk
> +++ b/package/pkg-utils.mk
> @@ -86,9 +86,12 @@ endef
>  define legal-license-file # pkgname, pkgname-pkgver, pkgdir, filename, file-fullpath, {HOST|TARGET}
>  	mkdir -p $(LICENSE_FILES_DIR_$(6))/$(2)/$(dir $(4)) && \
>  	{ \
> -		support/download/check-hash $(3)/$(1).hash $(5) $(4); \
> -		ret=$${?}; \
> -		case $${ret} in (0|3) ;; (*) exit 1;; esac; \
> +		if [ -f $(3)/$($(PKG)_VERSION)/$(1).hash ]; then \
> +			support/download/check-hash $(3)/$($(PKG)_VERSION)/$(1).hash $(5) $(4); \
> +		else \
> +			support/download/check-hash $(3)/$(1).hash $(5) $(4); \
> +		fi; \
> +		case $${?} in (0|3) ;; (*) exit 1;; esac; \
>  	} && \
>  	cp $(5) $(LICENSE_FILES_DIR_$(6))/$(2)/$(4)
>  endef
> 

I took it for a test spin and this looks good to me.  I also uncovered a 
separate, but related question [1], with the exception case that qt5 is.

[1] https://patchwork.ozlabs.org/patch/789653/

Josh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/2 v2] core/legal-info: properly check hashes of license files for host packages
  2017-07-16 17:22 ` [Buildroot] [PATCH 1/2 v2] core/legal-info: properly check hashes of license files for host packages Yann E. MORIN
@ 2017-07-29 20:36   ` Thomas Petazzoni
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2017-07-29 20:36 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 16 Jul 2017 19:22:38 +0200, Yann E. MORIN wrote:
> When called for a host package, we currently miss the hash file, because
> it is named after the target package.
> 
> Fix that by using the package raw-name.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Luca Ceresoli <luca@lucaceresoli.net>
> ---
>  package/pkg-generic.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Both patches applied. Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-07-29 20:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-16 17:22 [Buildroot] [PATCH 0/2 v2] core/legal: support multi-version packages Yann E. MORIN
2017-07-16 17:22 ` [Buildroot] [PATCH 1/2 v2] core/legal-info: properly check hashes of license files for host packages Yann E. MORIN
2017-07-29 20:36   ` Thomas Petazzoni
2017-07-16 17:22 ` [Buildroot] [PATCH 2/2 v2] core/legal-info: use hash file from version sub-dir Yann E. MORIN
2017-07-17 18:06   ` Joshua Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox