From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/base/
Date: Sun, 22 May 2016 03:34:50 +0000 (UTC) [thread overview]
Message-ID: <1463722317.64255565bf45bd07a66405d876bbbe58b7a0c441.vapier@gentoo> (raw)
commit: 64255565bf45bd07a66405d876bbbe58b7a0c441
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri May 20 05:03:34 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri May 20 05:31:57 2016 +0000
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=64255565
use native code in more places for file ops
Rather than shell out to cp/rm/mv, use python native code to do things.
catalyst/base/stagebase.py | 39 +++++++++++++++------------------------
1 file changed, 15 insertions(+), 24 deletions(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 2009ab6..0b25516 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -1013,8 +1013,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
else:
log.notice('Setting up chroot...')
- cmd("cp /etc/resolv.conf " + self.settings["chroot_path"] + "/etc/",
- env=self.env)
+ shutil.copy('/etc/resolv.conf', self.settings['chroot_path'] + '/etc/')
# Copy over the envscript, if applicable
if "envscript" in self.settings:
@@ -1030,18 +1029,15 @@ class StageBase(TargetBase, ClearBase, GenBase):
'Catalyst Maintainers use VERY minimal envscripts, if used at all.\n'
'You have been warned.')
- cmd("cp "+self.settings["envscript"]+" "+\
- self.settings["chroot_path"]+"/tmp/envscript",\
- env=self.env)
+ shutil.copy(self.settings['envscript'],
+ self.settings['chroot_path'] + '/tmp/envscript')
# Copy over /etc/hosts from the host in case there are any
# specialties in there
- if os.path.exists(self.settings["chroot_path"]+"/etc/hosts"):
- cmd("mv "+self.settings["chroot_path"]+"/etc/hosts "+\
- self.settings["chroot_path"]+"/etc/hosts.catalyst",\
- env=self.env)
- cmd("cp /etc/hosts "+self.settings["chroot_path"]+"/etc/hosts",\
- env=self.env)
+ hosts_file = self.settings['chroot_path'] + '/etc/hosts'
+ if os.path.exists(hosts_file):
+ os.rename(hosts_file, hosts_file + '.catalyst')
+ shutil.copy('/etc/hosts', hosts_file)
# Modify and write out make.conf (for the chroot)
makepath = normpath(self.settings["chroot_path"] +
@@ -1162,10 +1158,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
clear_path(self.settings["destpath"] + x)
# Put /etc/hosts back into place
- if os.path.exists(self.settings["chroot_path"]+"/etc/hosts.catalyst"):
- cmd("mv -f "+self.settings["chroot_path"]+"/etc/hosts.catalyst "+\
- self.settings["chroot_path"]+"/etc/hosts",\
- env=self.env)
+ hosts_file = self.settings['chroot_path'] + '/etc/hosts'
+ if os.path.exists(hosts_file + '.catalyst'):
+ os.rename(hosts_file + '.catalyst', hosts_file)
# Remove our overlay
if os.path.exists(self.settings["chroot_path"] + self.settings["local_overlay"]):
@@ -1565,11 +1560,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
env=self.env)
if "boot/kernel/"+kname+"/initramfs_overlay" in self.settings:
- if os.path.exists(self.settings["chroot_path"]+\
- "/tmp/initramfs_overlay/"):
- log.notice('Cleaning up temporary overlay dir')
- cmd("rm -R "+self.settings["chroot_path"]+\
- "/tmp/initramfs_overlay/",env=self.env)
+ log.notice('Cleaning up temporary overlay dir')
+ clear_dir(self.settings['chroot_path'] + '/tmp/initramfs_overlay/')
self.resume.is_enabled("build_kernel_"+kname)
@@ -1586,11 +1578,10 @@ class StageBase(TargetBase, ClearBase, GenBase):
self.settings[key])
try:
- cmd('cp ' + self.settings[key] + ' ' +
- self.settings['chroot_path'] + '/var/tmp/' + kname + '.config',
- env=self.env)
+ shutil.copy(self.settings[key],
+ self.settings['chroot_path'] + '/var/tmp/' + kname + '.config')
- except CatalystError:
+ except IOError:
self.unbind()
def _copy_initramfs_overlay(self, kname):
next reply other threads:[~2016-05-22 3:34 UTC|newest]
Thread overview: 144+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-22 3:34 Mike Frysinger [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-10-13 20:33 [gentoo-commits] proj/catalyst:master commit in: catalyst/base/ Andreas K. Hüttel
2024-08-22 18:39 Ben Kohler
2024-08-03 9:06 Andreas K. Hüttel
2024-07-30 14:12 Andreas K. Hüttel
2024-07-30 11:06 Andreas K. Hüttel
2024-07-30 11:06 Andreas K. Hüttel
2024-06-09 16:50 Andreas K. Hüttel
2024-06-07 21:45 Matt Turner
2024-03-03 18:50 Andreas K. Hüttel
2023-12-24 21:42 Andreas K. Hüttel
2023-09-05 1:44 Andreas K. Hüttel
2023-07-01 19:27 Andreas K. Hüttel
2023-05-10 18:10 Ben Kohler
2022-11-22 21:19 Matt Turner
2022-11-20 0:21 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2022-05-13 17:45 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2022-11-20 0:21 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2022-04-20 23:26 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2022-11-14 14:11 Andreas K. Hüttel
2022-11-13 2:18 Andreas K. Hüttel
2022-05-13 17:45 Matt Turner
2022-05-13 17:45 Matt Turner
2022-05-13 17:43 [gentoo-commits] proj/catalyst:stage4-user-groups-fixes " Matt Turner
2022-05-13 17:45 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2022-04-02 23:50 Matt Turner
2021-06-10 0:48 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2021-03-09 16:18 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2021-06-10 0:48 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2021-03-25 3:03 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2021-06-10 0:48 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2021-02-21 2:05 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2021-06-10 0:48 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2021-02-20 21:27 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2021-03-25 3:03 Matt Turner
2021-03-06 16:58 Matt Turner
2021-01-28 2:41 Matt Turner
2021-01-28 2:41 Matt Turner
2021-01-28 2:09 [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2021-01-28 2:41 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2021-01-18 19:53 [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-12-27 23:15 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2020-12-19 19:56 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2020-10-30 22:41 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2020-10-30 22:41 Matt Turner
2020-10-30 22:41 Matt Turner
2020-10-24 22:07 Matt Turner
2020-10-24 22:07 Matt Turner
2020-10-14 17:48 Matt Turner
2020-08-15 21:11 Matt Turner
2020-07-24 20:33 Andreas K. Hüttel
2020-07-20 20:40 Andreas K. Hüttel
2020-06-05 21:13 Matt Turner
2020-06-05 21:13 Matt Turner
2020-06-05 21:13 Matt Turner
2020-05-21 20:25 Matt Turner
2020-05-21 20:25 Matt Turner
2020-05-21 20:25 Matt Turner
2020-05-20 3:39 [gentoo-commits] proj/catalyst:wip/mattst88 " Matt Turner
2020-05-21 20:25 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2020-05-16 6:43 Matt Turner
2020-05-16 6:43 Matt Turner
2020-05-15 6:32 [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-05-16 6:43 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2020-05-15 6:32 [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
2020-05-16 6:43 ` [gentoo-commits] proj/catalyst:master " Matt Turner
2020-05-06 17:41 Matt Turner
2020-05-05 5:20 Matt Turner
2020-05-01 5:57 Matt Turner
2020-04-30 22:56 Matt Turner
2020-04-23 2:06 Matt Turner
2020-04-22 5:52 Matt Turner
2020-04-18 20:30 Matt Turner
2020-04-17 19:52 Matt Turner
2020-04-17 19:52 Matt Turner
2020-04-17 19:52 Matt Turner
2020-04-17 19:52 Matt Turner
2020-04-15 19:59 Matt Turner
2020-04-13 20:43 Matt Turner
2020-04-13 20:43 Matt Turner
2020-04-13 20:43 Matt Turner
2020-04-13 20:36 Matt Turner
2020-04-13 20:36 Matt Turner
2020-04-13 20:36 Matt Turner
2020-04-10 21:04 Matt Turner
2020-04-10 5:38 Matt Turner
2020-04-10 2:11 Matt Turner
2020-03-29 17:48 Matt Turner
2020-03-28 20:07 Matt Turner
2019-10-19 23:25 Matt Turner
2019-10-14 20:15 Matt Turner
2019-10-05 22:31 Matt Turner
2018-11-07 19:50 Rick Farina
2018-10-01 16:30 Brian Dolbec
2018-07-21 18:54 Brian Dolbec
2018-07-21 18:54 Brian Dolbec
2018-02-22 3:53 Richard Farina
2018-02-22 3:50 Richard Farina
2017-12-29 2:27 Brian Dolbec
2017-12-29 2:27 Brian Dolbec
2017-12-29 0:35 Brian Dolbec
2017-11-29 17:20 Brian Dolbec
2017-11-29 17:20 Brian Dolbec
2017-11-22 15:52 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2017-11-29 17:20 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
2017-03-09 5:38 Brian Dolbec
2017-03-09 5:05 Brian Dolbec
2017-03-08 23:16 Brian Dolbec
2017-03-08 23:16 Brian Dolbec
2016-09-19 3:27 Brian Dolbec
2016-06-25 15:46 Brian Dolbec
2016-05-20 3:03 Mike Frysinger
2016-03-24 14:37 Brian Dolbec
2016-03-23 21:15 Brian Dolbec
2016-03-21 4:55 Mike Frysinger
2016-03-17 5:04 Brian Dolbec
2016-02-17 8:17 Brian Dolbec
2016-02-11 16:43 Mike Frysinger
2016-02-11 13:59 Mike Frysinger
2015-12-23 4:30 Brian Dolbec
2015-12-20 4:47 Brian Dolbec
2015-12-20 1:13 Brian Dolbec
2015-12-15 17:13 Brian Dolbec
2015-11-21 1:33 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-11-10 6:42 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-11-20 21:26 Brian Dolbec
2015-11-09 4:47 Brian Dolbec
2015-10-31 20:35 Brian Dolbec
2015-10-31 20:35 Brian Dolbec
2015-10-28 16:50 Mike Frysinger
2015-10-27 21:43 Richard Farina
2015-10-24 6:58 Mike Frysinger
2015-10-24 6:58 Mike Frysinger
2015-10-11 18:03 Mike Frysinger
2015-10-11 17:26 Mike Frysinger
2015-10-11 17:26 Mike Frysinger
2015-10-11 17:26 Mike Frysinger
2015-10-09 2:40 Mike Frysinger
2015-10-06 17:03 Mike Frysinger
2015-10-06 15:31 Mike Frysinger
2015-10-06 13:46 Mike Frysinger
2015-09-08 14:21 Richard Farina
2015-09-08 14:17 Brian Dolbec
2015-09-08 14:17 Brian Dolbec
2015-09-08 14:14 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-09-08 14:17 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-09-06 21:18 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-09-06 21:21 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-09-03 15:14 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-09-02 21:00 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-09-02 21:52 Richard Farina
2015-09-02 21:25 Richard Farina
2015-09-01 19:41 Richard Farina
2015-08-31 19:21 Richard Farina
2015-05-24 0:08 Brian Dolbec
2015-05-24 0:08 Brian Dolbec
2015-05-24 0:08 Brian Dolbec
2015-05-21 23:53 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-05-24 0:08 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-05-21 23:53 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-05-24 0:08 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-05-21 23:53 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-05-24 0:08 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
2015-02-26 22:18 Brian Dolbec
2015-01-01 5:59 [gentoo-commits] proj/catalyst:pending " Brian Dolbec
2015-02-26 20:12 ` [gentoo-commits] proj/catalyst:master " Brian Dolbec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1463722317.64255565bf45bd07a66405d876bbbe58b7a0c441.vapier@gentoo \
--to=vapier@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox