All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: openembedded-core <openembedded-core@lists.openembedded.org>
Subject: [PATCH] utils: Add all_multilib_tune_list function
Date: Mon, 26 Sep 2016 17:22:24 +0100	[thread overview]
Message-ID: <1474906944.30475.11.camel@linuxfoundation.org> (raw)

Its useful to be able to query a list of variables to obtain the values
in each multilib context. This adds such a function which works even
if called in the non-default recipe context.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass
index 3c2a14f..74c5059 100644
--- a/meta/classes/utils.bbclass
+++ b/meta/classes/utils.bbclass
@@ -382,3 +382,36 @@ def all_multilib_tune_values(d, var, unique = True, need_split = True, delim = '
     else:
         ret = values
     return " ".join(ret)
+
+def all_multilib_tune_list(d, var):
+    """
+    Return a list of ${var} from each multilib tune configurations
+    Is safe to be called from a multilib recipe/context as it can
+    figure out the original tune and remove the multilib overrides.
+    """
+    values = []
+
+    localdata = bb.data.createCopy(d)
+    overrides = localdata.getVar("OVERRIDES", False).split(":")
+    newoverrides = []
+    for o in overrides:
+        if not o.startswith("virtclass-multilib-"):
+            newoverrides.append(o)
+    localdata.setVar("OVERRIDES", ":".join(newoverrides))
+    localdata.setVar("MLPREFIX", "")
+    origdefault = localdata.getVar("DEFAULTTUNE_MULTILIB_ORIGINAL", True)
+    if origdefault:
+        localdata.setVar("DEFAULTTUNE", origdefault)
+    bb.data.update_data(localdata)
+    value = localdata.getVar(var, True)
+    values.append(value)
+    variants = d.getVar("MULTILIB_VARIANTS", True) or ""
+    for item in variants.split():
+        localdata = bb.data.createCopy(d)
+        overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item
+        localdata.setVar("OVERRIDES", overrides)
+        localdata.setVar("MLPREFIX", item + "-")
+        bb.data.update_data(localdata)
+        value = localdata.getVar(var, True)
+        values.append(value)
+    return values




                 reply	other threads:[~2016-09-26 16:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1474906944.30475.11.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=openembedded-core@lists.openembedded.org \
    /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.