Create catalyst.util.rsync() helper function
authorAndrew Gaffney <agaffney@gentoo.org>
Sun, 13 Sep 2009 19:29:12 +0000 (14:29 -0500)
committerAndrew Gaffney <agaffney@gentoo.org>
Sun, 13 Sep 2009 19:29:12 +0000 (14:29 -0500)
ChangeLog
modules/catalyst/target/snapshot.py
modules/catalyst/util.py

index b9966fbe16f1df17c6144a644f857fe672e34de0..77a995e9fa1bd0e9d234cd7a172e364a8346f18b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@
 # Distributed under the GPL v2
 # $Id$
 
+  13 Sep 2009; Andrew Gaffney <agaffney@gentoo.org>
+  modules/catalyst/target/snapshot.py, modules/catalyst/util.py:
+  Create catalyst.util.rsync() helper function
+
   13 Sep 2009; Andrew Gaffney <agaffney@gentoo.org>
   modules/catalyst/target/generic_stage.py,
   modules/catalyst/target/livecd_stage1.py,
index 9f3de982a071f2a9b64221faf8bce641aaa40b45..3a52530c7f2a99817fb2ffcbf047c62fd175c31f 100644 (file)
@@ -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",\
index 0701dda57353475192c1bcec2697081e1f4e82e6..94240c93760d41feb3c42dc1321856c6efe75eeb 100644 (file)
@@ -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