All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Jansa <martin.jansa@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 04/13] base.bbclass: extract *virtclass_map_dependencies logic from native/nativesdk bbclasses and call it from packageconfig
Date: Wed, 21 Mar 2012 22:36:09 +0100	[thread overview]
Message-ID: <47e81fcc80e7ca5aa4d2f9209d5db65fc4fc0ed5.1332365336.git.Martin.Jansa@gmail.com> (raw)
In-Reply-To: <2ec6e0c134d708687c5d3d439b31607cda478dfc.1332365336.git.Martin.Jansa@gmail.com>
In-Reply-To: <cover.1332365336.git.Martin.Jansa@gmail.com>

* if some package is using PACKAGECONFIG and also BBCLASSEXTEND then it could be called twice
  but without this PACKAGECONFIG was adding items to DEPENDS after virtclass handler
  so foo-native was depending on bar instead of bar-foo when bar was added by PACKAGECONFIG
  see: http://lists.linuxtogo.org/pipermail/openembedded-core/2012-February/017772.html

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/classes/base.bbclass      |   77 ++++++++++++++++++++++++++++++++++++---
 meta/classes/native.bbclass    |   25 +------------
 meta/classes/nativesdk.bbclass |   27 +-------------
 3 files changed, 73 insertions(+), 56 deletions(-)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index c8ed544..14efa16 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -223,6 +223,59 @@ def get_layers_branch_rev(d):
 			s1= layers_branch_rev[i][p1:]
 	return layers_branch_rev
 
