From: Chris Larson Date: Fri, 12 Nov 2010 23:12:26 +0000 (-0700) Subject: newcollection: clean up, and work for those not using collections.inc X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df3fe2bf89fdb9c48770a1f9965e11ad21a7e72d;p=openembedded.git newcollection: clean up, and work for those not using collections.inc Signed-off-by: Chris Larson --- diff --git a/classes/newcollection.bbclass b/classes/newcollection.bbclass index 7d4d478491..9570597af0 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) }