[oe-commits] Richard Purdie : base.bbclass: Replace the base_package_name function with the base_prune_suffix() function from Poky and extend the number of special suffixes

git version control git at git.openembedded.org
Wed Nov 11 06:25:55 UTC 2009


Module: openembedded.git
Branch: shr/merge
Commit: 539d1d9592ca0cde57ce94e227b63fd1104bb9d5
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=539d1d9592ca0cde57ce94e227b63fd1104bb9d5

Author: Richard Purdie <rpurdie at linux.intel.com>
Date:   Tue Nov 10 13:58:46 2009 +0000

base.bbclass: Replace the base_package_name function with the base_prune_suffix() function from Poky and extend the number of special suffixes

Signed-off-by: Richard Purdie <rpurdie at linux.intel.com>

---

 classes/base.bbclass |   24 +++++++-----------------
 conf/bitbake.conf    |    3 ++-
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/classes/base.bbclass b/classes/base.bbclass
index dd48d92..aa1037e 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -202,23 +202,13 @@ DEPENDS_prepend="${@base_dep_prepend(d)} "
 DEPENDS_virtclass-native_prepend="${@base_dep_prepend(d)} "
 DEPENDS_virtclass-nativesdk_prepend="${@base_dep_prepend(d)} "
 
-# Returns PN with various suffixes removed
-# or PN if no matching suffix was found.
-def base_package_name(d):
-  pn = bb.data.getVar('PN', d, 1)
-  if pn.endswith("-native"):
-		pn = pn[0:-7]
-  elif pn.endswith("-cross"):
-		pn = pn[0:-6]
-  elif pn.endswith("-initial"):
-		pn = pn[0:-8]
-  elif pn.endswith("-intermediate"):
-		pn = pn[0:-13]
-  elif pn.endswith("-sdk"):
-		pn = pn[0:-4]
-
-
-  return pn
+def base_prune_suffix(var, suffixes, d):
+    # See if var ends with any of the suffixes listed and 
+    # remove it if found
+    for suffix in suffixes:
+        if var.endswith(suffix):
+            return var.replace(suffix, "")
+    return var
 
 def base_set_filespath(path, d):
 	bb.note("base_set_filespath usage is deprecated, %s should be fixed" % d.getVar("P", 1))
diff --git a/conf/bitbake.conf b/conf/bitbake.conf
index ddd4196..e74b63e 100644
--- a/conf/bitbake.conf
+++ b/conf/bitbake.conf
@@ -190,7 +190,8 @@ MACHINE_KERNEL_PR = ""
 # Base package name
 # Automatically derives "foo" from "foo-native", "foo-cross" or "foo-initial"
 # otherwise it is the same as PN and P
-BPN = "${@base_package_name(d)}"
+SPECIAL_PKGSUFFIX = "-native -cross -initial -intermediate -nativesdk -crosssdk -cross-canadian -sdk"
+BPN = "${@base_prune_suffix(bb.data.getVar('PN', d, True), bb.data.getVar('SPECIAL_PKGSUFFIX', d, True).split(), d)}"
 BP = "${BPN}-${PV}"
 
 # Package info.





More information about the Openembedded-commits mailing list