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: packagedata/multilib: Fix search patch for multilib builds
Date: Wed, 26 Sep 2012 12:56:58 +0100	[thread overview]
Message-ID: <1348660618.8662.104.camel@ted> (raw)

The current multilib search path code for packagedata is flawed since it
doesn't correctly handle changes in the TARGET_VENDOR/TARGET_OS that
multilib may make. This patch enhances the code to correctly build the
search paths so multilib packagedata is found correctly.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/meta/classes/multilib.bbclass b/meta/classes/multilib.bbclass
index b1a593e..73ccf3a 100644
--- a/meta/classes/multilib.bbclass
+++ b/meta/classes/multilib.bbclass
@@ -32,8 +32,6 @@ python multilib_virtclass_handler () {
     e.data.setVar("MLPREFIX", variant + "-")
     e.data.setVar("PN", variant + "-" + e.data.getVar("PN", False))
     e.data.setVar("SHLIBSDIR_virtclass-multilib-" + variant ,e.data.getVar("SHLIBSDIR", False) + "/" + variant)
-    if e.data.getVar("TARGET_VENDOR_virtclass-multilib-" + variant, False) is None:
-	    e.data.setVar("TARGET_VENDOR_virtclass-multilib-" + variant, e.data.getVar("TARGET_VENDOR", False) + "ml" + variant)
     e.data.setVar("OVERRIDES", e.data.getVar("OVERRIDES", False) + override)
 }
 
diff --git a/meta/classes/multilib_global.bbclass b/meta/classes/multilib_global.bbclass
index b76fd94..f55e3a2 100644
--- a/meta/classes/multilib_global.bbclass
+++ b/meta/classes/multilib_global.bbclass
@@ -2,6 +2,11 @@ python multilib_virtclass_handler_global () {
     if not e.data:
         return
 
+    if isinstance(e, bb.event.RecipePreFinalise):
+        for v in e.data.getVar("MULTILIB_VARIANTS", True).split():
+            if e.data.getVar("TARGET_VENDOR_virtclass-multilib-" + v, False) is None:
+	       e.data.setVar("TARGET_VENDOR_virtclass-multilib-" + v, e.data.getVar("TARGET_VENDOR", False) + "ml" + v)
+
     variant = e.data.getVar("BBEXTENDVARIANT", True)
 
     if isinstance(e, bb.event.RecipeParsed) and not variant:
diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py
index 5f897ff..ce92a7e 100644
--- a/meta/lib/oe/packagedata.py
+++ b/meta/lib/oe/packagedata.py
@@ -23,21 +23,39 @@ def read_pkgdatafile(fn):
 
     return pkgdata
 
+def all_pkgdatadirs(d):
+    archs = []
+    tos = []
+    tvs = []
+
+    archs.append(d.getVar("PACKAGE_ARCHS", True).split())
+    tos.append(d.getVar("TARGET_OS", True))
+    tvs.append(d.getVar("TARGET_VENDOR", True))
+
+    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)
+        bb.data.update_data(localdata)
+
+        archs.append(localdata.getVar("PACKAGE_ARCHS", True).split())
+        tos.append(localdata.getVar("TARGET_OS", True))
+        tvs.append(localdata.getVar("TARGET_VENDOR", True))
+
+    dirs = []
+    for i in range(len(archs)):
+        for arch in archs[i]:
+            dirs.append(arch + tvs[i] + "-" + tos[i] + "/runtime/")
+    dirs.reverse()
+    return dirs 
+ 
 def get_subpkgedata_fn(pkg, d):
-    archs = d.expand("${PACKAGE_ARCHS}").split(" ")
-    mlarchs = d.getVar("MULTILIB_PACKAGE_ARCHS", d) or None
+    dirs = all_pkgdatadirs(d)
 
-    if mlarchs:
-        for mlarch in mlarchs.split(" "):
-            if "_" in mlarch:
-                prefix, split, new_arch = mlarch.partition("_")
-                archs.append(new_arch)
-
-    archs.reverse()
     pkgdata = d.expand('${TMPDIR}/pkgdata/')
-    targetdir = d.expand('${TARGET_VENDOR}-${TARGET_OS}/runtime/')
-    for arch in archs:
-        fn = pkgdata + arch + targetdir + pkg
+    for dir in dirs:
+        fn = pkgdata + dir + pkg
         if os.path.exists(fn):
             return fn
     return d.expand('${PKGDATA_DIR}/runtime/%s' % pkg)





                 reply	other threads:[~2012-09-26 12:09 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=1348660618.8662.104.camel@ted \
    --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.