diff mbox series

[06/11] support/scripts/pkg-stats: store licences of package

Message ID 20200103151849.10956-7-heiko.thiery@gmail.com
State Changes Requested
Headers show
Series pkg-stats json output improvements | expand

Commit Message

Heiko Thiery Jan. 3, 2020, 3:18 p.m. UTC
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
---
 support/scripts/pkg-stats | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Thomas Petazzoni Jan. 3, 2020, 3:28 p.m. UTC | #1
On Fri,  3 Jan 2020 16:18:43 +0100
Heiko Thiery <heiko.thiery@gmail.com> wrote:

> Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>

Just curious: how does this gets used in your statistics site ? I see
that you show whether the package has a license or not, but I don't see
the license details being exposed.

Thomas
Heiko Thiery Jan. 3, 2020, 4:36 p.m. UTC | #2
Am Fr., 3. Jan. 2020 um 16:28 Uhr schrieb Thomas Petazzoni
<thomas.petazzoni@bootlin.com>:
>
> On Fri,  3 Jan 2020 16:18:43 +0100
> Heiko Thiery <heiko.thiery@gmail.com> wrote:
>
> > Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
>
> Just curious: how does this gets used in your statistics site ? I see
> that you show whether the package has a license or not, but I don't see
> the license details being exposed.

The license used by a package is show on the package detail page:
http://packages.buildroot.thiery.it/packages/package/android-tools

> Thomas
> --
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
diff mbox series

Patch

diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index d520da6807..a5e87a7167 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -89,7 +89,7 @@  def parse_developers(basepath=None):
     return developers
 
 class Package:
-    all_licenses = list()
+    all_licenses = dict()
     all_license_files = list()
     all_versions = dict()
 
@@ -98,6 +98,7 @@  class Package:
         self.path = path
         self.pkg_path = os.path.dirname(path)
         self.infras = None
+        self.license = None
         self.has_license = False
         self.has_license_files = False
         self.has_hash = False
@@ -154,6 +155,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
 
@@ -302,7 +304,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"):
@@ -785,8 +787,6 @@  def __main__():
     date = datetime.datetime.utcnow()
     commit = subprocess.check_output(['git', 'rev-parse',
                                       'HEAD']).splitlines()[0]
-    print("Getting developers...")
-    developers = parse_developers()
     print("Build package list ...")
     packages = get_pkglist(args.npackages, package_list)
     print("Getting developers...")