* [hardknott][PATCH] license: add package URLs to license.manifest
@ 2022-12-12 13:11 dirk.richter
0 siblings, 0 replies; only message in thread
From: dirk.richter @ 2022-12-12 13:11 UTC (permalink / raw)
To: poky
[-- Attachment #1: Type: text/plain, Size: 3349 bytes --]
Manufacturers of embedded systems are obliged to publish information
to the used open-source software components. Additionally the URLs for
accessing these software components are a useful or even necessary
information. Therefore these URLs are added to the package information
listed in the license.manifest file.
Signed-off-by: Dirk Richter <dirk.richter@softing.com>
---
meta/classes/license.bbclass | 2 ++
meta/classes/license_image.bbclass | 23 ++++++++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/meta/classes/license.bbclass b/meta/classes/license.bbclass
index 0d0faa28d7..83bf1da41f 100644
--- a/meta/classes/license.bbclass
+++ b/meta/classes/license.bbclass
@@ -50,6 +50,8 @@ def get_recipe_info(d):
info["PV"] = d.getVar("PV")
info["PR"] = d.getVar("PR")
info["LICENSE"] = d.getVar("LICENSE")
+ info["SRC_URI"] = d.getVar("SRC_URI")
+ info["LIC_FILES_CHKSUM"] = d.getVar("LIC_FILES_CHKSUM")
return info
def add_package_and_files(d):
diff --git a/meta/classes/license_image.bbclass b/meta/classes/license_image.bbclass
index 73cebb4d55..16a39fce3d 100644
--- a/meta/classes/license_image.bbclass
+++ b/meta/classes/license_image.bbclass
@@ -72,7 +72,28 @@ def write_license_files(d, license_manifest, pkg_dic, rootfs=True):
license_file.write("PACKAGE NAME: %s\n" % pkg)
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"])
+ license_file.write("LICENSE: %s\n" % pkg_dic[pkg]["LICENSE"])
+
+ # Add SRC_URIs to license.manifest from recipeinfo files
+ pkg_dic[pkg]["SRC_URI"] = ""
+ licdir = os.path.join(d.getVar('LICENSE_DIRECTORY'), pkg_dic[pkg]["PN"])
+ if os.path.exists(licdir):
+ with open(os.path.join(licdir, "recipeinfo"), "r") as f:
+ for line in f.readlines():
+ key,val = line.split(": ", 1)
+ if key == "SRC_URI":
+ uri = val.split()
+ if len(uri) > 0:
+ if "file://" not in uri[0]:
+ pkg_dic[pkg]["SRC_URI"] = uri[0]
+ else:
+ bb.warn("No source URL available for %s" % (pkg_dic[pkg]["PN"]))
+ else:
+ bb.warn("No source URL available for %s" % (pkg_dic[pkg]["PN"]))
+ else:
+ bb.note("No license information available for %s" % (pkg_dic[pkg]["PN"]))
+
+ license_file.write("SRC_URI: %s\n\n" % pkg_dic[pkg]["SRC_URI"])
# 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
--
2.17.1
[-- Attachment #2: Type: text/html, Size: 5592 bytes --]
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-12-12 13:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12 13:11 [hardknott][PATCH] license: add package URLs to license.manifest dirk.richter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).