[v3,04/12] support/scripts/pkg-stats: store licences of package
diff mbox series

Message ID 20200222085715.23769-5-heiko.thiery@gmail.com
State Superseded
Headers show
Series
  • pkg-stats json output improvements
Related show

Commit Message

Heiko Thiery Feb. 22, 2020, 8:57 a.m. UTC
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
---
 support/scripts/pkg-stats | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Titouan Christophe Feb. 23, 2020, 3:27 p.m. UTC | #1
Heiko and all,

On 2/22/20 9:57 AM, Heiko Thiery wrote:
> Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>

Reviewed-by: Titouan Christophe <titouan.christophe@railnova.eu>
Tested-by: Titouan Christophe <titouan.christophe@railnova.eu>

> ---
>   support/scripts/pkg-stats | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
> index 643272e9d2..ebaf04465e 100755
> --- a/support/scripts/pkg-stats
> +++ b/support/scripts/pkg-stats
> @@ -56,7 +56,7 @@ http_pool = None
>   
>   
>   class Package:
> -    all_licenses = list()
> +    all_licenses = dict()
>       all_license_files = list()
>       all_versions = dict()
>       all_ignored_cves = dict()
> @@ -65,6 +65,7 @@ class Package:
>           self.name = name
>           self.path = path
>           self.infras = None
> +        self.license = None
>           self.has_license = False
>           self.has_license_files = False
>           self.has_hash = False
> @@ -122,6 +123,7 @@ class Package >           var = self.pkgvar()
>           if var in self.all_licenses:
>               self.has_license = True
> +            self.license = self.all_licenses[var]
>           if var in self.all_license_files:
>               self.has_license_files = True
>   
> @@ -384,7 +386,7 @@ def package_init_make_info():
>               if value == "unknown":
>                   continue
>               pkgvar = pkgvar[:-8]
> -            Package.all_licenses.append(pkgvar)
> +            Package.all_licenses[pkgvar] = value
>   
>           elif pkgvar.endswith("_LICENSE_FILES"):
>               if pkgvar.endswith("_MANIFEST_LICENSE_FILES"):
> 

Best regards,

Titouan

Patch
diff mbox series

diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index 643272e9d2..ebaf04465e 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -56,7 +56,7 @@  http_pool = None
 
 
 class Package:
-    all_licenses = list()
+    all_licenses = dict()
     all_license_files = list()
     all_versions = dict()
     all_ignored_cves = dict()
@@ -65,6 +65,7 @@  class Package:
         self.name = name
         self.path = path
         self.infras = None
+        self.license = None
         self.has_license = False
         self.has_license_files = False
         self.has_hash = False
@@ -122,6 +123,7 @@  class Package:
         var = self.pkgvar()
         if var in self.all_licenses:
             self.has_license = True
+            self.license = self.all_licenses[var]
         if var in self.all_license_files:
             self.has_license_files = True
 
@@ -384,7 +386,7 @@  def package_init_make_info():
             if value == "unknown":
                 continue
             pkgvar = pkgvar[:-8]
-            Package.all_licenses.append(pkgvar)
+            Package.all_licenses[pkgvar] = value
 
         elif pkgvar.endswith("_LICENSE_FILES"):
             if pkgvar.endswith("_MANIFEST_LICENSE_FILES"):