[pacman-dev] [PATCH v3 07/11] util.py: return the created path

Andrew Gregory andrew.gregory.8 at gmail.com
Sat Oct 17 00:28:29 UTC 2015


Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
 test/pacman/pmpkg.py  | 3 +--
 test/pacman/pmtest.py | 3 +--
 test/pacman/util.py   | 4 +++-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/test/pacman/pmpkg.py b/test/pacman/pmpkg.py
index 3133661..9033dc6 100644
--- a/test/pacman/pmpkg.py
+++ b/test/pacman/pmpkg.py
@@ -174,8 +174,7 @@ def makepkg(self, path):
     def install_package(self, root):
         """Install the package in the given root."""
         for f in self.files:
-            util.mkfile(root, f, f)
-            path = os.path.join(root, f)
+            path = util.mkfile(root, f, f)
             if os.path.isfile(path):
                 os.utime(path, (355, 355))
 
diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py
index d48c03f..7774a7b 100644
--- a/test/pacman/pmtest.py
+++ b/test/pacman/pmtest.py
@@ -180,8 +180,7 @@ def generate(self, pacman):
         vprint("    Populating file system")
         for f in self.filesystem:
             vprint("\t%s" % f)
-            util.mkfile(self.root, f, f)
-            path = os.path.join(self.root, f)
+            path = util.mkfile(self.root, f, f)
             if os.path.isfile(path):
                 os.utime(path, (355, 355))
         for pkg in self.db["local"].pkgs:
diff --git a/test/pacman/util.py b/test/pacman/util.py
index aa9c63f..e2acc52 100644
--- a/test/pacman/util.py
+++ b/test/pacman/util.py
@@ -84,7 +84,7 @@ def mkfile(base, name, data=""):
     if info["isdir"]:
         if not os.path.isdir(path):
             os.makedirs(path, 0o755)
-        return
+        return path
 
     dir_path = os.path.dirname(path)
     if dir_path and not os.path.isdir(dir_path):
@@ -98,6 +98,8 @@ def mkfile(base, name, data=""):
     if info["perms"]:
         os.chmod(path, info["perms"])
 
+    return path
+
 def writedata(filename, data):
     if isinstance(data, list):
         data = "\n".join(data)
-- 
2.6.1


More information about the pacman-dev mailing list