All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] image_license.bbclass: Write JSON files containing license data.
@ 2019-05-22 12:44 Rob Walton
  2019-05-22 12:44 ` [PATCH 2/2] package.bbclass: Emit HOMEPAGE pkgdata Rob Walton
  2019-05-29 10:50 ` [PATCH 1/2] image_license.bbclass: Write JSON files containing license data Rob Walton
  0 siblings, 2 replies; 6+ messages in thread
From: Rob Walton @ 2019-05-22 12:44 UTC (permalink / raw)
  To: openembedded-core

For easier machine readability of license manifests, write a
manifest.json containing license data and package info.

Signed-off-by: Rob Walton <rob.walton@arm.com>
---
 meta/classes/license_image.bbclass | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/meta/classes/license_image.bbclass b/meta/classes/license_image.bbclass
index 6750038..6952417 100644
--- a/meta/classes/license_image.bbclass
+++ b/meta/classes/license_image.bbclass
@@ -36,6 +36,7 @@ python license_create_manifest() {
 }

 def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
+    import json
     import re
     import stat

@@ -43,6 +44,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
     bad_licenses = map(lambda l: canonical_license(d, l), bad_licenses)
     bad_licenses = expand_wildcard_licenses(d, bad_licenses)

+    json_data = dict()
     with open(license_manifest, "w") as license_file:
         for pkg in sorted(pkg_dic):
             if bad_licenses:
@@ -63,7 +65,14 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
                 license_file.write("PACKAGE VERSION: %s\n" % pkg_dic[pkg]["PV"])
                 license_file.write("RECIPE NAME: %s\n" % pkg_dic[pkg]["PN"])
                 license_file.write("LICENSE: %s\n\n" % pkg_dic[pkg]["LICENSE"])
-
+                json_data[pkg] = {
+                    "RECIPE NAME": pkg_dic[pkg]["PN"],
+                    "PACKAGE VERSION": pkg_dic[pkg]["PV"],
+                    "PACKAGE NAME": pkg,
+                    "LICENSE": pkg_dic[pkg]["LICENSE"],
+                    "HOMEPAGE": pkg_dic[pkg].get("HOMEPAGE", ""),
+                    "SUMMARY": pkg_dic[pkg].get("SUMMARY", ""),
+                    }
                 # If the package doesn't contain any file, that is, its size is 0, the license
                 # isn't relevant as far as the final image is concerned. So doing license check
                 # doesn't make much sense, skip it.
@@ -75,6 +84,14 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
                 license_file.write("VERSION: %s\n" % pkg_dic[pkg]["PV"])
                 license_file.write("LICENSE: %s\n" % pkg_dic[pkg]["LICENSE"])
                 license_file.write("FILES: %s\n\n" % pkg_dic[pkg]["FILES"])
+                json_data[pkg] = {
+                    "RECIPE NAME": pkg_dic[pkg]["PN"],
+                    "VERSION": pkg_dic[pkg]["PV"],
+                    "FILES": pkg_dic[pkg]["FILES"],
+                    "LICENSE": pkg_dic[pkg]["LICENSE"],
+                    "HOMEPAGE": pkg_dic[pkg].get("HOMEPAGE", ""),
+                    "SUMMARY": pkg_dic[pkg].get("SUMMARY", ""),
+                    }

             for lic in pkg_dic[pkg]["LICENSES"]:
                 lic_file = os.path.join(d.getVar('LICENSE_DIRECTORY'),
@@ -89,6 +106,10 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
                             "licenses collected for recipe %s"
                             % (lic, pkg_dic[pkg]["PN"]))

+    # Write a json file containing the license data.
+    with open("{}.json".format(license_manifest), "w") as license_file_json:
+        license_file_json.write(json.dumps(json_data))
+
     # Two options here:
     # - Just copy the manifest
     # - Copy the manifest and the license directories
--
2.7.4

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

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

* [PATCH 2/2] package.bbclass: Emit HOMEPAGE pkgdata.
  2019-05-22 12:44 [PATCH 1/2] image_license.bbclass: Write JSON files containing license data Rob Walton
