Several tests require complete file lists in order to provide accurate
results.  These can be non-obvious.  Adding missing parent directories
helps insure the integrity of tests against human error.

Signed-off-by: Andrew Gregory <[email protected]>
---
 test/pacman/pmpkg.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/test/pacman/pmpkg.py b/test/pacman/pmpkg.py
index c0c9f13..a78d5cb 100644
--- a/test/pacman/pmpkg.py
+++ b/test/pacman/pmpkg.py
@@ -153,6 +153,17 @@ def makepkg(self, path):
             info.size = len(data)
             tar.addfile(info, StringIO(data))
 
+        # Add missing directories
+        for name in list(self.files):
+            fileinfo = util.getfileinfo(name)
+            filename = fileinfo["filename"]
+            parent = os.path.dirname(filename.rstrip("/"))
+            while parent and parent != "/":
+                if parent not in self.files and parent + "/" not in self.files:
+                    self.files.append(parent + "/")
+                parent = os.path.dirname(parent)
+        self.files.sort()
+
         # Generate package file system
         for name in self.files:
             fileinfo = util.getfileinfo(name)
-- 
1.8.1.4


Reply via email to