+def native_virtclass_map_dependencies(d):
+    def map_dependencies(varname, d, suffix = ""):
+        if suffix:
+            varname = varname + "_" + suffix
+        deps = d.getVar(varname, True)
+        if not deps:
+            return
+        deps = bb.utils.explode_deps(deps)
+        newdeps = []
+        for dep in deps:
+            if dep.endswith("-cross"):
+                newdeps.append(dep.replace("-cross", "-native"))
+            elif not dep.endswith("-native"):
+                newdeps.append(dep + "-native")
+            else:
+                newdeps.append(dep)
+        d.setVar(varname, " ".join(newdeps))
+
+    map_dependencies("DEPENDS", d)
+    for pkg in [d.getVar("PN", True), "", "${PN}"]:
+        map_dependencies("RDEPENDS", d, pkg)
+        map_dependencies("RRECOMMENDS", d, pkg)
+        map_dependencies("RSUGGESTS", d, pkg)
+        map_dependencies("RPROVIDES", d, pkg)
+        map_dependencies("RREPLACES", d, pkg)
+
+def nativesdk_virtclass_map_dependencies(d):
+    def map_dependencies(varname, d, suffix = ""):
+        if suffix:
+            varname = varname + "_" + suffix
+        deps = d.getVar(varname, True)
+        if not deps:
+            return
+        deps = bb.utils.explode_deps(deps)
+        newdeps = []
+        for dep in deps:
+            if dep.endswith("-native") or dep.endswith("-cross"):
+                newdeps.append(dep)
+            elif dep.endswith("-gcc-intermediate") or dep.endswith("-gcc-initial") or dep.endswith("-gcc") or dep.endswith("-g++"):
+                newdeps.append(dep + "-crosssdk")
+            elif not dep.endswith("-nativesdk"):
+                newdeps.append(dep.replace("-nativesdk", "") + "-nativesdk")
+            else:
+                newdeps.append(dep)
+        d.setVar(varname, " ".join(newdeps))
+
+    map_dependencies("DEPENDS", d)
+    #for pkg in (d.getVar("PACKAGES", True).split() + [""]):
+    #    map_dependencies("RDEPENDS", d, pkg)
+    #    map_dependencies("RRECOMMENDS", d, pkg)
+    #    map_dependencies("RSUGGESTS", d, pkg)
+    #    map_dependencies("RPROVIDES", d, pkg)
+    #    map_dependencies("RREPLACES", d, pkg)
 
 addhandler base_eventhandler
 python base_eventhandler() {
@@ -293,8 +346,10 @@ do_build () {
 	:
 }
 
-python () {
-    import exceptions, string, re
+addhandler packageconfig_handler
+python packageconfig_handler () {
+    if not isinstance(e, bb.event.RecipePreFinalise):
+            return
 
     # Handle PACKAGECONFIG
     #
@@ -302,14 +357,14 @@ python () {
     #
     # PACKAGECONFIG ?? = "<default options>"
     # PACKAGECONFIG[foo] = "--enable-foo,--disable-foo,foo_depends,foo_runtime_depends"
-    pkgconfigflags = d.getVarFlags("PACKAGECONFIG") or {}
+    pkgconfigflags = e.data.getVarFlags("PACKAGECONFIG") or {}
     if pkgconfigflags:
-        pkgconfig = (d.getVar('PACKAGECONFIG', True) or "").split()
+        pkgconfig = (e.data.getVar('PACKAGECONFIG', True) or "").split()
         def appendVar(varname, appends):
             if not appends:
                 return
-            varname = d.expand(varname)
-            d.appendVar(varname, " " + " ".join(appends))
+            varname = e.data.expand(varname)
+            e.data.appendVar(varname, " " + " ".join(appends))
 
         extradeps = []
         extrardeps = []
@@ -332,6 +387,16 @@ python () {
         appendVar('DEPENDS', extradeps)
         appendVar('RDEPENDS_${PN}', extrardeps)
         appendVar('EXTRA_OECONF', extraconf)
+        classextend = e.data.getVar('BBCLASSEXTEND', True) or ""
+        pn = e.data.getVar("PN", True)
+        if "native" in classextend and pn.endswith("-native"):
+            native_virtclass_map_dependencies(e.data)
+        if "nativesdk" in classextend and pn.endswith("-nativesdk"):
+            nativesdk_virtclass_map_dependencies(e.data)
+}
+
+python () {
+    import exceptions, string, re
 
     # If PRINC is set, try and increase the PR value by the amount specified
     princ = d.getVar('PRINC', True)
diff --git a/meta/classes/native.bbclass b/meta/classes/native.bbclass
index ffab971..7ef3684 100644
--- a/meta/classes/native.bbclass
+++ b/meta/classes/native.bbclass
@@ -112,30 +112,7 @@ python native_virtclass_handler () {
     if not pn.endswith("-native"):
         return
 
-    def map_dependencies(varname, d, suffix = ""):
-        if suffix:
-            varname = varname + "_" + suffix
-        deps = d.getVar(varname, True)
-        if not deps:
-            return
-        deps = bb.utils.explode_deps(deps)
-        newdeps = []
-        for dep in deps:
-            if dep.endswith("-cross"):
-                newdeps.append(dep.replace("-cross", "-native"))
-            elif not dep.endswith("-native"):
-                newdeps.append(dep + "-native")
-            else:
-                newdeps.append(dep)
-        d.setVar(varname, " ".join(newdeps))
-
-    map_dependencies("DEPENDS", e.data)
-    for pkg in [e.data.getVar("PN", True), "", "${PN}"]:
-        map_dependencies("RDEPENDS", e.data, pkg)
-        map_dependencies("RRECOMMENDS", e.data, pkg)
-        map_dependencies("RSUGGESTS", e.data, pkg)
-        map_dependencies("RPROVIDES", e.data, pkg)
-        map_dependencies("RREPLACES", e.data, pkg)
+    native_virtclass_map_dependencies(e.data)
 
     provides = e.data.getVar("PROVIDES", True)
     for prov in provides.split():
diff --git a/meta/classes/nativesdk.bbclass b/meta/classes/nativesdk.bbclass
index ceec53e..af8f9ef 100644
--- a/meta/classes/nativesdk.bbclass
+++ b/meta/classes/nativesdk.bbclass
@@ -72,32 +72,7 @@ python () {
     if not pn.endswith("-nativesdk"):
         return
 
-    def map_dependencies(varname, d, suffix = ""):
-        if suffix:
-            varname = varname + "_" + suffix
-        deps = d.getVar(varname, True)
-        if not deps:
-            return
-        deps = bb.utils.explode_deps(deps)
-        newdeps = []
-        for dep in deps:
-            if dep.endswith("-native") or dep.endswith("-cross"):
-                newdeps.append(dep)
-            elif dep.endswith("-gcc-intermediate") or dep.endswith("-gcc-initial") or dep.endswith("-gcc") or dep.endswith("-g++"):
-                newdeps.append(dep + "-crosssdk")
-            elif not dep.endswith("-nativesdk"):
-                newdeps.append(dep.replace("-nativesdk", "") + "-nativesdk")
-            else:
-                newdeps.append(dep)
-        d.setVar(varname, " ".join(newdeps))
-
-    map_dependencies("DEPENDS", d)
-    #for pkg in (d.getVar("PACKAGES", True).split() + [""]):
-    #    map_dependencies("RDEPENDS", d, pkg)
-    #    map_dependencies("RRECOMMENDS", d, pkg)
-    #    map_dependencies("RSUGGESTS", d, pkg)
-    #    map_dependencies("RPROVIDES", d, pkg)
-    #    map_dependencies("RREPLACES", d, pkg)
+    nativesdk_virtclass_map_dependencies(d)
 
     provides = d.getVar("PROVIDES", True)
     for prov in provides.split():
-- 
1.7.8.5




  parent reply	other threads:[~2012-03-21 21:45 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-21 21:36 [PATCH 00/13] Merge native BBCLASSEXTENDs and SDK, PACKAGECONFIG fix Martin Jansa
2012-03-21 21:36 ` [PATCH 01/13] bitbake.conf: use TUNE_PKGARCH instead of TARGET_ARCH in SDK_NAME Martin Jansa
2012-03-21 21:36 ` [PATCH 02/13] xev: move from meta-demoapps Martin Jansa
2012-03-21 21:36 ` [PATCH 03/13] classes: scons: add EXTRA_OESCONS Martin Jansa
2012-03-21 21:36 ` Martin Jansa [this message]
2012-03-21 21:36 ` [PATCH 05/13] xorg: add more native BBCLASSEXTENDs for gtk+-native Martin Jansa
2012-03-21 21:36 ` [PATCH 06/13] gtk+: import native support from meta-oe Martin Jansa
2012-03-21 23:11   ` Richard Purdie
2012-03-21 23:50     ` Martin Jansa
2012-03-22  0:02       ` Richard Purdie
2012-03-22  6:51         ` Martin Jansa
2012-03-22  9:52           ` Richard Purdie
2012-03-22 10:04             ` Martin Jansa
2012-03-21 21:36 ` [PATCH 07/13] librsvg: " Martin Jansa
2012-03-21 21:36 ` [PATCH 08/13] pixman: add native support and perl-native to DEPENDS " Martin Jansa
2012-03-21 21:36 ` [PATCH 09/13] cairo: import native support " Martin Jansa
2012-03-21 21:36 ` [PATCH 10/13] tiff: " Martin Jansa
2012-03-21 21:36 ` [PATCH 11/13] libusb*: " Martin Jansa
2012-03-21 21:36 ` [PATCH 12/13] pango: import native support and --disable-introspection " Martin Jansa
2012-03-21 21:36 ` [PATCH 13/13] rootfs_ipk: replace 3 opkg-cl calls with one in get_package_filename Martin Jansa
2012-03-23 22:28 ` [PATCHv 00/10] Merge native BBCLASSEXTENDs and SDK fix Martin Jansa
2012-03-23 22:30   ` [PATCHv 01/10] bitbake.conf: use TUNE_PKGARCH instead of TARGET_ARCH in SDK_NAME Martin Jansa
2012-03-23 22:30   ` [PATCHv 02/10] xev: move from meta-demoapps Martin Jansa
2012-03-23 22:30   ` [PATCHv 03/10] classes: scons: add EXTRA_OESCONS Martin Jansa
2012-03-23 22:30   ` [PATCHv 04/10] librsvg: import native support from meta-oe Martin Jansa
2012-03-23 22:30   ` [PATCHv 05/10] pixman: add native support and perl-native to DEPENDS " Martin Jansa
2012-03-30 14:10     ` Richard Purdie
2012-03-30 14:22       ` Martin Jansa
2012-03-30 14:43         ` Richard Purdie
2012-03-23 22:30   ` [PATCHv 06/10] cairo: import native support " Martin Jansa
2012-03-23 22:30   ` [PATCHv 07/10] tiff: " Martin Jansa
2012-03-23 22:30   ` [PATCHv 08/10] libusb*: " Martin Jansa
2012-03-24 10:02     ` Richard Purdie
2012-03-24 10:56       ` Martin Jansa
2012-03-26 11:44     ` Richard Purdie
2012-03-26 12:19       ` Martin Jansa
2012-03-26 12:27       ` [PATCHv2 " Martin Jansa
2012-03-23 22:30   ` [PATCHv 09/10] pango: import native support and --disable-introspection " Martin Jansa
2012-03-23 22:30   ` [PATCHv 10/10] rootfs_ipk: replace 3 opkg-cl calls with one in get_package_filename Martin Jansa

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=47e81fcc80e7ca5aa4d2f9209d5db65fc4fc0ed5.1332365336.git.Martin.Jansa@gmail.com \
    --to=martin.jansa@gmail.com \
    --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.