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 1DBF158973 for ; Thu, 11 Feb 2016 13:59:30 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0CFD521C010; Thu, 11 Feb 2016 13:59:28 +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 B0F9621C003 for ; Thu, 11 Feb 2016 13:59:27 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id AC370340BA7 for ; Thu, 11 Feb 2016 13:59:26 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 374988F8 for ; Thu, 11 Feb 2016 13:59:24 +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: <1455196296.d8b2a96f1d96d1c64b10c3c9607fd8ebf2a983a5.vapier@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/base/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/base/stagebase.py X-VCS-Directories: catalyst/base/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: d8b2a96f1d96d1c64b10c3c9607fd8ebf2a983a5 X-VCS-Branch: master Date: Thu, 11 Feb 2016 13:59:24 +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: 02cf867b-152f-4744-bffe-bfd62ed21a5a X-Archives-Hash: 7a6815e7552794d988621b41a894f7d5 commit: d8b2a96f1d96d1c64b10c3c9607fd8ebf2a983a5 Author: Mike Frysinger gentoo org> AuthorDate: Thu Feb 11 13:11:36 2016 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Thu Feb 11 13:11:36 2016 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=d8b2a96f stagebase: avoid using `sed` The `sed -i` command is not portable, so rewrite the logic in pure python. This is faster anyways. Bugzilla: https://bugs.gentoo.org/363577 Reported-by: Yuta SATOH gmail.com> catalyst/base/stagebase.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 8891b3f..e291c30 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -1188,9 +1188,16 @@ class StageBase(TargetBase, ClearBase, GenBase): if os.path.exists(self.settings["chroot_path"] + self.settings["local_overlay"]): cmd("rm -rf " + self.settings["chroot_path"] + self.settings["local_overlay"], "Could not remove " + self.settings["local_overlay"], env=self.env) - cmd("sed -i '/^PORTDIR_OVERLAY/d' "+self.settings["chroot_path"]+\ - self.settings["make_conf"],\ - "Could not remove PORTDIR_OVERLAY from make.conf",env=self.env) + + make_conf = self.settings['chroot_path'] + self.settings['make_conf'] + try: + with open(make_conf) as f: + data = f.readlines() + data = ''.join(x for x in data if not x.startswith('PORTDIR_OVERLAY')) + with open(make_conf, 'w') as f: + f.write(data) + except OSError as e: + raise CatalystError('Could not update %s: %s' % (make_conf, e)) # Clean up old and obsoleted files in /etc if os.path.exists(self.settings["stage_path"]+"/etc"):