From: Andrew Gaffney Date: Sun, 13 Sep 2009 19:29:12 +0000 (-0500) Subject: Create catalyst.util.rsync() helper function X-Git-Tag: CATALYST-2.0.10~3^2~107 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=52062bce69dc64ae5f2ce87b987e7d1a0d7b7fd9;p=catalyst.git Create catalyst.util.rsync() helper function --- diff --git a/ChangeLog b/ChangeLog index b9966fbe..77a995e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ # Distributed under the GPL v2 # $Id$ + 13 Sep 2009; Andrew Gaffney + modules/catalyst/target/snapshot.py, modules/catalyst/util.py: + Create catalyst.util.rsync() helper function + 13 Sep 2009; Andrew Gaffney modules/catalyst/target/generic_stage.py, modules/catalyst/target/livecd_stage1.py, diff --git a/modules/catalyst/target/snapshot.py b/modules/catalyst/target/snapshot.py index 9f3de982..3a52530c 100644 --- a/modules/catalyst/target/snapshot.py +++ b/modules/catalyst/target/snapshot.py @@ -44,8 +44,8 @@ class snapshot_target(catalyst.target.generic.generic_target): if not os.path.exists(mytmp): os.makedirs(mytmp) - cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ --exclude /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* "+\ - self.settings["portdir"]+"/ "+mytmp+"/portage/","Snapshot failure",env=self.env) + catalyst.util.rsync(self.settings["portdir"] + "/", mytmp + "/portage/", delete=True, \ + extra_opts="--exclude /distfiles/ --exclude /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-*") msg("Compressing Portage snapshot tarball...") cmd("tar cjf "+self.settings["snapshot_path"]+" -C "+mytmp+" portage",\ diff --git a/modules/catalyst/util.py b/modules/catalyst/util.py index 0701dda5..94240c93 100644 --- a/modules/catalyst/util.py +++ b/modules/catalyst/util.py @@ -238,4 +238,9 @@ def create_symlink(src, dest, remove_existing=False): except: raise CatalystError("Could not create symlink '%s' to '%s'" % (dest, src)) +def rsync(src, dest, delete=False, extra_opts=""): + retval = catalyst.spawn.spawn_bash("rsync -a --delete %s %s %s" % (extra_opts, src, dest)) + if retval != 0: + raise CatalystError("Could not rsync '%s' to '%s'" % (src, dest)) + # vim: ts=4 sw=4 sta noet sts=4 ai