From 682b28c12e4b8bdb746c94c6a870738e0742ba05 Mon Sep 17 00:00:00 2001 From: Chris Gianelloni Date: Wed, 22 Nov 2006 15:11:34 +0000 Subject: [PATCH] Added cleanup patch for stage1/stage2 and generic_stage_target from Andrew Gaffney wrt bug #155911. git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@1188 d1e1f19c-881f-0410-ab34-b69fee027534 --- ChangeLog | 6 ++++++ modules/generic_stage_target.py | 14 +++++--------- modules/stage1_target.py | 2 ++ modules/stage2_target.py | 27 ++++++++++++--------------- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index e6cab7b4..43487b54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ # Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2 # $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.664 2006/10/02 20:41:53 wolf31o2 Exp $ + 22 Nov 2006; Chris Gianelloni + modules/generic_stage_target.py, modules/stage1_target.py, + modules/stage2_target.py: + Added cleanup patch for stage1/stage2 and generic_stage_target from Andrew + Gaffney wrt bug #155911. + 22 Nov 2006; Chris Gianelloni targets/grp/grp-chroot.sh, targets/livecd-stage1/livecd-stage1-chroot.sh, targets/netboot/netboot-chroot.sh, targets/netboot2/netboot2-pkg.sh, diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py index 8a480dfd..c2a97400 100644 --- a/modules/generic_stage_target.py +++ b/modules/generic_stage_target.py @@ -338,19 +338,15 @@ class generic_stage_target(generic_target): self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/") else: self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2") - if os.path.isfile(self.settings["source_path"]): - if os.path.exists(self.settings["source_path"]): - self.settings["source_path_hash"]=generate_hash(self.settings["source_path"],\ - hash_function=self.settings["hash_function"],verbose=False) + if os.path.exists(self.settings["source_path"]): # XXX: Is this even necessary if the previous check passes? + self.settings["source_path_hash"]=generate_hash(self.settings["source_path"],\ + hash_function=self.settings["hash_function"],verbose=False) + print "Source path set to "+self.settings["source_path"] if os.path.isdir(self.settings["source_path"]): - print "Source path set to "+self.settings["source_path"] print "\tIf this is not desired, remove this directory or turn of seedcache in the options of catalyst.conf" - print "\tthe source path with then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2\n") - else: - print "Source path set to "+self.settings["source_path"] + print "\tthe source path will then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2\n") - def set_dest_path(self): if self.settings.has_key("root_path"): self.settings["destpath"]=normpath(self.settings["chroot_path"]+self.settings["root_path"]) diff --git a/modules/stage1_target.py b/modules/stage1_target.py index 90478d23..1e9b92a4 100644 --- a/modules/stage1_target.py +++ b/modules/stage1_target.py @@ -33,6 +33,8 @@ class stage1_target(generic_stage_target): "/usr/lib/python2.4/email", "/usr/lib/python2.4/lib-tk",\ "/usr/share/zoneinfo"]) + # XXX: How do these override_foo() functions differ from the ones in generic_stage_target and why aren't they in stage3_target? + def override_chost(self): if self.settings.has_key("chost"): self.settings["CHOST"]=list_to_string(self.settings["chost"]) diff --git a/modules/stage2_target.py b/modules/stage2_target.py index e3f6680e..dbbffba7 100644 --- a/modules/stage2_target.py +++ b/modules/stage2_target.py @@ -12,25 +12,23 @@ class stage2_target(generic_stage_target): self.required_values=[] self.valid_values=[] generic_stage_target.__init__(self,spec,addlargs) - def set_root_path(self): - # ROOT= variable for emerges - self.settings["root_path"]=normpath("/tmp/stage1root") - + def set_source_path(self): - self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/"+self.settings["root_path"]+"/") - - # reset the root path so the preclean doesnt fail - generic_stage_target.set_root_path(self) - - if os.path.isdir(self.settings["source_path"]): - print "\nUsing seed-stage from "+self.settings["source_path"] - print "Delete this folder if you wish to use a seed stage tarball instead\n" + if self.settings.has_key("SEEDCACHE") and os.path.isdir(normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/")): + self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/tmp/stage1root/") else: self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2") if os.path.isfile(self.settings["source_path"]): - if os.path.exists(self.settings["source_path"]): - self.settings["source_path_hash"]=generate_hash(self.settings["source_path"]) + if os.path.exists(self.settings["source_path"]): # XXX: Is this even necessary if the previous check passes? + self.settings["source_path_hash"]=generate_hash(self.settings["source_path"],\ + hash_function=self.settings["hash_function"],verbose=False) + print "Source path set to "+self.settings["source_path"] + if os.path.isdir(self.settings["source_path"]): + print "\tIf this is not desired, remove this directory or turn of seedcache in the options of catalyst.conf" + print "\tthe source path will then be "+normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2\n") + # XXX: How do these override_foo() functions differ from the ones in generic_stage_target and why aren't they in stage3_target? + def override_chost(self): if self.settings.has_key("chost"): self.settings["CHOST"]=list_to_string(self.settings["chost"]) @@ -55,7 +53,6 @@ class stage2_target(generic_stage_target): print "\tIf you break it, you buy it. Don't complain to us about it." print "\tDont say we did not warn you\n" - def register(foo): foo.update({"stage2":stage2_target}) return foo -- 2.26.2