From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id D1620138247 for ; Wed, 22 Jan 2014 05:04:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B09EEE118D; Wed, 22 Jan 2014 05:04:17 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E3998E1174 for ; Wed, 22 Jan 2014 05:04:16 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 260C533FAE9 for ; Wed, 22 Jan 2014 05:04:15 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 2779A187CE for ; Wed, 22 Jan 2014 05:04:13 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1390365317.68c338743f06cdd76b4e35fb2094b025864bec17.dol-sen@gentoo> Subject: [gentoo-commits] proj/catalyst:3.0 commit in: catalyst/base/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/base/stagebase.py X-VCS-Directories: catalyst/base/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 68c338743f06cdd76b4e35fb2094b025864bec17 X-VCS-Branch: 3.0 Date: Wed, 22 Jan 2014 05:04:13 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: bd507189-9846-4ce4-8b36-4948225aa489 X-Archives-Hash: 60730accaea89299bb6721638db67e40 commit: 68c338743f06cdd76b4e35fb2094b025864bec17 Author: Brian Dolbec gentoo org> AuthorDate: Wed Jan 22 01:53:01 2014 +0000 Commit: Brian Dolbec gmail com> CommitDate: Wed Jan 22 04:35:17 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/catalyst.git;a=commit;h=68c33874 Use cmd instead of os.system(), simplify code duplication. --- catalyst/base/stagebase.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 3021620..f7397e7 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -927,6 +927,7 @@ class StageBase(TargetBase, ClearBase, GenBase): def bind(self): for x in self.mounts: + _cmd = '' #print "bind(); x =", x target = normpath(self.settings["chroot_path"] + self.target_mounts[x]) ensure_dirs(target, mode=0755) @@ -941,28 +942,22 @@ class StageBase(TargetBase, ClearBase, GenBase): self.snapshot_lock_object.read_lock() if os.uname()[0] == "FreeBSD": if src == "/dev": - cmd = "mount -t devfs none " + target - retval=os.system(cmd) + _cmd = "mount -t devfs none " + target else: - cmd = "mount_nullfs " + src + " " + target - retval=os.system(cmd) + _cmd = "mount_nullfs " + src + " " + target else: if src == "tmpfs": if "var_tmpfs_portage" in self.settings: - cmd = "mount -t tmpfs -o size=" + \ + _cmd = "mount -t tmpfs -o size=" + \ self.settings["var_tmpfs_portage"] + "G " + \ src + " " + target - retval=os.system(cmd) elif src == "shmfs": - cmd = "mount -t tmpfs -o noexec,nosuid,nodev shm " + target - retval=os.system(cmd) + _cmd = "mount -t tmpfs -o noexec,nosuid,nodev shm " + target else: - cmd = "mount --bind " + src + " " + target - #print "bind(); cmd =", cmd - retval=os.system(cmd) - if retval!=0: - self.unbind() - raise CatalystError("Couldn't bind mount " + src + "\n" + cmd) + _cmd = "mount --bind " + src + " " + target + #print "bind(); _cmd =", _cmd + cmd(_cmd, "Bind mounting Failed", env=self.env, fail_func=self.unbind) + #print "bind(); finished :D" def unbind(self): ouch=0