fix an error when find files
authorHasan Wan <hasan.wan@intel.com>
Mon, 27 May 2013 06:37:30 +0000 (14:37 +0800)
committerHasan Wan <hasan.wan@intel.com>
Mon, 27 May 2013 06:37:30 +0000 (14:37 +0800)
Change-Id: If5ea13ff2b6c1303fb6925c55c4681c4f125b689
Signed-off-by: Hasan Wan <hasan.wan@intel.com>
common/repomaker.py

index 7979e5d..1769caf 100644 (file)
@@ -32,13 +32,10 @@ class RepoMakerError(Exception):
 # Helper functions
 def find_files(topdir, prefix='', suffix='.rpm'):
     """Find files in the tree."""
-    for item in os.listdir(topdir):
-        path = os.path.join(topdir, item)
-        if os.path.isdir(path):
-            for fpath in find(path):
-                yield fpath
-        elif item.startswith(prefix) and item.endswith(suffix):
-            yield path
+    for root, dirs, files in os.walk(topdir):
+        for item in files:
+            if item.startswith(prefix) and item.endswith(suffix):
+                yield os.path.join(root, item)
 
 def collect(in_dir):
     """Collect files, binary archs and destinations."""
@@ -246,4 +243,3 @@ class RepoMaker(object):
         """Add image configurations."""
         for name, content in images:
             self.images.append((name, content))
-