[oe-commits] Chris Larson : newcollection: handle globs in file: uris

git version control git at git.openembedded.org
Fri Nov 12 23:19:44 UTC 2010


Module: openembedded.git
Branch: master
Commit: 81a5067e56df4bf7df435b8012836a04cabad424
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=81a5067e56df4bf7df435b8012836a04cabad424

Author: Chris Larson <chris_larson at mentor.com>
Date:   Fri Nov 12 16:11:53 2010 -0700

newcollection: handle globs in file: uris

Signed-off-by: Chris Larson <chris_larson at mentor.com>

---

 classes/newcollection.bbclass |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/classes/newcollection.bbclass b/classes/newcollection.bbclass
index 20794f6..7d4d478 100644
--- a/classes/newcollection.bbclass
+++ b/classes/newcollection.bbclass
@@ -40,6 +40,7 @@ def __newcollection_get_recipedeps(d):
 
 def __newcollection_get_fileuris(d):
     from urlparse import urlparse, urlunparse
+    from glob import glob
     from os.path import isabs, join, exists
 
     files = []
@@ -60,10 +61,16 @@ def __newcollection_get_fileuris(d):
         except ValueError:
             params = {}
 
-        for fp in d.getVar("FILESPATH", 1).split(":"):
+        globbing = "*" in path
+        filespath = reversed(d.getVar("FILESPATH", True).split(":"))
+        for fp in filespath:
             newpath = join(fp, path)
-            if exists(newpath):
-                files.append(newpath)
+            if globbing:
+                globbed = filter(lambda f: exists(f), glob(newpath))
+                files.extend(globbed)
+            else:
+                if exists(newpath):
+                    files.append(newpath)
 
     return files
 
@@ -77,14 +84,7 @@ def __newcollection_populate_file(src, dest, d):
     if not exists(src):
         return
 
-    try:
-        makedirs(dirname(dest))
-    except OSError, e:
-        if e.errno != EEXIST:
-            bb.error("Unable to create %s:\n%s" % dirname(dest))
-            bb.error(str(e))
-            return
-
+    bb.mkdirhier(dirname(dest))
     try:
         if isdir(src):
             copytree(src, dest, True)





More information about the Openembedded-commits mailing list