createrepo/yumbased.py

[email protected] (James Antill)
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
 createrepo/yumbased.py |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit e4edc4aa4d6446686c9c796c8d1996c6122b9a71
Author: James Antill <[email protected]>
Date:   Thu Oct 9 13:42:39 2008 -0400

    Change the NamedTemporaryFile() usage to mkstemp(), stupid API

diff --git a/createrepo/yumbased.py b/createrepo/yumbased.py
index 3cd0cfe..60568e3 100644
--- a/createrepo/yumbased.py
+++ b/createrepo/yumbased.py
@@ -76,10 +76,14 @@ class CreateRepoPackage(YumLocalPackage):
 
             #  This is atomic cache creation via. rename, so we can have two
             # tasks using the same cachedir ... mash does this.
-            csumo = tempfile.NamedTemporaryFile(mode='w', dir=self.crp_cachedir)
-            csumo.write(checksum)
-            csumo.close()
-            os.rename(csumo.name, csumfile)
+            try:
+                (csumo, tmpfilename) = tempfile.mkstemp(dir=self.crp_cachedir)
+                csumo = os.fdopen(csumo, 'w', -1)
+                csumo.write(checksum)
+                csumo.close()
+                os.rename(tmpfilename, csumfile)
+            except:
+                pass
         
         self._checksum = checksum
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.