]> git.decadent.org.uk Git - dak.git/commitdiff
Fix number of removed files when rmtree'ing directories
authorLuca Falavigna <dktrkranz@debian.org>
Sun, 28 Apr 2013 01:43:37 +0000 (01:43 +0000)
committerLuca Falavigna <dktrkranz@debian.org>
Sun, 28 Apr 2013 01:43:37 +0000 (01:43 +0000)
dak/make_changelog.py

index 50307b158250271769b595e8315421fb03f4efd3..eeb738e5f8e49a407c11f2912efe6087ab02e113 100755 (executable)
@@ -244,13 +244,13 @@ def export_files(session, archive, clpool, progress=False):
         if len(files):
             if root.split('/')[-1] not in sources.keys():
                 if os.path.exists(root):
+                    stats['removed'] += len(os.listdir(root))
                     rmtree(root)
-                    stats['removed'] += 1
             for file in files:
                 if os.path.exists(os.path.join(root, file)):
                     if os.stat(os.path.join(root, file)).st_nlink ==  1:
-                        os.unlink(os.path.join(root, file))
                         stats['removed'] += 1
+                        os.unlink(os.path.join(root, file))
 
     for root, dirs, files in os.walk(clpool):
         stats['files'] += len(files)