[oe-commits] Chris Larson : newcollection: clean up, and work for those not using collections.inc
git version control
git at git.openembedded.org
Fri Nov 12 23:19:44 UTC 2010
Module: openembedded.git
Branch: master
Commit: df3fe2bf89fdb9c48770a1f9965e11ad21a7e72d
URL: http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=df3fe2bf89fdb9c48770a1f9965e11ad21a7e72d
Author: Chris Larson <chris_larson at mentor.com>
Date: Fri Nov 12 16:12:26 2010 -0700
newcollection: clean up, and work for those not using collections.inc
Signed-off-by: Chris Larson <chris_larson at mentor.com>
---
classes/newcollection.bbclass | 34 +++++++++++++++++++---------------
1 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/classes/newcollection.bbclass b/classes/newcollection.bbclass
index 7d4d478..9570597 100644
--- a/classes/newcollection.bbclass
+++ b/classes/newcollection.bbclass
@@ -106,16 +106,25 @@ python do_newcollection() {
from bb.build import FuncFailed
from urlparse import urlparse, urlunparse
- files = [__newcollection_get_recipe(d)]
- files += __newcollection_get_recipedeps(d)
- files += __newcollection_get_fileuris(d)
+ files = set([__newcollection_get_recipe(d)])
+ files |= set(__newcollection_get_recipedeps(d))
+ files |= set(__newcollection_get_fileuris(d))
+
+ # filter out files that aren't in any overlays
collectionsinfo = d.getVar("COLLECTIONSINFO",1) or ""
- collections = list(chain(*(glob(normpath(collection['path'])) for collection in collectionsinfo.itervalues())))
+ if collectionsinfo:
+ collections = list(chain(*(glob(normpath(collection['path']))
+ for collection in collectionsinfo.itervalues())))
+ else:
+ topdir = d.getVar("TOPDIR", True)
+ collections = d.getVar("BBPATH", True).split(":")
+ if topdir in collections:
+ collections.remove(topdir)
+
if not collections:
return
- # filter out files that aren't in collections
- files = filter(lambda f: len(filter(lambda c: f.startswith(c), collections)) != 0, files)
+ files = filter(lambda f: any(f.startswith(c) for c in collections), files)
if not files:
return
@@ -132,21 +141,16 @@ python do_newcollection() {
else:
existing += glob(normpath(path))
- recipe = filter(lambda f: f.endswith(".bb"), files)
- if not recipe:
- debug(1, "Recipe already populated, skipping.")
- return
-
- for file in files:
+ for file in set(files):
for col in collections:
if file.startswith(col + sep):
basefile = file[len(col)+1:]
+
if not basefile:
continue
- for e in existing:
- if exists(join(e, basefile)):
- break
+ if any(exists(join(e, basefile)) for e in existing):
+ debug(1, "%s already in existing collections, skipping." % basefile)
else:
__newcollection_populate_file(file, join(destcol, basefile), d)
}
More information about the Openembedded-commits
mailing list