All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Thiery <heiko.thiery@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 11/11] support/scripts/pkg-stats: create and store defconfig information
Date: Fri,  3 Jan 2020 16:18:48 +0100	[thread overview]
Message-ID: <20200103151849.10956-12-heiko.thiery@gmail.com> (raw)
In-Reply-To: <20200103151849.10956-1-heiko.thiery@gmail.com>

Collect information about developers and store with defconfig name.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
---
 support/scripts/pkg-stats | 48 +++++++++++++++++++++++++++++++++++----
 1 file changed, 44 insertions(+), 4 deletions(-)

diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index afd9cacafb..a85aefadf4 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -88,6 +88,34 @@ def parse_developers(basepath=None):
         developers.append(Developer(name, files))
     return developers
 
+class Defconfig:
+    def __init__(self, name, path):
+        self.name = name
+        self.path = path
+        self.developers = None
+
+    def set_developers(self, developers):
+        """
+        Fills in the .developers field
+        """
+        self.developers = list()
+        for dev in developers:
+            for f in dev.files:
+                if self.path == f:
+                    self.developers.append(dev.name)
+
+def get_defconfig_list():
+    """
+    Builds the list of Buildroot defconfigs, returning a list of Defconfig
+    objects.
+    """
+    defconfigs = list()
+    files = [f for f in os.listdir('configs')]
+    for name in files:
+        d = Defconfig(name[:-10], os.path.join('configs', name))
+        defconfigs.append(d)
+    return defconfigs
+
 class Package:
     all_licenses = dict()
     all_license_files = list()
@@ -791,7 +819,7 @@ def dump_html(packages, stats, date, commit, output):
         f.write(html_footer)
 
 
-def dump_json(packages, stats, date, commit, output):
+def dump_json(packages, defconfigs, stats, date, commit, output):
     # Format packages as a dictionnary instead of a list
     # Exclude local field that does not contains real date
     excluded_fields = ['url_worker']
@@ -802,6 +830,13 @@ def dump_json(packages, stats, date, commit, output):
             if k not in excluded_fields
         } for pkg in packages
     }
+
+    defconfigs = {
+        d.name: {
+            k: v
+            for k, v in d.__dict__.items()
+        } for d in defconfigs
+    }
     # Aggregate infrastructures into a single dict entry
     statistics = {
         k: v
@@ -811,6 +846,7 @@ def dump_json(packages, stats, date, commit, output):
     statistics['infra'] = {k[6:]: v for k, v in stats.items() if k.startswith('infra-')}
     # The actual structure to dump, add commit and date to it
     final = {'packages': pkgs,
+             'defconfigs': defconfigs,
              'stats': statistics,
              'commit': commit,
              'date': str(date)}
@@ -847,10 +883,14 @@ def __main__():
     date = datetime.datetime.utcnow()
     commit = subprocess.check_output(['git', 'rev-parse',
                                       'HEAD']).splitlines()[0]
-    print("Build package list ...")
-    packages = get_pkglist(args.npackages, package_list)
     print("Getting developers...")
     developers = parse_developers()
+    print("Build defconfig list ...")
+    defconfigs = get_defconfig_list()
+    for d in defconfigs:
+        d.set_developers(developers)
+    print("Build package list ...")
+    packages = get_pkglist(args.npackages, package_list)
     print("Getting package make info ...")
     package_init_make_info()
     print("Getting package details ...")
@@ -875,7 +915,7 @@ def __main__():
         dump_html(packages, stats, date, commit, args.html)
     if args.json:
         print("Write JSON")
-        dump_json(packages, stats, date, commit, args.json)
+        dump_json(packages, defconfigs, stats, date, commit, args.json)
 
 
 __main__()
-- 
2.20.1

  parent reply	other threads:[~2020-01-03 15:18 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-03 15:18 [Buildroot] [PATCH 00/11] pkg-stats json output improvements Heiko Thiery
2020-01-03 15:18 ` [Buildroot] [PATCH 01/11] support/scripts/pkg-stats: store latest version in a hash Heiko Thiery
2020-01-03 15:18 ` [Buildroot] [PATCH 02/11] support/scripts/pkg-stats: store pkg dir path Heiko Thiery
2020-01-03 15:21   ` Thomas Petazzoni
2020-01-03 18:40   ` Avraham Shukron
2020-01-03 15:18 ` [Buildroot] [PATCH 03/11] support/scripts/pkg-stats: store patch info in a hash Heiko Thiery
2020-01-03 15:23   ` Thomas Petazzoni
2020-01-03 16:23     ` Heiko Thiery
2020-01-03 16:26       ` Thomas Petazzoni
2020-01-03 16:31         ` Heiko Thiery
2020-01-03 15:18 ` [Buildroot] [PATCH 04/11] support/scripts/pkg-stats: do not exclued pkg name in json output Heiko Thiery
2020-01-03 15:24   ` Thomas Petazzoni
2020-01-03 16:29     ` Heiko Thiery
2020-01-03 15:18 ` [Buildroot] [PATCH 05/11] support/scripts/pkg-stats: parse and set developers info Heiko Thiery
2020-01-03 15:26   ` Thomas Petazzoni
2020-01-03 16:32     ` Heiko Thiery
2020-01-03 16:39       ` Thomas Petazzoni
2020-01-05 19:18         ` Arnout Vandecappelle
2020-01-05 21:49           ` Heiko Thiery
2020-01-03 15:18 ` [Buildroot] [PATCH 06/11] support/scripts/pkg-stats: store licences of package Heiko Thiery
2020-01-03 15:28   ` Thomas Petazzoni
2020-01-03 16:36     ` Heiko Thiery
2020-01-03 15:18 ` [Buildroot] [PATCH 07/11] support/scripts/pkg-stats: store dependencies " Heiko Thiery
2020-01-03 15:29   ` Thomas Petazzoni
2020-01-03 16:39     ` Heiko Thiery
2020-01-04  9:39       ` Thomas Petazzoni
2020-01-04 12:28         ` Heiko Thiery
2020-01-03 15:18 ` [Buildroot] [PATCH 08/11] support/scripts/pkg-stats: add generic package status field Heiko Thiery
2020-01-03 15:34   ` Thomas Petazzoni
2020-01-03 16:52     ` Heiko Thiery
2020-01-03 15:18 ` [Buildroot] [PATCH 09/11] support/scripts/pkg-stats; use url status from dict for check Heiko Thiery
2020-01-03 15:18 ` [Buildroot] [PATCH 10/11] support/scripts/pkg-stats: add package count to stats Heiko Thiery
2020-01-03 15:35   ` Thomas Petazzoni
2020-01-03 16:43     ` Heiko Thiery
2020-01-03 15:18 ` Heiko Thiery [this message]
2020-01-03 15:38   ` [Buildroot] [PATCH 11/11] support/scripts/pkg-stats: create and store defconfig information Thomas Petazzoni

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=20200103151849.10956-12-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 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.