From b81856d03df39fe7ae1d7bf1b681b26c2a65f1d4 Mon Sep 17 00:00:00 2001 From: "John P. Davis" Date: Wed, 2 Jun 2004 06:35:29 +0000 Subject: [PATCH] see changelog git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@385 d1e1f19c-881f-0410-ab34-b69fee027534 --- ChangeLog | 7 ++++++- modules/snapshot_target.py | 21 +++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 85ea9861..ad712b67 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for gentoo/src/catalyst # Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.56 2004/05/27 16:41:36 zhen Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.57 2004/06/02 06:35:29 zhen Exp $ + + 02 Jun 2004; John Davis modules/snapshot_target.py: + Fixes to address bugs #51072 and #52045. The snapshot logic was tweaked to be + more efficient, and I added a new snapshot specfile option, portdir_overlay. + It should be a full path pointing to a portage overlay dir. 27 May 2004; John Davis livecd/cdtar/silo-1.3.1-cdtar.tar.bz2, diff --git a/modules/snapshot_target.py b/modules/snapshot_target.py index e6934ed0..2dff87ca 100644 --- a/modules/snapshot_target.py +++ b/modules/snapshot_target.py @@ -1,6 +1,6 @@ # Distributed under the GNU General Public License version 2 # Copyright 2003-2004 Gentoo Technologies, Inc. -# $Header: /var/cvsroot/gentoo/src/catalyst/modules/snapshot_target.py,v 1.1 2004/05/17 01:56:19 zhen Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/modules/snapshot_target.py,v 1.2 2004/06/02 06:35:29 zhen Exp $ """ Builder class for snapshots. @@ -14,7 +14,7 @@ from stat import * class snapshot_target(generic_target): def __init__(self,myspec,addlargs): self.required_values=["version_stamp","target"] - self.valid_values=["version_stamp","target"] + self.valid_values=["version_stamp","target","portdir_overlay"] generic_target.__init__(self,myspec,addlargs) self.settings=myspec self.settings["target_subpath"]="portage-"+self.settings["version_stamp"] @@ -31,20 +31,21 @@ class snapshot_target(generic_target): self.setup() print "Creating Portage tree snapshot "+self.settings["version_stamp"]+" from "+self.settings["portdir"]+"..." mytmp=self.settings["tmp_path"] - if os.path.exists(mytmp): - cmd("rm -rf "+mytmp,"Could not remove existing directory: "+mytmp) - os.makedirs(mytmp) - cmd("rsync -a --exclude /packages/ --exclude /distfiles/ --exclude CVS/ "+self.settings["portdir"]+"/ "+mytmp+"/portage/","Snapshot failure") + if not os.path.exists(mytmp): + os.makedirs(mytmp) + + cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ --exclude CVS/ "+self.settings["portdir"]+"/ "+mytmp+"/portage/","Snapshot failure") + if self.settings.has_key("portdir_overlay"): + cmd("rsync -a --exclude /packages/ --exclude /distfiles/ --exclude CVS/ "+self.settings["portdir_overlay"]+"/ "+mytmp+"/portage/","Snapshot/ overlay addition failure") + print "Compressing Portage snapshot tarball..." cmd("tar cjf "+self.settings["snapshot_path"]+" -C "+mytmp+" portage","Snapshot creation failure") self.cleanup() + print "snapshot: complete!" def cleanup(self): - print "Cleaning up temporary snapshot directory..." - #Be a good citizen and clean up after ourselves - cmd("rm -rf "+self.settings["tmp_path"],"Snapshot cleanup failure") + print "Cleaning up..." def register(foo): foo.update({"snapshot":snapshot_target}) return foo - -- 2.26.2