[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 481b48e9f804c4414e29be300d6377d248f24dc2
Andreas Beckmann
debian at abeckmann.de
Sat Nov 26 13:32:49 UTC 2011
The following commit has been merged in the develop branch:
commit bbebd4f6aeb35c8593515553ef0ff5bdf55c6762
Author: Andreas Beckmann <debian at abeckmann.de>
Date: Sun Nov 6 15:23:23 2011 +0100
use chroot.relative() more often to build filenames
use self.relative("...") to build a path name instead of
manually doing it via os.path.join(self.name, "...")
Signed-off-by: Andreas Beckmann <debian at abeckmann.de>
diff --git a/piuparts.py b/piuparts.py
index bd6b316..e001695 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -810,7 +810,7 @@ class Chroot:
for mirror, components in settings.debian_mirrors:
lines.append("deb %s %s %s\n" %
(mirror, distro, " ".join(components)))
- create_file(os.path.join(self.name, "etc/apt/sources.list"),
+ create_file(self.relative("etc/apt/sources.list"),
"".join(lines))
def create_apt_conf(self):
@@ -860,7 +860,7 @@ class Chroot:
def create_policy_rc_d(self):
"""Create a policy-rc.d that prevents daemons from running."""
- full_name = os.path.join(self.name, "usr/sbin/policy-rc.d")
+ full_name = self.relative("usr/sbin/policy-rc.d")
create_file(full_name, "#!/bin/sh\nexit 101\n")
os.chmod(full_name, 0777)
logging.debug("Created policy-rc.d and chmodded it.")
@@ -934,7 +934,7 @@ class Chroot:
def copy_files(self, source_names, target_name):
"""Copy files in 'source_name' to file/dir 'target_name', relative
to the root of the chroot."""
- target_name = os.path.join(self.name, target_name)
+ target_name = self.relative(target_name)
logging.debug("Copying %s to %s" %
(", ".join(source_names), target_name))
for source_name in source_names:
@@ -993,8 +993,7 @@ class Chroot:
self.run_scripts("post_install")
self.run(["apt-get", "clean"])
- remove_files([os.path.join(self.name, name)
- for name in tmp_files])
+ remove_files([self.relative(name) for name in tmp_files])
def get_selections(self):
"""Get current package selections in a chroot."""
@@ -1072,7 +1071,7 @@ class Chroot:
def save_meta_data(self):
"""Return the filesystem meta data for all objects in the chroot."""
- root = os.path.join(self.name, ".")
+ root = self.relative(".")
vdict = {}
proc = os.path.join(root, "proc")
for dirpath, dirnames, filenames in os.walk(root):
--
piuparts git repository
More information about the Piuparts-commits
mailing list