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 D916F138262 for ; Sun, 22 May 2016 03:34:58 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BD2C0E085C; Sun, 22 May 2016 03:34:56 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5AE52E085C for ; Sun, 22 May 2016 03:34:55 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id F2100340D19 for ; Sun, 22 May 2016 03:34:53 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B629A980 for ; Sun, 22 May 2016 03:34:50 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1463722994.125ca190d30215de85fc3343c95784e658f75c37.vapier@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/base/, catalyst/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/base/stagebase.py catalyst/fileops.py X-VCS-Directories: catalyst/base/ catalyst/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 125ca190d30215de85fc3343c95784e658f75c37 X-VCS-Branch: master Date: Sun, 22 May 2016 03:34:50 +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: 52260482-d83d-415e-9631-b24942fb707f X-Archives-Hash: 093dc52bc32752df07ad17bc303a7256 commit: 125ca190d30215de85fc3343c95784e658f75c37 Author: Mike Frysinger gentoo org> AuthorDate: Fri May 20 05:43:14 2016 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Fri May 20 05:43:14 2016 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=125ca190 replace os.system with cmd Use the existing cmd() helper for running external programs. catalyst/base/stagebase.py | 11 ++++++----- catalyst/fileops.py | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index f0f3ba9..6695ac4 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -967,16 +967,17 @@ class StageBase(TargetBase, ClearBase, GenBase): if not ismount(target): continue - retval=os.system("umount " + target) - - if retval!=0: + try: + cmd(['umount', target]) + except CatalystError: log.warning('First attempt to unmount failed: %s', target) log.warning('Killing any pids still running in the chroot') self.kill_chroot_pids() - retval2 = os.system("umount " + target) - if retval2!=0: + try: + cmd(['umount', target]) + except CatalystError: ouch=1 log.warning("Couldn't umount bind mount: %s", target) diff --git a/catalyst/fileops.py b/catalyst/fileops.py index 4b9e200..6971911 100644 --- a/catalyst/fileops.py +++ b/catalyst/fileops.py @@ -22,7 +22,7 @@ from snakeoil.osutils import (ensure_dirs as snakeoil_ensure_dirs, # pylint: enable=unused-import from catalyst import log -from catalyst.support import CatalystError +from catalyst.support import (cmd, CatalystError) def ensure_dirs(path, gid=-1, uid=-1, mode=0o755, minimal=True, @@ -79,7 +79,7 @@ def clear_dir(target, mode=0o755, chg_flags=False, remove=False, mystat = os.stat(target) # There's no easy way to change flags recursively in python if chg_flags and os.uname()[0] == "FreeBSD": - os.system("chflags -R noschg " + target) + cmd(['chflags', '-R', 'noschg', target]) log.debug('shutil.rmtree()') shutil.rmtree(target) except Exception: