[OE-core] [PATCH 6/7] go.bbclass: Enable parallel build

Matt Madison matt at madison.systems
Tue Sep 5 20:06:47 UTC 2017


On Tue, Sep 5, 2017 at 7:49 AM, Otavio Salvador
<otavio.salvador at ossystems.com.br> wrote:
> On Tue, Sep 5, 2017 at 7:50 AM, Matt Madison <matt at madison.systems> wrote:
>> On Mon, Sep 4, 2017 at 2:06 PM, Otavio Salvador <otavio at ossystems.com.br> wrote:
>>> The parallel build is based on PARALLEL_MAKE variable but can be
>>> overriden setting the GO_PARALLEL_BUILD one.
>>>
>>> This change is based on the meta-golang[1] layer. Thanks to Matt
>>> Madison <matt at madison.systems> for his work on this.
>>>
>>> 1. https://github.com/madisongh/meta-golang
>>>
>>> Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
>>> ---
>>>
>>>  meta/classes/go.bbclass | 20 ++++++++++++++++++++
>>>  1 file changed, 20 insertions(+)
>>>
>>> diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
>>> index 45f2add810..f80134bf8e 100644
>>> --- a/meta/classes/go.bbclass
>>> +++ b/meta/classes/go.bbclass
>>> @@ -1,11 +1,31 @@
>>>  inherit goarch
>>>
>>> +def get_go_parallel_make(d):
>>> +    pm = (d.getVar('PARALLEL_MAKE') or '').split()
>>> +    # look for '-j' and throw other options (e.g. '-l') away
>>> +    # because they might have a different meaning in golang
>>> +    while pm:
>>> +        opt = pm.pop(0)
>>> +        if opt == '-j':
>>> +            v = pm.pop(0)
>>> +        elif opt.startswith('-j'):
>>> +            v = opt[2:].strip()
>>> +        else:
>>> +            continue
>>> +
>>> +        return '-p %d' % int(v)
>>> +
>>> +    return ""
>>> +
>>> +GO_PARALLEL_BUILD ?= "${@get_go_parallel_make(d)}"
>>
>> This added variable should be appended to BB_HASHBASE_WHITELIST.
>
> I think should not use new variables. We base it on PARALLEL_MAKE so
> the user can control it in local.conf if needed.

I thought that GO_PARALLEL_BUILD still needs to be added to
BB_HASHBASE_WHITELIST like PARALLEL_MAKE is,
or the task signatures will be different between builds done on
systems with different CPU counts?

-Matt

>
> --
> Otavio Salvador                             O.S. Systems
> http://www.ossystems.com.br        http://code.ossystems.com.br
> Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750



More information about the Openembedded-core mailing list