<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>10680</bug_id>
          
          <creation_ts>2016-11-16 13:04:15 +0000</creation_ts>
          <short_desc>multiconfig globbing support</short_desc>
          <delta_ts>2017-03-19 20:22:25 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>BitBake</product>
          <component>bitbake</component>
          <version>2.3</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>2.2.2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Richard Purdie">richard.purdie</reporter>
          <assigned_to name="Juro Bystricky">juro.bystricky</assigned_to>
          <cc>henry.bruce</cc>
    
    <cc>jose.perez.carranza</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>randy.macleod</cc>
          
          <qa_contact name="Jair Gonzalez">jair.de.jesus.gonzalez.plascencia</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>68359</commentid>
    <comment_count>0</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2016-11-16 13:04:15 +0000</bug_when>
    <thetext>Currently you can&apos;t build a target for all the configured multiconfigs without specifying a list. This enhancement is to support globbing so that you can do this, e.g. instead of:

bitbake multiconfig:A:bash multiconfig:B:bash bash

bitbake multiconfig:*:bash</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69254</commentid>
    <comment_count>1</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2016-12-21 01:23:12 +0000</bug_when>
    <thetext>Currently testing this patch:
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 30131fb..a6841e7 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -666,7 +666,23 @@ class BBCooker:
         if not task.startswith(&quot;do_&quot;):
             task = &quot;do_%s&quot; % task

-        fulltargetlist = self.checkPackages(pkgs_to_build, task)
+        targetlist = self.checkPackages(pkgs_to_build, task)
+        fulltargetlist = []
+
+        # Wild card expansion:
+        # Replace string such as &quot;multiconfig:*:bash&quot;
+        # into &quot;multiconfig:A:bash multiconfig:B:bash bash&quot;
+        for k in targetlist:
+            if k.startswith(&quot;multiconfig:&quot;) and k.split(&quot;:&quot;)[1] == &quot;*&quot;:
+                for mc in self.multiconfigs:
+                    if mc:
+                        fulltargetlist.append(k.replace(&apos;*&apos;, mc))
+                    # default task
+                    else:
+                        fulltargetlist.append(k.split(&quot;:&quot;)[2])
+            else:
+                fulltargetlist.append(k)
+
         taskdata = {}
         localdata = {}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69317</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2016-12-22 14:47:48 +0000</bug_when>
    <thetext>Patch looks good to me, please send to the bitbake list and we can get this closed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69319</commentid>
    <comment_count>3</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2016-12-22 16:02:02 +0000</bug_when>
    <thetext>Before I send this to the mailing list, I have one suggestion:

We do this:

BB_MULTICONFIG = &quot;A B&quot;

$ bitbake multiconfig:*:bash 

expands to:

$ bitbake multiconfig:A:bash multiconfig:B:bash bash

But what to do in this case, something like this:

$ bitbake multiconfig:*:bash core-image-minimal

I suggest we expand it like this:


$ bitbake multiconfig:A:bash multiconfig:B:bash core-image-minimal

In other words, if &quot;default&quot; is explicitly specified, we don&apos;t override it.
This would make the syntax more flexible as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69326</commentid>
    <comment_count>4</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2016-12-22 16:45:51 +0000</bug_when>
    <thetext>In particular, I would find syntax support for this very useful:

$ bitbake multiconfig:*:meta-toolchain hosttols

(building a set of baremetal toolchains + hostools)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69781</commentid>
    <comment_count>5</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2017-01-13 00:05:16 +0000</bug_when>
    <thetext>I ran into a few real world use cases where it is desirable to use multiconfig with two different tasks (recipes). For example, I frequently build SDKs with several toolchains + additional host tools. Another use is to build one image for main CPU(s) and a different co-image for a companion CPU.
The additional logic is simple: if the user specified the &quot;default&quot; task explicitly, use it, otherwise assume the &quot;default&quot; task to be the same as the multiconfig task(s).


Currently supported multiconfig sytax:
BBMULTICONFIG = &quot;A B C ...&quot;

$ bitbake multiconfig:A:task1 multiconfig:B:task2 multiconfig:C:task3 ... taskN

