don't clean meta directory
authorTimo Savola <tsavola@movial.fi>
Fri, 4 Apr 2008 14:41:27 +0000 (17:41 +0300)
committerTimo Savola <tsavola@movial.fi>
Fri, 4 Apr 2008 14:41:27 +0000 (17:41 +0300)
matrix/matrix.py

index d31e80c..4e3f5ea 100644 (file)
@@ -547,15 +547,11 @@ def clean_components(targets):
                targets = config.components.keys()
 
        for name in targets:
-               print 'Cleaning component:', name
-
                c = config.components[name]
+               print 'Cleaning', c.repo.path
 
-               paths = []
-               for repo in (c.repo, c.meta):
-                       files = git.ls_files(repo.path, ['-o'])
-                       paths += [os.path.join(repo.path, i) for i in files]
-
+               files = git.ls_files(c.repo.path, ['-o'])
+               paths = [os.path.join(c.repo.path, i) for i in files]
                paths.sort()
                paths.reverse()
 
@@ -564,13 +560,16 @@ def clean_components(targets):
                        paths.append(cache)
 
                for path in paths:
+                       if git.contains_database(path):
+                               continue
+
                        if config.debug:
-                               print 'Deleting', path
+                               print 'Removing', path
 
                        if os.path.islink(path) or not os.path.isdir(path):
                                os.remove(path)
-                       elif not os.path.exists(os.path.join(path, '.git')):
-                               os.rmdir(path)
+                       else:
+                               remove_tree(path)
 
                for repo in (c.repo, c.meta):
                        files = git.ls_files(repo.path, ['-m', '-d'])