aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Larson <clarson@mvista.com>2009-03-31 13:46:38 -0700
committerChris Larson <clarson@kergoth.com>2009-04-01 10:15:30 -0700
commitde1daef44b490e1efc232c8ec032fd5099c861ff (patch)
tree3e35425441a99af70ea6f0d6c6b7d22bc9a7e486
parent10b7252b5eec3752768692d29dec24db845d1626 (diff)
downloadopenembedded-de1daef44b490e1efc232c8ec032fd5099c861ff.tar.gz
openembedded-de1daef44b490e1efc232c8ec032fd5099c861ff.tar.bz2
openembedded-de1daef44b490e1efc232c8ec032fd5099c861ff.zip
bitbake.conf, collections.inc: Add COLLECTIONS mechanism w/ a sane default.
Added code which takes a list of directories in COLLECTIONS, in priority order (highest to lowest), and uses those to populate BBFILES, BBFILE_COLLECTIONS, BBFILE_PATTERN_*, and BBFILE_PRIORITY_*. The default COLLECTIONS is based on BBPATH, so you can now specify a sane BBPATH, not bother setting up the collections variables or BBFILES, and still likely be able to do a build. Signed-off-by: Chris Larson <clarson@mvista.com>
-rw-r--r--conf/bitbake.conf1
-rw-r--r--conf/collections.inc55
2 files changed, 56 insertions, 0 deletions
diff --git a/conf/bitbake.conf b/conf/bitbake.conf
index 7c159afcee..134525ae2e 100644
--- a/conf/bitbake.conf
+++ b/conf/bitbake.conf
@@ -620,6 +620,7 @@ OVERRIDES = "local:${MACHINE}:${DISTRO}:${TARGET_OS}:${TARGET_ARCH}:build-${BUIL
# Include the rest of the config files.
##################################################################
+require conf/collections.inc
include conf/site.conf
include conf/auto.conf
include conf/local.conf
diff --git a/conf/collections.inc b/conf/collections.inc
new file mode 100644
index 0000000000..9355b00796
--- /dev/null
+++ b/conf/collections.inc
@@ -0,0 +1,55 @@
+# Take a list of directories in COLLECTIONS, in priority order (highest to
+# lowest), and use those to populate BBFILES, BBFILE_COLLECTIONS,
+# BBFILE_PATTERN_*, and BBFILE_PRIORITY_*.
+
+COLLECTIONS = "${@' '.join(d.getVar('BBPATH', 1).split(':'))}"
+
+def collections_setup(d):
+ """ Populate collection and bbfiles metadata from the COLLECTIONS var. """
+ import bb
+ import os
+ from itertools import izip, chain
+ from glob import glob
+
+ def setifunset(k, v):
+ if d.getVar(k, 0) is None:
+ d.setVar(k, v)
+
+ collections = d.getVar("COLLECTIONS", 1)
+ if not collections:
+ return
+ globbed = (glob(path) for path in collections.split())
+ collections = list(chain(*globbed))
+
+ collectionmap = {}
+ namemap = {}
+ for collection in collections:
+ basename = os.path.basename(collection).split(os.path.extsep)[0]
+ if namemap.get(basename):
+ basename = "%s-%s" % (basename, hash(collection))
+ namemap[basename] = collection
+ collectionmap[collection] = basename
+
+ for (collection, priority) in izip(collections, xrange(len(collections), 0, -1)):
+ if not os.path.exists(collection):
+ bb.fatal("Collection %s does not exist" % collection)
+
+ name = collectionmap[collection]
+ if not name:
+ bb.fatal("Unable to determine collection name for %s" % collection)
+
+ setifunset("BBFILE_PATTERN_%s" % name, "^%s/" % collection)
+ setifunset("BBFILE_PRIORITY_%s" % name, str(priority))
+
+ setifunset("BBFILE_COLLECTIONS", " ".join(collectionmap.values()))
+ setifunset("BBFILES", " ".join(collectionmap.keys()))
+
+addhandler collections_eh
+python collections_eh () {
+ from bb.event import getName
+
+ if getName(e) == "ConfigParsed":
+ collections_setup(e.data)
+
+ return NotHandled
+}