diff mbox series

[RFC] pkg-stats: Ignore make output without '=' character

Message ID 20211123121530.3714511f@camb691.localdomain
State Superseded
Headers show
Series [RFC] pkg-stats: Ignore make output without '=' character | expand

Commit Message

Cyril Bur Nov. 23, 2021, 12:15 p.m. UTC
It is possible that some users of buildroot have put it in a repository
and call into it from another Makefile such as:
.DEFAULT:
	$(MAKE) O=$(abspath $(O)) -C buildroot $(@)

This technique works well except that Make tells us that it changes into
the buildroot directory:
make[1]: Entering directory 'buildroot'

Because this line doesn't have an equals within it, python raises a
ValueError exception within pkg-stats.

Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
---
I have no idea if this technique fits in the buildroot philosophy
or if buildroot even wants to accommodate this but it sure would be
nice for me.

 support/scripts/pkg-stats | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Arnout Vandecappelle Nov. 23, 2021, 3:31 p.m. UTC | #1
On 23/11/2021 13:15, Cyril Bur wrote:
> It is possible that some users of buildroot have put it in a repository
> and call into it from another Makefile such as:
> .DEFAULT:
> 	$(MAKE) O=$(abspath $(O)) -C buildroot $(@)
> 
> This technique works well except that Make tells us that it changes into
> the buildroot directory:
> make[1]: Entering directory 'buildroot'

  A better fix for this particular issue is for pkg-stats to call make with the 
--no-print-directory option.

  Regards,
  Arnout

> 
> Because this line doesn't have an equals within it, python raises a
> ValueError exception within pkg-stats.
> 
> Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
> ---
> I have no idea if this technique fits in the buildroot philosophy
> or if buildroot even wants to accommodate this but it sure would be
> nice for me.
> 
>   support/scripts/pkg-stats | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
> index 3992c8312a..814e6f8855 100755
> --- a/support/scripts/pkg-stats
> +++ b/support/scripts/pkg-stats
> @@ -388,7 +388,10 @@ def package_init_make_info():
>   
>       for item in variable_list:
>           # Get variable name and value
> -        pkgvar, value = item.split("=", maxsplit=1)
> +        try:
> +            pkgvar, value = item.split("=", maxsplit=1)
> +        except ValueError e:
> +            continue
>   
>           # Strip the suffix according to the variable
>           if pkgvar.endswith("_LICENSE"):
>
Cyril Bur Nov. 23, 2021, 4:49 p.m. UTC | #2
On Tue, 23 Nov 2021 16:31:44 +0100
Arnout Vandecappelle <arnout@mind.be> wrote:

> On 23/11/2021 13:15, Cyril Bur wrote:
> > It is possible that some users of buildroot have put it in a
> > repository and call into it from another Makefile such as:
> > .DEFAULT:
> > 	$(MAKE) O=$(abspath $(O)) -C buildroot $(@)
> > 
> > This technique works well except that Make tells us that it changes
> > into the buildroot directory:
> > make[1]: Entering directory 'buildroot'  
> 
>   A better fix for this particular issue is for pkg-stats to call
> make with the --no-print-directory option.
> 

Excellent point, why did I discount that idea again? Probably because I
was doing 3 things at once.

I'll send that version.

Thanks,

Cyril

>   Regards,
>   Arnout
> 
> > 
> > Because this line doesn't have an equals within it, python raises a
> > ValueError exception within pkg-stats.
> > 
> > Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
> > ---
> > I have no idea if this technique fits in the buildroot philosophy
> > or if buildroot even wants to accommodate this but it sure would be
> > nice for me.
> > 
> >   support/scripts/pkg-stats | 5 ++++-
> >   1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
> > index 3992c8312a..814e6f8855 100755
> > --- a/support/scripts/pkg-stats
> > +++ b/support/scripts/pkg-stats
> > @@ -388,7 +388,10 @@ def package_init_make_info():
> >   
> >       for item in variable_list:
> >           # Get variable name and value
> > -        pkgvar, value = item.split("=", maxsplit=1)
> > +        try:
> > +            pkgvar, value = item.split("=", maxsplit=1)
> > +        except ValueError e:
> > +            continue
> >   
> >           # Strip the suffix according to the variable
> >           if pkgvar.endswith("_LICENSE"):
> >
diff mbox series

Patch

diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index 3992c8312a..814e6f8855 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -388,7 +388,10 @@  def package_init_make_info():
 
     for item in variable_list:
         # Get variable name and value
-        pkgvar, value = item.split("=", maxsplit=1)
+        try:
+            pkgvar, value = item.split("=", maxsplit=1)
+        except ValueError e:
+            continue
 
         # Strip the suffix according to the variable
         if pkgvar.endswith("_LICENSE"):