[pacman-dev] [PATCH 1/2] pmpkg: add missing directories to test packages

Andrew Gregory andrew.gregory.8 at gmail.com
Sat Mar 2 23:49:39 EST 2013


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 <andrew.gregory.8 at gmail.com>
---
 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



More information about the pacman-dev mailing list