(where task1, task2,...,taskN,... may or may not be the same.)

Suported is also any subset of tasks, i.e.:

$ bitbake multiconfig:A:task1
$ bitbake multiconfig:A:task1 taskM
$ bitbake multiconfig:A:task1 multiconfig:B:task2
$ bitbake taskN


Proposed new syntax addition implemented in this patch (two formats):

1. Default task implicit:

$ bitbake multiconfig:*:task

expands as:

$ bitbake multiconfig:A:task multiconfig:B:task multiconfig:C:task ... task

2. Default task explicit

$ bitbake multiconfig:*:task1 task2

expands as:

$ bitbake multiconfig:A:task1 multiconfig:B:task1 multiconfig:C:task1 ... task2

This patch should allow all of the above:

diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index f6bad36..bcd4dca 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -666,7 +666,37 @@ class BBCooker:
         if not task.startswith(&quot;do_&quot;):
             task = &quot;do_%s&quot; % task
 
-        fulltargetlist = self.checkPackages(pkgs_to_build, task)
+        targetlist = self.checkPackages(pkgs_to_build, task)
+        fulltargetlist = []
+        defaulttask_implicit = &apos;&apos;
+        defaulttask_explicit = False
+        wildcard = False
+
+        # Wild card expansion:
+        # Replace string such as &quot;multiconfig:*:bash&quot;
+        # into &quot;multiconfig:A:bash multiconfig:B:bash bash&quot;
+        for k in targetlist:
+            if k.startswith(&quot;multiconfig:&quot;):
+                if wildcard:
+                    bb.fatal(&apos;multiconfig conflict&apos;)
+                if k.split(&quot;:&quot;)[1] == &quot;*&quot;:
+                    wildcard = True
+                    for mc in self.multiconfigs:
+                        if mc:
+                            fulltargetlist.append(k.replace(&apos;*&apos;, mc))
+                        # implicit default task
+                        else:
+                            defaulttask_implicit = k.split(&quot;:&quot;)[2]
+                else:
+                    fulltargetlist.append(k)
+            else:
+                defaulttask_explicit = True
+                fulltargetlist.append(k)
+
+        if not defaulttask_explicit and defaulttask_implicit != &apos;&apos;:
+            fulltargetlist.append(defaulttask_implicit)
+
+        bb.debug(1,&quot;fulltargetlist: %s&quot; % (str(fulltargetlist)))
         taskdata = {}
         localdata = {}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69782</commentid>
    <comment_count>6</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2017-01-13 00:09:22 +0000</bug_when>
    <thetext>
It takes forever to test this properly....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69822</commentid>
    <comment_count>7</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2017-01-15 20:42:44 +0000</bug_when>
    <thetext>sent patch to the mailing list:
http://lists.openembedded.org/pipermail/bitbake-devel/2017-January/008395.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70046</commentid>
    <comment_count>8</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2017-01-23 20:30:45 +0000</bug_when>
    <thetext>merged with master:
https://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=7d18d05d451d4a69d827f7f78e7e17b69f950269</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71323</commentid>
    <comment_count>9</comment_count>
    <who name="Henry Bruce">henry.bruce</who>
    <bug_when>2017-03-15 22:13:41 +0000</bug_when>
    <thetext>multiconfig is a powerful new feature whose usability (and thus rate of adoption) is greatly enhanced by the globbing feature. Requesting backport for morty so that those not ready to jump on pyro can benefit form this enhancement.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71360</commentid>
    <comment_count>10</comment_count>
    <who name="Stephen K Jolley">sjolley.yp.pm</who>
    <bug_when>2017-03-16 15:33:00 +0000</bug_when>
    <thetext>Triage team agreed to backport to 2.2.2.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71436</commentid>
    <comment_count>11</comment_count>
    <who name="Juro Bystricky">juro.bystricky</who>
    <bug_when>2017-03-19 20:22:25 +0000</bug_when>
    <thetext>Backported to morty:
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?h=morty&amp;id=ca66b08b3b7254dea23d1a8ac9eedbe2396e7f12</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>