Gentoo Archives: gentoo-commits

From: Brian Dolbec <brian.dolbec@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/catalyst:3.0 commit in: catalyst/base/
Date: Wed, 22 Jan 2014 05:04:37
Message-Id: 1390365317.68c338743f06cdd76b4e35fb2094b025864bec17.dol-sen@gentoo
1 commit: 68c338743f06cdd76b4e35fb2094b025864bec17
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 22 01:53:01 2014 +0000
4 Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
5 CommitDate: Wed Jan 22 04:35:17 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=68c33874
7
8 Use cmd instead of os.system(), simplify code duplication.
9
10 ---
11 catalyst/base/stagebase.py | 23 +++++++++--------------
12 1 file changed, 9 insertions(+), 14 deletions(-)
13
14 diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
15 index 3021620..f7397e7 100644
16 --- a/catalyst/base/stagebase.py
17 +++ b/catalyst/base/stagebase.py
18 @@ -927,6 +927,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
19
20 def bind(self):
21 for x in self.mounts:
22 + _cmd = ''
23 #print "bind(); x =", x
24 target = normpath(self.settings["chroot_path"] + self.target_mounts[x])
25 ensure_dirs(target, mode=0755)
26 @@ -941,28 +942,22 @@ class StageBase(TargetBase, ClearBase, GenBase):
27 self.snapshot_lock_object.read_lock()
28 if os.uname()[0] == "FreeBSD":
29 if src == "/dev":
30 - cmd = "mount -t devfs none " + target
31 - retval=os.system(cmd)
32 + _cmd = "mount -t devfs none " + target
33 else:
34 - cmd = "mount_nullfs " + src + " " + target
35 - retval=os.system(cmd)
36 + _cmd = "mount_nullfs " + src + " " + target
37 else:
38 if src == "tmpfs":
39 if "var_tmpfs_portage" in self.settings:
40 - cmd = "mount -t tmpfs -o size=" + \
41 + _cmd = "mount -t tmpfs -o size=" + \
42 self.settings["var_tmpfs_portage"] + "G " + \
43 src + " " + target
44 - retval=os.system(cmd)
45 elif src == "shmfs":
46 - cmd = "mount -t tmpfs -o noexec,nosuid,nodev shm " + target
47 - retval=os.system(cmd)
48 + _cmd = "mount -t tmpfs -o noexec,nosuid,nodev shm " + target
49 else:
50 - cmd = "mount --bind " + src + " " + target
51 - #print "bind(); cmd =", cmd
52 - retval=os.system(cmd)
53 - if retval!=0:
54 - self.unbind()
55 - raise CatalystError("Couldn't bind mount " + src + "\n" + cmd)
56 + _cmd = "mount --bind " + src + " " + target
57 + #print "bind(); _cmd =", _cmd
58 + cmd(_cmd, "Bind mounting Failed", env=self.env, fail_func=self.unbind)
59 + #print "bind(); finished :D"
60
61 def unbind(self):
62 ouch=0