@ 2019-05-22 12:44 ` Rob Walton
  2019-05-29 10:50   ` Rob Walton
  2019-05-30 13:18   ` Richard Purdie
  2019-05-29 10:50 ` [PATCH 1/2] image_license.bbclass: Write JSON files containing license data Rob Walton
  1 sibling, 2 replies; 6+ messages in thread
From: Rob Walton @ 2019-05-22 12:44 UTC (permalink / raw)
  To: openembedded-core

Emit the contents of HOMEPAGE in the extra pkgdata. This is useful
information to have when creating license manifests.

Signed-off-by: Rob Walton <rob.walton@arm.com>
---
 meta/classes/package.bbclass | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 4c0a859..a08aefe 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1458,6 +1458,7 @@ fi
         write_if_exists(sf, pkg, 'PKGR')
         write_if_exists(sf, pkg, 'LICENSE')
         write_if_exists(sf, pkg, 'DESCRIPTION')
+        write_if_exists(sf, pkg, 'HOMEPAGE')
         write_if_exists(sf, pkg, 'SUMMARY')
         write_if_exists(sf, pkg, 'RDEPENDS')
         rprov = write_if_exists(sf, pkg, 'RPROVIDES')
--
2.7.4

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

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

* Re: [PATCH 1/2] image_license.bbclass: Write JSON files containing license data.
  2019-05-22 12:44 [PATCH 1/2] image_license.bbclass: Write JSON files containing license data Rob Walton
  2019-05-22 12:44 ` [PATCH 2/2] package.bbclass: Emit HOMEPAGE pkgdata Rob Walton
@ 2019-05-29 10:50 ` Rob Walton
  1 sibling, 0 replies; 6+ messages in thread
From: Rob Walton @ 2019-05-29 10:50 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 4037 bytes --]

Requesting review. Thanks.

________________________________
From: Rob Walton
Sent: 22 May 2019 13:44:33
To: openembedded-core@lists.openembedded.org
Cc: Rob Walton
Subject: [PATCH 1/2] image_license.bbclass: Write JSON files containing license data.

For easier machine readability of license manifests, write a
manifest.json containing license data and package info.

Signed-off-by: Rob Walton <rob.walton@arm.com>
---
 meta/classes/license_image.bbclass | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/meta/classes/license_image.bbclass b/meta/classes/license_image.bbclass
index 6750038..6952417 100644
--- a/meta/classes/license_image.bbclass
+++ b/meta/classes/license_image.bbclass
@@ -36,6 +36,7 @@ python license_create_manifest() {
 }

 def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
+    import json
     import re
     import stat

@@ -43,6 +44,7 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
     bad_licenses = map(lambda l: canonical_license(d, l), bad_licenses)
     bad_licenses = expand_wildcard_licenses(d, bad_licenses)

+    json_data = dict()
     with open(license_manifest, "w") as license_file:
         for pkg in sorted(pkg_dic):
             if bad_licenses:
@@ -63,7 +65,14 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
                 license_file.write("PACKAGE VERSION: %s\n" % pkg_dic[pkg]["PV"])
                 license_file.write("RECIPE NAME: %s\n" % pkg_dic[pkg]["PN"])
                 license_file.write("LICENSE: %s\n\n" % pkg_dic[pkg]["LICENSE"])
-
+                json_data[pkg] = {
+                    "RECIPE NAME": pkg_dic[pkg]["PN"],
+                    "PACKAGE VERSION": pkg_dic[pkg]["PV"],
+                    "PACKAGE NAME": pkg,
+                    "LICENSE": pkg_dic[pkg]["LICENSE"],
+                    "HOMEPAGE": pkg_dic[pkg].get("HOMEPAGE", ""),
+                    "SUMMARY": pkg_dic[pkg].get("SUMMARY", ""),
+                    }
                 # If the package doesn't contain any file, that is, its size is 0, the license
                 # isn't relevant as far as the final image is concerned. So doing license check
                 # doesn't make much sense, skip it.
@@ -75,6 +84,14 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
                 license_file.write("VERSION: %s\n" % pkg_dic[pkg]["PV"])
                 license_file.write("LICENSE: %s\n" % pkg_dic[pkg]["LICENSE"])
                 license_file.write("FILES: %s\n\n" % pkg_dic[pkg]["FILES"])
