All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] support/scripts/pkg-stats: properly handle host packages with -c option
Date: Thu,  7 Jan 2021 22:13:35 +0100	[thread overview]
Message-ID: <20210107211336.3030397-2-thomas.petazzoni@bootlin.com> (raw)
In-Reply-To: <20210107211336.3030397-1-thomas.petazzoni@bootlin.com>

In commit 7a607dab336e7f78ab069cff1b503d0688950583
("support/scripts/pkg-stats: support generating stats based on
configured packages"), we added a -c option to pkg-stats to generate a
report based on the list of packages enabled in the configuration,
rather than for all packages.

This is done based on the list of packages returned in JSON format by
"make show-info". However, this JSON output contains really the actual
name of packages, including their host- prefix for host packages. Due
to this, none of the host packages were matching and therefore
reported in the pkg-stats -c output.

This commit fixes that by stripping the host- prefix for host
packages.

Reported-by: Matt Weber <matthew.weber@rockwellcollins.com>
Cc: Matt Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 support/scripts/pkg-stats | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index 4a9ff1ffa0..eabbcc72b6 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -353,7 +353,13 @@ def get_pkglist(npackages, package_list):
 def get_config_packages():
     cmd = ["make", "--no-print-directory", "show-info"]
     js = json.loads(subprocess.check_output(cmd))
-    return js.keys()
+    pkgs = list()
+    for k, v in js.items():
+        if v["type"] == "host":
+            pkgs.append(k[5:])
+        else:
+            pkgs.append(k)
+    return pkgs
 
 
 def package_init_make_info():
-- 
2.29.2

  reply	other threads:[~2021-01-07 21:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 21:13 [Buildroot] [PATCH] linux: indicate proper CPE prefix Thomas Petazzoni
2021-01-07 21:13 ` Thomas Petazzoni [this message]
2021-01-07 21:27   ` [Buildroot] [PATCH] support/scripts/pkg-stats: properly handle host packages with -c option Matthew Weber
2021-01-07 21:32   ` Yann E. MORIN
2021-01-07 21:34     ` Thomas Petazzoni
2021-01-08 21:37       ` Yann E. MORIN
2021-01-11 21:25         ` Arnout Vandecappelle
2021-01-07 21:26 ` [Buildroot] [PATCH] linux: indicate proper CPE prefix Matthew Weber
2021-01-09 16:06 ` Yann E. MORIN

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=20210107211336.3030397-2-thomas.petazzoni@bootlin.com \
    --to=thomas.petazzoni@bootlin.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.