All of lore.kernel.org
 help / color / mirror / Atom feed
From: Victor Huesca <victor.huesca@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/2] support/script/pkg-stats: run the 3 `make` calls in parallel
Date: Thu, 11 Jul 2019 15:17:39 +0200	[thread overview]
Message-ID: <dc8cdcca-d1bb-b5ff-eeca-5d1bad3306ef@bootlin.com> (raw)
In-Reply-To: <20190711150832.136f7a4e@windsurf>

Hi Thomas,



On 11/07/2019 15:08, Thomas Petazzoni wrote:
> Hello Victor,
> 
> On Thu, 11 Jul 2019 11:54:47 +0200
> Victor Huesca <victor.huesca@bootlin.com> wrote:
> 
>> +def check_multiple_output(cmds, *popenargs, **kwargs):
>> +    '''
>> +    Run each `cmd` asynchronousely and return their respective output.
>> +    The execution time is the max of all subprocess execution time.
>> +    '''
>> +    processes = [subprocess.Popen(cmd, *popenargs,
>> +                                  stdout=subprocess.PIPE,
>> +                                  stderr=subprocess.PIPE,
>> +                                  **kwargs) for cmd in cmds]
>> +    for proc in processes:
>> +        out, err = proc.communicate()
>> +        yield out
>> +
>> +
>>  def package_init_make_info():
>> +    # Fetch all variables at once
>> +    licenses, files, versions = check_multiple_output([
>> +        ["make", "BR2_HAVE_DOT_CONFIG=y", "-s", "printvars", "VARS=%_LICENSE"],
>> +        ["make", "BR2_HAVE_DOT_CONFIG=y", "-s", "printvars", "VARS=%_LICENSE_FILES"],
>> +        ["make", "BR2_HAVE_DOT_CONFIG=y", "-s", "printvars", "VARS=%_VERSION"],
> 
> Instead of doing this, what about running:
> 
> 	make printvars VARS="%_LICENSE %_LICENSE_FILES %_VERSION"
> 
> and then parse out the result, which will contain all the _LICENSE,
> _LICENSE_FILES and _VERSION variables ?

Because I did not thought it was possible to do this >_<'
I remember that I tried several syntaxes to retrieve all variables with
a single `make` but did not find a working one and this solution was not
hard to implement...

Thanks for the hint, I'll send a v2 with this -- way better -- approach.

Thanks,
Victor

> Best regards,
> 
> Thomas
> 

-- 
Victor Huesca, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

  reply	other threads:[~2019-07-11 13:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-11  9:54 [Buildroot] [PATCH 1/2] support/script/pkg-stats: run the 3 `make` calls in parallel Victor Huesca
2019-07-11  9:54 ` [Buildroot] [PATCH 2/2] support/script/pkg-stats: run 'get latest version' in a process-pool Victor Huesca
2019-07-11 13:37   ` Arnout Vandecappelle
2019-07-11 13:08 ` [Buildroot] [PATCH 1/2] support/script/pkg-stats: run the 3 `make` calls in parallel Thomas Petazzoni
2019-07-11 13:17   ` Victor Huesca [this message]
2019-07-11 13:18   ` Arnout Vandecappelle

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=dc8cdcca-d1bb-b5ff-eeca-5d1bad3306ef@bootlin.com \
    --to=victor.huesca@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.