Skip to contentSkip to conversation

base.bbclass: Fix PACKAGECONFIG issues with native and nativesdk BBCLASSEXTEND recipes (and multilib)

PATCH In review Richard Purdie 2 participants 2 messages Apr 12, 2012 – Apr 13, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 base.bbclass: Fix PACKAGECONFIG issues with native and nativesdk BBCLASSEXTEND recipes (and multilib)

This patch fixes up the issues that were being seen where BBCLASSEXTEND and PACKAGECONFIG were interacting badly. It also ensures PACKAGECONFIG interacts properly with multilib builds.

Ideally some of this code will be abstracted into lib/oe/classextend.py but at this point in release more invasive changes like this are inappropriate.

This patch also removed empty strings from expressions rather than passing them around as this was complicating the additional code unnecessarily.

The patch was verified against the OE-Core metadata where the return values of expandFilter() were sanity checked by hand for native/nativesdk and multilib combinations.

[YOCTO #2225]

---

meta/classes/base.bbclass +31 -5
index 2e8a0b0..3c9d76c 100644
@@ -305,9 +305,32 @@ python () {
     pkgconfigflags = d.getVarFlags("PACKAGECONFIG") or {}
     if pkgconfigflags:
         pkgconfig = (d.getVar('PACKAGECONFIG', True) or "").split()
+        pn = d.getVar("PN", True)
+        mlprefix = d.getVar("MLPREFIX", True)
+
+        def expandFilter(appends, extension, prefix):
+            appends = bb.utils.explode_deps(d.expand(" ".join(appends)))
+            newappends = []
+            for a in appends:
+               if a.endswith("-native") or a.endswith("-cross"):
+                   newappends.append(a)
+               elif a.startswith("virtual/"):
+                   subs = a.split("/", 1)[1]
+                   newappends.append("virtual/" + prefix + subs + extension)
+               else:
+                   newappends.append(prefix + a + extension)
+            return newappends
+
         def appendVar(varname, appends):
             if not appends:
                 return
+            if varname.find("DEPENDS") != -1:
+                if pn.endswith("-nativesdk"):
+                    appends = expandFilter(appends, "-nativesdk", "")
+                if pn.endswith("-native"):
+                    appends = expandFilter(appends, "-native", "")
+                if mlprefix:
+                    appends = expandFilter(appends, "", mlprefix)
             varname = d.expand(varname)
             d.appendVar(varname, " " + " ".join(appends))
 
@@ -324,11 +347,14 @@ python () {
             elif len(items) == 4:
                 enable, disable, depend, rdepend = items
             if flag in pkgconfig:
-                extradeps.append(depend)
-                extrardeps.append(rdepend)
-                extraconf.append(enable)
-            else:
-                extraconf.append(disable)
+                if depend:
+                    extradeps.append(depend)
+                if rdepend:
+                    extrardeps.append(rdepend)
+                if enable:
+                    extraconf.append(enable)
+            elif disable:
+                    extraconf.append(disable)
         appendVar('DEPENDS', extradeps)
         appendVar('RDEPENDS_${PN}', extrardeps)
         appendVar('EXTRA_OECONF', extraconf)
#1 lore raw
Quoted 7 lines · Richard Purdie

This patch fixes up the issues that were being seen where BBCLASSEXTEND and PACKAGECONFIG were interacting badly. It also ensures PACKAGECONFIG interacts properly with multilib builds.

Ideally some of this code will be abstracted into lib/oe/classextend.py but at this point in release more invasive changes like this are inappropriate.

Quoted 7 lines

This patch also removed empty strings from expressions rather than passing them around as this was complicating the additional code unnecessarily.

The patch was verified against the OE-Core metadata where the return values of expandFilter() were sanity checked by hand for native/nativesdk and multilib combinations.

I can confirm it also fixes gtk+-native depends, cannot do more tests now.

meta-oe people could be interested in this patch
http://git.openembedded.org/meta-openembedded-contrib/commit/?h=jansa/xorg&id=1ab99af784f5f1564f28f6afc4718d630b42a606
when this change hits oe-core

Quoted 68 lines

[YOCTO #2225]

---

meta/classes/base.bbclass +31 -5
index 2e8a0b0..3c9d76c 100644
@@ -305,9 +305,32 @@ python () {
     pkgconfigflags = d.getVarFlags("PACKAGECONFIG") or {}
     if pkgconfigflags:
         pkgconfig = (d.getVar('PACKAGECONFIG', True) or "").split()
+        pn = d.getVar("PN", True)
+        mlprefix = d.getVar("MLPREFIX", True)
+
+        def expandFilter(appends, extension, prefix):
+            appends = bb.utils.explode_deps(d.expand(" ".join(appends)))
+            newappends = []
+            for a in appends:
+               if a.endswith("-native") or a.endswith("-cross"):
+                   newappends.append(a)
+               elif a.startswith("virtual/"):
+                   subs = a.split("/", 1)[1]
+                   newappends.append("virtual/" + prefix + subs + extension)
+               else:
+                   newappends.append(prefix + a + extension)
+            return newappends
+
         def appendVar(varname, appends):
             if not appends:
                 return
+            if varname.find("DEPENDS") != -1:
+                if pn.endswith("-nativesdk"):
+                    appends = expandFilter(appends, "-nativesdk", "")
+                if pn.endswith("-native"):
+                    appends = expandFilter(appends, "-native", "")
+                if mlprefix:
+                    appends = expandFilter(appends, "", mlprefix)
             varname = d.expand(varname)
             d.appendVar(varname, " " + " ".join(appends))
 
@@ -324,11 +347,14 @@ python () {
             elif len(items) == 4:
                 enable, disable, depend, rdepend = items
             if flag in pkgconfig:
-                extradeps.append(depend)
-                extrardeps.append(rdepend)
-                extraconf.append(enable)
-            else:
-                extraconf.append(disable)
+                if depend:
+                    extradeps.append(depend)
+                if rdepend:
+                    extrardeps.append(rdepend)
+                if enable:
+                    extraconf.append(enable)
+            elif disable:
+                    extraconf.append(disable)
         appendVar('DEPENDS', extradeps)
         appendVar('RDEPENDS_${PN}', extrardeps)
         appendVar('EXTRA_OECONF', extraconf)

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]