]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: cooker.py: new multiconfig '*' syntax support
authorJuro Bystricky <juro.bystricky@intel.com>
Sun, 15 Jan 2017 19:13:36 +0000 (11:13 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 19 Jan 2017 20:20:16 +0000 (20:20 +0000)
Currently you cannot build a target for all the configured multiconfigs without
specifying a list. The list can be quite long, requiring to type several lines
of text.

This enhancement is to support globbing so that you can do this,
e.g. instead of:

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

you can do:

    $ bitbake multiconfig:*:bash

There are real world use cases where it is desirable to use multiconfig with
two different tasks. For example:  SDKs with multiple toolchains but also
containing set of additional host tools, or multiconfig builds requiring one image for
the  main CPU(s) and a different co-image for a companion CPU.
For this reason, two variations of the new syntax are supported.

For example, the following:

    $ bitbake multiconfig:*:meta-toolhchain

would expand to:

    $ bitbake multiconfig:A:meta-toolchain multiconfig:B:meta-toolchain meta-toolchain

However the following:

    $ bitbake multiconfig:*:meta-toolhchain hosttools

would expand to:

    $ bitbake multiconfig:A:meta-toolchain multiconfig:B:meta-toolchain hosttools

In other words, if the user specified the "default" task explicitly, it replaces the implicit
"default" task.

[YOCTO#10680]

(Bitbake rev: 1559ad1fc3ae8b1e4e75b210f598b90be192571b)

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/cooker.py

index 182d0449e63e48cd9abe6da12c0e45cf33a3218e..560884561156d1dd9da8ca8343bb772aad2fcc62 100644 (file)
@@ -666,7 +666,37 @@ class BBCooker:
         if not task.startswith("do_"):
             task = "do_%s" % task
 
-        fulltargetlist = self.checkPackages(pkgs_to_build, task)
+        targetlist = self.checkPackages(pkgs_to_build, task)
+        fulltargetlist = []
+        defaulttask_implicit = ''
+        defaulttask_explicit = False
+        wildcard = False
+
+        # Wild card expansion:
+        # Replace string such as "multiconfig:*:bash"
+        # into "multiconfig:A:bash multiconfig:B:bash bash"
+        for k in targetlist:
+            if k.startswith("multiconfig:"):
+                if wildcard:
+                    bb.fatal('multiconfig conflict')
+                if k.split(":")[1] == "*":
+                    wildcard = True
+                    for mc in self.multiconfigs:
+                        if mc:
+                            fulltargetlist.append(k.replace('*', mc))
+                        # implicit default task
+                        else:
+                            defaulttask_implicit = k.split(":")[2]
+                else:
+                    fulltargetlist.append(k)
+            else:
+                defaulttask_explicit = True
+                fulltargetlist.append(k)
+
+        if not defaulttask_explicit and defaulttask_implicit != '':
+            fulltargetlist.append(defaulttask_implicit)
+
+        bb.debug(1,"Target list: %s" % (str(fulltargetlist)))
         taskdata = {}
         localdata = {}