Patchwork [1/4] gettext.bbclass: Use _append instead of =+

login
register
mail settings
Submitter Khem Raj
Date April 30, 2011, 10:06 p.m.
Message ID <7cad91d48dbbdbbce7dcd0d0c46d0c47ed9557cb.1304200899.git.raj.khem@gmail.com>
Download mbox | patch
Permalink /patch/3049/
State New, archived
Headers show

Comments

Khem Raj - April 30, 2011, 10:06 p.m.
Ensure gettext and gettext-native are removed from DEPENDS when
not using NLS

Use append instead of += to get gettext dependecies processed
correctly in all cases

Dont remove gettext-native for native recipes as ENABLE_NLS is
only for target and not for native recipes

Replace using 1 for a boolean type with True

Honor INHIBIT_DEFAULT_DEPS

Remove the added dependencies for gettext if INHIBIT_DEFAULT_DEPS is non
null

operate on virtclass overrides individually

virtclass classes are parsed at the end hence
just doing DEPENDS munging is not enough since
it will be overridden

When inheriting cross-canadian we should not remove
gettext from default deps

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/classes/gettext.bbclass |   30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

Patch

diff --git a/meta/classes/gettext.bbclass b/meta/classes/gettext.bbclass
index a40e74f..492eb68 100644
--- a/meta/classes/gettext.bbclass
+++ b/meta/classes/gettext.bbclass
@@ -1,17 +1,31 @@ 
 def gettext_after_parse(d):
     # Remove the NLS bits if USE_NLS is no.
-    if bb.data.getVar('USE_NLS', d, 1) == 'no':
+    if bb.data.getVar('USE_NLS', d, True) == 'no':
         cfg = oe_filter_out('^--(dis|en)able-nls$', bb.data.getVar('EXTRA_OECONF', d, 1) or "", d)
         cfg += " --disable-nls"
-        depends = bb.data.getVar('DEPENDS', d, 1) or ""
-        bb.data.setVar('DEPENDS', oe_filter_out('^(virtual/libiconv|virtual/libintl)$', depends, d), d)
+        depends = bb.data.getVar('DEPENDS', d, True) or ""
+        depends = oe_filter_out('^(virtual/libiconv|virtual/libintl|virtual/gettext|gettext)$', depends, d)
+        if not oe.utils.inherits(d, 'native', 'nativesdk', 'cross', 'crosssdk'):
+            depends = oe_filter_out('^(gettext-native)$', depends, d)
+        bb.data.setVar('DEPENDS', depends, d)
         bb.data.setVar('EXTRA_OECONF', cfg, d)
-
+    # check if INHIBIT_DEFAULT_DEPS is 1 then we forcibly remove dependencies
+    # added by this class through DEPENDS_GETTEXT
+    if bb.data.getVar('INHIBIT_DEFAULT_DEPS', d, True) and not oe.utils.inherits(d, 'cross-canadian'):
+        depends_native = bb.data.getVar('DEPENDS_virtclass-native', d, True) or ""
+        depends_nativesdk = bb.data.getVar('DEPENDS_virtclass-nativesdk', d, True) or ""
+        depends = bb.data.getVar('DEPENDS', d, True) or ""
+        gettext_deps = bb.data.getVar('DEPENDS_GETTEXT', d, True).replace(' ','|')
+        gettext_deps = '^(' + gettext_deps + ')$'
+        depends_native = oe_filter_out(gettext_deps, depends_native, d)
+        depends_nativesdk = oe_filter_out(gettext_deps, depends_nativesdk, d)
+        depends = oe_filter_out(gettext_deps, depends, d)
+        bb.data.setVar('DEPENDS_virtclass-native', depends, d)
+        bb.data.setVar('DEPENDS_virtclass-nativesdk', depends, d)
+        bb.data.setVar('DEPENDS', depends, d)
 python () {
     gettext_after_parse(d)
 }
-
-DEPENDS_GETTEXT = "gettext gettext-native"
-
-DEPENDS =+ "${DEPENDS_GETTEXT}"
 EXTRA_OECONF += "--enable-nls"
+DEPENDS_GETTEXT = "virtual/gettext gettext-native"
+DEPENDS =+ "${DEPENDS_GETTEXT}"