summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-02-19 20:47:44 +0000
committerZac Medico <zmedico@gentoo.org>2006-02-19 20:47:44 +0000
commit80b381410e4a6519a01e2cfc218bd77a2e987112 (patch)
tree8458bda55c9f084c18dd3ecfb58a3420eddbb419
parentaa21babd731a9c437c1bcb008e7372d56b5bc059 (diff)
downloadportage-80b381410e4a6519a01e2cfc218bd77a2e987112.tar.gz
portage-80b381410e4a6519a01e2cfc218bd77a2e987112.tar.bz2
portage-80b381410e4a6519a01e2cfc218bd77a2e987112.zip
In order do avoid the need for temporary files, add a new tbz2.recompose_mem() method that uses an xpak segment from memory.
svn path=/main/trunk/; revision=2748
-rw-r--r--pym/xpak.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/pym/xpak.py b/pym/xpak.py
index 56c2f4b07..9e918801c 100644
--- a/pym/xpak.py
+++ b/pym/xpak.py
@@ -256,18 +256,21 @@ class tbz2:
"""Creates an xpak segment from the datadir provided, truncates the tbz2
to the end of regular data if an xpak segment already exists, and adds
the new segment to the file with terminating info."""
+ xpdata = xpak(datadir)
+ self.recompose_mem(xpdata)
+ if cleanup:
+ self.cleanup(datadir)
+
+ def recompose_mem(self, xpdata):
self.scan() # Don't care about condition... We'll rewrite the data anyway.
myfile=open(self.file,"a+")
if not myfile:
raise IOError
myfile.seek(-self.xpaksize,2) # 0,2 or -0,2 just mean EOF.
myfile.truncate()
- xpdata=xpak(datadir)
myfile.write(xpdata+encodeint(len(xpdata))+"STOP")
myfile.flush()
myfile.close()
- if cleanup:
- self.cleanup(datadir)
return 1
def cleanup(self, datadir):