From: Brian Dolbec <dolsen@gentoo.org>
To: gentoo-catalyst@lists.gentoo.org
Subject: [gentoo-catalyst] [PATCH 2/6] Break out more repeated (path1 + path2)'s...
Date: Wed, 10 Sep 2014 21:01:04 -0700 [thread overview]
Message-ID: <1410408068-3441-3-git-send-email-dolsen@gentoo.org> (raw)
In-Reply-To: <1410408068-3441-1-git-send-email-dolsen@gentoo.org>
Just do it once and use the temp variable.
Comment out some debug print's.
Fix options conversion for export to bash.
---
catalyst/base/stagebase.py | 43 ++++++++++++++++++++++---------------------
catalyst/defaults.py | 2 ++
2 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index bebb5dc..b44a957 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -631,11 +631,10 @@ class StageBase(TargetBase, ClearBase, GenBase):
"""
self.setup_environment()
- if os.path.exists(self.settings["sharedir"]+\
- "/targets/support/kill-chroot-pids.sh"):
- cmd("/bin/bash "+self.settings["sharedir"]+\
- "/targets/support/kill-chroot-pids.sh",\
- "kill-chroot-pids script failed.",env=self.env)
+ killcmd = normpath(self.settings["sharedir"] +
+ self.settings["shdir"] + "/support/kill-chroot-pids.sh")
+ if os.path.exists(killcmd):
+ cmd(killcmd, "kill-chroot-pids script failed.",env=self.env)
def mount_safety_check(self):
"""
@@ -647,10 +646,10 @@ class StageBase(TargetBase, ClearBase, GenBase):
if not os.path.exists(self.settings["chroot_path"]):
return
- print "self.mounts =", self.mounts
+ #print "self.mounts =", self.mounts
for x in self.mounts:
target = normpath(self.settings["chroot_path"] + self.target_mounts[x])
- print "mount_safety_check() x =", x, target
+ #print "mount_safety_check() x =", x, target
if not os.path.exists(target):
continue
@@ -1020,8 +1019,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
"Couldn't umount one or more bind-mounts; aborting for safety."
def chroot_setup(self):
- self.makeconf=read_makeconf(self.settings["chroot_path"]+\
- "/etc/portage/make.conf")
+ self.makeconf=read_makeconf(normpath(self.settings["chroot_path"]+
+ self.settings["make.conf"]))
self.override_cbuild()
self.override_chost()
self.override_cflags()
@@ -1035,8 +1034,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
else:
print "Setting up chroot..."
- #self.makeconf=read_makeconf(self.settings["chroot_path"]+"/etc/portage/make.conf")
-
cmd("cp /etc/resolv.conf " + self.settings["chroot_path"] + "/etc/",
"Could not copy resolv.conf into place.",env=self.env)
@@ -1070,10 +1067,11 @@ class StageBase(TargetBase, ClearBase, GenBase):
"Could not copy /etc/hosts",env=self.env)
""" Modify and write out make.conf (for the chroot) """
- cmd("rm -f "+self.settings["chroot_path"]+"/etc/portage/make.conf",\
- "Could not remove "+self.settings["chroot_path"]+\
- "/etc/portage/make.conf",env=self.env)
- myf=open(self.settings["chroot_path"]+"/etc/portage/make.conf","w")
+ makepath = normpath(self.settings["chroot_path"] +
+ self.settings["make.conf"])
+ cmd("rm -f " + makepath,\
+ "Could not remove " + makepath, env=self.env)
+ myf=open(makepath, "w")
myf.write("# These settings were set by the catalyst build script that automatically\n# built this stage.\n")
myf.write("# Please consult /usr/share/portage/config/make.conf.example for a more\n# detailed example.\n")
if "CFLAGS" in self.settings:
@@ -1123,10 +1121,11 @@ class StageBase(TargetBase, ClearBase, GenBase):
myf.write('PORTDIR_OVERLAY="/usr/local/portage"\n')
myf.close()
- cmd("cp "+self.settings["chroot_path"]+"/etc/portage/make.conf "+\
- self.settings["chroot_path"]+"/etc/portage/make.conf.catalyst",\
- "Could not backup /etc/portage/make.conf",env=self.env)
- touch(chroot_setup_resume)
+ makepath = normpath(self.settings["chroot_path"] +
+ self.settings["make.conf"])
+ cmd("cp " + makepath + " " + makepath + ".catalyst",\
+ "Could not backup " + self.settings["make.conf"],env=self.env)
+ touch(self.settings["autoresume_path"]+"chroot_setup")
def fsscript(self):
fsscript_resume = pjoin(self.settings["autoresume_path"], "fsscript")
@@ -1289,6 +1288,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
else:
try:
if os.path.exists(self.settings["controller_file"]):
+ print "run_local() starting controller script..."
cmd(self.settings["controller_file"]+" run",\
"run script failed.",env=self.env)
touch(run_local_resume)
@@ -1324,11 +1324,12 @@ class StageBase(TargetBase, ClearBase, GenBase):
self.env[varname]=string.join(self.settings[x])
elif type(self.settings[x])==types.BooleanType:
if self.settings[x]:
- self.env[varname]="true"
+ self.env[varname] = "true"
else:
- self.env[varname]="false"
+ self.env[varname] = "false"
if "makeopts" in self.settings:
self.env["MAKEOPTS"]=self.settings["makeopts"]
+ #print "setup_environment(); env =", self.env
def run(self):
self.chroot_lock.write_lock()
diff --git a/catalyst/defaults.py b/catalyst/defaults.py
index f6b2163..ce7e919 100644
--- a/catalyst/defaults.py
+++ b/catalyst/defaults.py
@@ -25,12 +25,14 @@ confdefaults={
"hash_function": "crc32",
"icecream": "/var/cache/icecream",
"local_overlay": "/usr/local/portage",
+ "make.conf": "/etc/portage/make.conf",
"options": "",
"packagedir": "/usr/portage/packages",
"portdir": "/usr/portage",
"port_tmpdir": "/var/tmp/portage",
"repo_name": "portage",
"sharedir": "/usr/lib/catalyst",
+ "shdir": "/usr/lib/catalyst/targets/",
"snapshot_cache": "/var/tmp/catalyst/snapshot_cache",
"snapshot_name": "portage-",
"storedir": "/var/tmp/catalyst",
--
2.1.0
next prev parent reply other threads:[~2014-09-11 4:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-11 4:01 [gentoo-catalyst] [PATCH 0/6] Various changes towards 3.0 branch Brian Dolbec
2014-09-11 4:01 ` [gentoo-catalyst] [PATCH 1/6] FIXME! Comment out a small code block causing TypeError Brian Dolbec
2014-09-11 4:01 ` Brian Dolbec [this message]
2014-09-11 4:01 ` [gentoo-catalyst] [PATCH 3/6] Rename a make.conf key to make_conf due to bash variable name restrictions Brian Dolbec
2014-09-11 4:01 ` [gentoo-catalyst] [PATCH 4/6] reduce 2 operations into one simpler one Brian Dolbec
2014-09-11 4:01 ` [gentoo-catalyst] [PATCH 5/6] Extend ParserBase to do variable substitution Brian Dolbec
2014-09-11 4:01 ` [gentoo-catalyst] [PATCH 6/6] Make shdir a complete path to ease it's use 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=1410408068-3441-3-git-send-email-dolsen@gentoo.org \
--to=dolsen@gentoo.org \
--cc=gentoo-catalyst@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