+                json_data[pkg] = {
+                    "RECIPE NAME": pkg_dic[pkg]["PN"],
+                    "VERSION": pkg_dic[pkg]["PV"],
+                    "FILES": pkg_dic[pkg]["FILES"],
+                    "LICENSE": pkg_dic[pkg]["LICENSE"],
+                    "HOMEPAGE": pkg_dic[pkg].get("HOMEPAGE", ""),
+                    "SUMMARY": pkg_dic[pkg].get("SUMMARY", ""),
+                    }

             for lic in pkg_dic[pkg]["LICENSES"]:
                 lic_file = os.path.join(d.getVar('LICENSE_DIRECTORY'),
@@ -89,6 +106,10 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
                             "licenses collected for recipe %s"
                             % (lic, pkg_dic[pkg]["PN"]))

+    # Write a json file containing the license data.
+    with open("{}.json".format(license_manifest), "w") as license_file_json:
+        license_file_json.write(json.dumps(json_data))
+
     # Two options here:
     # - Just copy the manifest
     # - Copy the manifest and the license directories
--
2.7.4

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

[-- Attachment #2: Type: text/html, Size: 8774 bytes --]

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

* Re: [PATCH 2/2] package.bbclass: Emit HOMEPAGE pkgdata.
  2019-05-22 12:44 ` [PATCH 2/2] package.bbclass: Emit HOMEPAGE pkgdata Rob Walton
@ 2019-05-29 10:50   ` Rob Walton
  2019-05-30 13:18   ` Richard Purdie
  1 sibling, 0 replies; 6+ messages in thread
From: Rob Walton @ 2019-05-29 10:50 UTC (permalink / raw)
  To: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 1360 bytes --]

Requesting review. Thanks.

________________________________
From: Rob Walton
Sent: 22 May 2019 13:44:37
To: openembedded-core@lists.openembedded.org
Cc: Rob Walton
Subject: [PATCH 2/2] package.bbclass: Emit HOMEPAGE pkgdata.

Emit the contents of HOMEPAGE in the extra pkgdata. This is useful
information to have when creating license manifests.

Signed-off-by: Rob Walton <rob.walton@arm.com>
---
 meta/classes/package.bbclass | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 4c0a859..a08aefe 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1458,6 +1458,7 @@ fi
         write_if_exists(sf, pkg, 'PKGR')
         write_if_exists(sf, pkg, 'LICENSE')
         write_if_exists(sf, pkg, 'DESCRIPTION')
+        write_if_exists(sf, pkg, 'HOMEPAGE')
         write_if_exists(sf, pkg, 'SUMMARY')
         write_if_exists(sf, pkg, 'RDEPENDS')
         rprov = write_if_exists(sf, pkg, 'RPROVIDES')
--
2.7.4

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

[-- Attachment #2: Type: text/html, Size: 2522 bytes --]

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

* Re: [PATCH 2/2] package.bbclass: Emit HOMEPAGE pkgdata.
  2019-05-22 12:44 ` [PATCH 2/2] package.bbclass: Emit HOMEPAGE pkgdata Rob Walton
  2019-05-29 10:50   ` Rob Walton
@ 2019-05-30 13:18   ` Richard Purdie
  2019-05-30 15:32     ` Rob Walton
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Purdie @ 2019-05-30 13:18 UTC (permalink / raw)
  To: Rob Walton, openembedded-core

On Wed, 2019-05-22 at 12:44 +0000, Rob Walton wrote:
> Emit the contents of HOMEPAGE in the extra pkgdata. This is useful
> information to have when creating license manifests.
> 
> Signed-off-by: Rob Walton <rob.walton@arm.com>
> ---
>  meta/classes/package.bbclass | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/meta/classes/package.bbclass
> b/meta/classes/package.bbclass
> index 4c0a859..a08aefe 100644
> --- a/meta/classes/package.bbclass
> +++ b/meta/classes/package.bbclass
> @@ -1458,6 +1458,7 @@ fi
>          write_if_exists(sf, pkg, 'PKGR')
>          write_if_exists(sf, pkg, 'LICENSE')
>          write_if_exists(sf, pkg, 'DESCRIPTION')
> +        write_if_exists(sf, pkg, 'HOMEPAGE')
>          write_if_exists(sf, pkg, 'SUMMARY')
>          write_if_exists(sf, pkg, 'RDEPENDS')
>          rprov = write_if_exists(sf, pkg, 'RPROVIDES')

This isn't the first time this has been requested, back in 14/11/2017 a
similar patch had the reply:

"This was already proposed once and rejected as its using the interface
for something it really wasn't designed for"

You've also sent this patch once already and questions were raised
then.

I have to admit I don't like the license.bbclass code, its starting to
look like anything every legal department could ask for, meaning it
does no one thing well, just many things badly. I don't like that mess
starting to creep into the packaging code which does have a clearly
defined purpose and use.

Put another way, which variables do we draw the line at?

I worry about the path accepting this patch leads us down :(

Cheers,

Richard





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

* Re: [PATCH 2/2] package.bbclass: Emit HOMEPAGE pkgdata.
  2019-05-30 13:18   ` Richard Purdie
@ 2019-05-30 15:32     ` Rob Walton
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Walton @ 2019-05-30 15:32 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core

[-- Attachment #1: Type: text/plain, Size: 3065 bytes --]

Hi Richard,


Thanks for your comments. Sorry I missed the questions when I previously sent it. Resent due to the fact I missed the "Signed off by" in the patch last time around.


I agree with you in general about the scope creep, however the license.bbclass code is heavily coupled with this class, as it just greps the runtime dir for all the 'lic_data' it deems appropriate. All that data appears to be emitted here.


Might be nice if there was another bbclass which actually just emitted the 'data for licenses' rather than the 'lic_data' being a subset of this package data.


I'd be happy to propose that class for review. However, just looking at this function it already seems we've been "heading down a path" here for a while anyway? The content of one extra variable doesn't seem like the tipping point to me.

________________________________
From: Richard Purdie <richard.purdie@linuxfoundation.org>
Sent: 30 May 2019 14:18:36
To: Rob Walton; openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH 2/2] package.bbclass: Emit HOMEPAGE pkgdata.

On Wed, 2019-05-22 at 12:44 +0000, Rob Walton wrote:
> Emit the contents of HOMEPAGE in the extra pkgdata. This is useful
> information to have when creating license manifests.
>
> Signed-off-by: Rob Walton <rob.walton@arm.com>
> ---
>  meta/classes/package.bbclass | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/meta/classes/package.bbclass
> b/meta/classes/package.bbclass
> index 4c0a859..a08aefe 100644
> --- a/meta/classes/package.bbclass
> +++ b/meta/classes/package.bbclass
> @@ -1458,6 +1458,7 @@ fi
>          write_if_exists(sf, pkg, 'PKGR')
>          write_if_exists(sf, pkg, 'LICENSE')
>          write_if_exists(sf, pkg, 'DESCRIPTION')
> +        write_if_exists(sf, pkg, 'HOMEPAGE')
>          write_if_exists(sf, pkg, 'SUMMARY')
>          write_if_exists(sf, pkg, 'RDEPENDS')
>          rprov = write_if_exists(sf, pkg, 'RPROVIDES')

This isn't the first time this has been requested, back in 14/11/2017 a
similar patch had the reply:

"This was already proposed once and rejected as its using the interface
for something it really wasn't designed for"

You've also sent this patch once already and questions were raised
then.

I have to admit I don't like the license.bbclass code, its starting to
look like anything every legal department could ask for, meaning it
does no one thing well, just many things badly. I don't like that mess
starting to creep into the packaging code which does have a clearly
defined purpose and use.

Put another way, which variables do we draw the line at?

I worry about the path accepting this patch leads us down :(

Cheers,

Richard



IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

[-- Attachment #2: Type: text/html, Size: 4822 bytes --]

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

end of thread, other threads:[~2019-05-31  2:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22 12:44 [PATCH 1/2] image_license.bbclass: Write JSON files containing license data Rob Walton
2019-05-22 12:44 ` [PATCH 2/2] package.bbclass: Emit HOMEPAGE pkgdata Rob Walton
2019-05-29 10:50   ` Rob Walton
2019-05-30 13:18   ` Richard Purdie
2019-05-30 15:32     ` Rob Walton
2019-05-29 10:50 ` [PATCH 1/2] image_license.bbclass: Write JSON files containing license data Rob Walton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.