1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-21 23:38:49 -05:00

util.py: return the created path

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Andrew Gregory 2015-10-16 20:28:29 -04:00 committed by Allan McRae
parent 60ebee7a6e
commit 4ceb1c5bf9
3 changed files with 5 additions and 5 deletions

View File

@ -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))

View File

@ -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:

View File

@ -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)