All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [git commit] support/scripts/pkg-stats: properly handle host packages with -c option
@ 2021-01-31 22:01 Yann E. MORIN
  2021-02-01 10:23 ` Peter Korsgaard
  0 siblings, 1 reply; 4+ messages in thread
From: Yann E. MORIN @ 2021-01-31 22:01 UTC (permalink / raw)
  To: buildroot

commit: https://git.buildroot.net/buildroot/commit/?id=c9a1a1eb91420e8718185e8e1d076639e552472b
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

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, we use the keys of the JSON dict returned
by "make show-info", which include the host- prefix of host
packages. Due to this, none of the host packages are currently
matching and therefore they are not reported in the pkg-stats -c
output.

This commit fixes that by using the recently introduced "name"
property in the "make show-info" JSON dict.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[yann.morin.1998 at free.fr: use anonymous '_' for unused variable]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
 support/scripts/pkg-stats | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index d222ba37c3..f58afc02ae 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -358,7 +358,7 @@ 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()
+    return set([v["name"] for _, v in js.items()])
 
 
 def package_init_make_info():

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [git commit] support/scripts/pkg-stats: properly handle host packages with -c option
  2021-01-31 22:01 [Buildroot] [git commit] support/scripts/pkg-stats: properly handle host packages with -c option Yann E. MORIN
@ 2021-02-01 10:23 ` Peter Korsgaard
  2021-02-01 10:55   ` Thomas Petazzoni
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Korsgaard @ 2021-02-01 10:23 UTC (permalink / raw)
  To: buildroot

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > commit: https://git.buildroot.net/buildroot/commit/?id=c9a1a1eb91420e8718185e8e1d076639e552472b
 > branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

 > 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, we use the keys of the JSON dict returned
 > by "make show-info", which include the host- prefix of host
 > packages. Due to this, none of the host packages are currently
 > matching and therefore they are not reported in the pkg-stats -c
 > output.

 > This commit fixes that by using the recently introduced "name"
 > property in the "make show-info" JSON dict.

 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 > [yann.morin.1998 at free.fr: use anonymous '_' for unused variable]
 > Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
 > ---
 >  support/scripts/pkg-stats | 2 +-
 >  1 file changed, 1 insertion(+), 1 deletion(-)

 > diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
 > index d222ba37c3..f58afc02ae 100755
 > --- a/support/scripts/pkg-stats
 > +++ b/support/scripts/pkg-stats
 > @@ -358,7 +358,7 @@ 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()
 > +    return set([v["name"] for _, v in js.items()])

If we don't care about the key at all, why not just use js.values()?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [git commit] support/scripts/pkg-stats: properly handle host packages with -c option
  2021-02-01 10:23 ` Peter Korsgaard
@ 2021-02-01 10:55   ` Thomas Petazzoni
  2021-02-01 12:21     ` Peter Korsgaard
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2021-02-01 10:55 UTC (permalink / raw)
  To: buildroot

On Mon, 01 Feb 2021 11:23:12 +0100
Peter Korsgaard <peter@korsgaard.com> wrote:

>  > +    return set([v["name"] for _, v in js.items()])  
> 
> If we don't care about the key at all, why not just use js.values()?

'cause I didn't know about <dict>.values() :-)

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [git commit] support/scripts/pkg-stats: properly handle host packages with -c option
  2021-02-01 10:55   ` Thomas Petazzoni
@ 2021-02-01 12:21     ` Peter Korsgaard
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2021-02-01 12:21 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

 > On Mon, 01 Feb 2021 11:23:12 +0100
 > Peter Korsgaard <peter@korsgaard.com> wrote:

 >> > +    return set([v["name"] for _, v in js.items()])  
 >> 
 >> If we don't care about the key at all, why not just use js.values()?

 > 'cause I didn't know about <dict>.values() :-)

Ok, will send a patch.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-01 12:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-31 22:01 [Buildroot] [git commit] support/scripts/pkg-stats: properly handle host packages with -c option Yann E. MORIN
2021-02-01 10:23 ` Peter Korsgaard
2021-02-01 10:55   ` Thomas Petazzoni
2021-02-01 12:21     ` Peter Korsgaard

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.