From 4ceb1c5bf91dea2453d9b888138c40e4f97d408d Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Fri, 16 Oct 2015 20:28:29 -0400 Subject: [PATCH] util.py: return the created path Signed-off-by: Andrew Gregory Signed-off-by: Allan McRae --- 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 31336610..9033dc61 100644 --- a/test/pacman/pmpkg.py +++ b/test/pacman/pmpkg.py @@ -174,8 +174,7 @@ class pmpkg(object): 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 d48c03f1..7774a7bf 100644 --- a/test/pacman/pmtest.py +++ b/test/pacman/pmtest.py @@ -180,8 +180,7 @@ class pmtest(object): 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 aa9c63f7..e2acc52f 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)