From: Heiko Thiery <heiko.thiery@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v4 09/12] support/scripts/pkg-stats: add support for license hash check
Date: Mon, 2 Mar 2020 15:50:11 +0100 [thread overview]
Message-ID: <20200302145013.9574-10-heiko.thiery@gmail.com> (raw)
In-Reply-To: <20200302145013.9574-1-heiko.thiery@gmail.com>
Store the names of license files and check if they are in the hash file.
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
---
support/scripts/pkg-stats | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index 432090c251..c9287b416e 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -85,7 +85,7 @@ def get_defconfig_list():
class Package:
all_licenses = dict()
- all_license_files = list()
+ all_license_files = dict()
all_versions = dict()
all_ignored_cves = dict()
@@ -98,6 +98,7 @@ class Package:
self.has_license = False
self.has_license_files = False
self.has_hash = False
+ self.license_files = None
self.patch_files = []
self.warnings = 0
self.current_version = None
@@ -159,6 +160,7 @@ class Package:
self.license = self.all_licenses[var]
self.status['license'] = ("ok", "found")
if var in self.all_license_files:
+ self.license_files = self.all_license_files[var].split(' ')
self.status['license-files'] = ("ok", "found")
def set_hash_info(self):
@@ -166,8 +168,18 @@ class Package:
Fills in the .status['hash'] field
"""
hashpath = self.path.replace(".mk", ".hash")
+ self.status['hash-license'] = ("na", "no hash file")
if os.path.exists(hashpath):
self.status['hash'] = ("ok", "found")
+ self.status['hash-license'] = ("error", "no license in hash file")
+ # check if license files are in hash file
+ if self.license_files is not None:
+ self.status['hash-license'] = ("ok", "found")
+ with open(hashpath) as f:
+ content = f.read()
+ for license in self.license_files:
+ if content.find(license) == -1:
+ self.status['hash-license'] = ("error", "license missing in hash file")
else:
self.status['hash'] = ("error", "missing")
@@ -449,7 +461,7 @@ def package_init_make_info():
if pkgvar.endswith("_MANIFEST_LICENSE_FILES"):
continue
pkgvar = pkgvar[:-14]
- Package.all_license_files.append(pkgvar)
+ Package.all_license_files[pkgvar] = value
elif pkgvar.endswith("_VERSION"):
if pkgvar.endswith("_DL_VERSION"):
--
2.20.1
next prev parent reply other threads:[~2020-03-02 14:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-02 14:50 [Buildroot] [PATCH v4 00/12] pkg-stats json output improvements Heiko Thiery
2020-03-02 14:50 ` [Buildroot] [PATCH v4 01/12] support/scripts/pkg-stats: store latest version in a dict Heiko Thiery
2020-03-02 14:50 ` [Buildroot] [PATCH v4 02/12] support/scripts/pkg-stats: store patch files for the package Heiko Thiery
2020-03-02 14:50 ` [Buildroot] [PATCH v4 03/12] support/scripts/pkg-stats: set developers info Heiko Thiery
2020-03-02 14:50 ` [Buildroot] [PATCH v4 04/12] support/scripts/pkg-stats: store licences of package Heiko Thiery
2020-03-02 14:50 ` [Buildroot] [PATCH v4 05/12] support/scripts/pkg-stats: add package status Heiko Thiery
2020-03-02 14:50 ` [Buildroot] [PATCH v4 06/12] support/scripts/pkg-stats: add package count to stats Heiko Thiery
2020-03-02 14:50 ` [Buildroot] [PATCH v4 07/12] support/scripts/pkg-stats: store pkg dir path Heiko Thiery
2020-03-02 14:50 ` [Buildroot] [PATCH v4 08/12] support/scripts/pkg-stats: add defconfig support Heiko Thiery
2020-03-02 14:50 ` Heiko Thiery [this message]
2020-03-02 14:50 ` [Buildroot] [PATCH v4 10/12] support/scripts/pkg-stats: set status to 'na' for virtual packages Heiko Thiery
2020-03-02 14:50 ` [Buildroot] [PATCH v4 11/12] support/scripts/pkg-stats: add list of status checks to the json output Heiko Thiery
2020-03-02 14:50 ` [Buildroot] [PATCH v4 12/12] support/scripts/pkg-stats: add status for cve check Heiko Thiery
2020-03-06 16:46 ` [Buildroot] [PATCH v4 00/12] pkg-stats json output improvements Titouan Christophe
2020-03-06 18:32 ` Heiko Thiery
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200302145013.9574-10-heiko.thiery@gmail.com \
--to=heiko.thiery@gmail.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox