r7330 - dumbhippo/trunk/super/lib/super



Author: walters
Date: 2008-02-22 11:36:18 -0600 (Fri, 22 Feb 2008)
New Revision: 7330

Modified:
   dumbhippo/trunk/super/lib/super/deployer.py
Log:
Use --rsyncable option for gzip so uploading dars is less painful.


Modified: dumbhippo/trunk/super/lib/super/deployer.py
===================================================================
--- dumbhippo/trunk/super/lib/super/deployer.py	2008-02-22 17:14:21 UTC (rev 7329)
+++ dumbhippo/trunk/super/lib/super/deployer.py	2008-02-22 17:36:18 UTC (rev 7330)
@@ -6,6 +6,8 @@
 import stat
 import tempfile
 import time
+import subprocess
+import shutil
 
 class Deployer:
     """A class that handles writing out an archive file containing super
@@ -59,9 +61,14 @@
         """Finish writing out the deployement archive"""
         topfiles = self.topfiles.keys()
         topfiles.sort()
-        filestr = " ".join(topfiles)
-        os.spawnl(os.P_WAIT, "/bin/sh", "sh", "-c", "(cd %s && tar cfz - %s) > %s" % (self.outdir, filestr, self.darfile))
-        os.spawnl(os.P_WAIT, "/bin/rm", "rm", "-rf", self.outdir)
+        outf = open(self.darfile, 'w')
+        tarargs = ['tar', 'cf', '-']
+        tarargs.extend(topfiles)
+        tar = subprocess.Popen(tarargs, stdout=subprocess.PIPE, cwd=self.outdir)
+        gzip = subprocess.Popen(['gzip', '-c', '--rsyncable'], stdin=tar.stdout, stdout=outf, cwd=self.outdir)
+        gzip.wait()
+        outf.close()
+        shutil.rmtree(self.outdir, ignore_errors=True)
 
     def _add_directory(self, directory):
         """Make the directory (and parents) in the temporary output dir if we haven't already"""



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]