base: start leveraging oe.types
authorChris Larson <chris_larson@mentor.com>
Wed, 10 Nov 2010 01:42:10 +0000 (18:42 -0700)
committerChris Larson <chris_larson@mentor.com>
Tue, 28 Dec 2010 16:19:51 +0000 (09:19 -0700)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
classes/base.bbclass

index f1c0228..c76b77d 100644 (file)
@@ -10,11 +10,13 @@ inherit utils
 inherit utility-tasks
 inherit metadata_scm
 
-OE_IMPORTS += "oe.path oe.utils oe.packagegroup sys os time"
+OE_IMPORTS += "oe.path oe.utils oe.packagegroup oe.types sys os time"
+OE_IMPORTS[type] = "list"
 
 python oe_import () {
     if isinstance(e, bb.event.ConfigParsed):
         import os, sys
+
         bbpath = e.data.getVar("BBPATH", True).split(":")
         sys.path[0:0] = [os.path.join(dir, "lib") for dir in bbpath]
 
@@ -95,8 +97,8 @@ python base_scenefunction () {
 }
 
 python base_do_setscene () {
-        for f in (bb.data.getVar('SCENEFUNCS', d, 1) or '').split():
-                bb.build.exec_func(f, d)
+       for func in oe.types.value('SCENEFUNCS', d):
+               bb.build.exec_func(func, d)
        if not os.path.exists(bb.data.getVar('STAMP', d, 1) + ".do_setscene"):
                bb.build.make_stamp("do_setscene", d)
 }
@@ -111,12 +113,11 @@ python base_do_fetch() {
        localdata = bb.data.createCopy(d)
        bb.data.update_data(localdata)
 
-       src_uri = bb.data.getVar('SRC_URI', localdata, 1)
+       src_uri = oe.types.value('SRC_URI', localdata)
        if not src_uri:
                return 1
-
        try:
-               bb.fetch.init(src_uri.split(),d)
+               bb.fetch.init(src_urid)
        except bb.fetch.NoMethodError:
                (type, value, traceback) = sys.exc_info()
                raise bb.build.FuncFailed("No method: %s" % value)
@@ -145,7 +146,7 @@ python base_do_fetch() {
 
        # Check each URI
        first_uri = True
-       for url in src_uri.split():
+       for url in src_uri:
                localpath = bb.data.expand(bb.fetch.localpath(url, localdata), localdata)
                (type,host,path,_,_,params) = bb.decodeurl(url)
                uri = "%s://%s%s" % (type,host,path)
@@ -203,13 +204,13 @@ do_unpack[dirs] = "${WORKDIR}"
 python base_do_unpack() {
     from glob import glob
 
-    src_uri = d.getVar("SRC_URI", True)
+    src_uri = oe.types.value("SRC_URI", d)
     if not src_uri:
         return
-    srcurldata = bb.fetch.init(src_uri.split(), d, True)
-    filespath = d.getVar("FILESPATH", True).split(":")
+    srcurldata = bb.fetch.init(src_uri, d, True)
+    filespath = oe.types.value("FILESPATH", d)
 
-    for url in src_uri.split():
+    for url in src_uri:
         urldata = srcurldata[url]
         if urldata.type == "file" and "*" in urldata.path:
             # The fetch code doesn't know how to handle globs, so
@@ -267,7 +268,7 @@ python build_summary() {
         statusmsg = "\n%s\n%s\n" % (bb.data.getVar("BUILDCFG_HEADER", e.data, 1), "\n".join(statuslines))
         bb.plain(statusmsg)
 
-        needed_vars = bb.data.getVar("BUILDCFG_NEEDEDVARS", e.data, 1).split()
+        needed_vars = oe.types.value("BUILDCFG_NEEDEDVARS", e.data)
         pesteruser = []
         for v in needed_vars:
             val = bb.data.getVar(v, e.data, 1)
@@ -332,8 +333,7 @@ def set_multimach_arch(d):
 
     multiarch = pkg_arch
 
-    packages = bb.data.getVar('PACKAGES', d, 1).split()
-    for pkg in packages:
+    for pkg in oe.types.value('PACKAGES', d):
         pkgarch = bb.data.getVar("PACKAGE_ARCH_%s" % pkg, d, 1)
 
         # We could look for != PACKAGE_ARCH here but how to choose