rpms/createrepo/F-9 atomic-cache-checksum.patch, NONE, 1.1 createrepo.spec, 1.42, 1.43

James Antill james at fedoraproject.org
Thu Oct 9 18:11:13 UTC 2008


Author: james

Update of /cvs/pkgs/rpms/createrepo/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv16080

Modified Files:
	createrepo.spec 
Added Files:
	atomic-cache-checksum.patch 
Log Message:
* Thu Oct  9 2008 James Antill <james at fedoraproject.org> - 0.9.5-5
- Do atomic updates to the cachedir, for parallel runs
- Fix the patch


atomic-cache-checksum.patch:

--- NEW FILE atomic-cache-checksum.patch ---
diff -rup createrepo-0.9.5-orig/createrepo/yumbased.py createrepo-0.9.5/createrepo/yumbased.py
--- createrepo-0.9.5-orig/createrepo/yumbased.py	2008-02-18 15:30:13.000000000 -0500
+++ createrepo-0.9.5/createrepo/yumbased.py	2008-10-09 13:51:48.000000000 -0400
@@ -30,6 +30,7 @@ from rpmUtils.transaction import initRea
 from rpmUtils.miscutils import flagToString, stringToVersion
 import libxml2
 import utils
+import tempfile
 
 #FIXME - merge into class with config stuff
 fileglobs = ['.*bin\/.*', '^\/etc\/.*', '^\/usr\/lib\/sendmail$']
@@ -106,9 +107,17 @@ class CreateRepoPackage(YumLocalPackage)
              
         else:
             checksum = misc.checksum('sha', self.localpath)
-            csumo = open(csumfile, 'w')
-            csumo.write(checksum)
-            csumo.close()
+
+            #  This is atomic cache creation via. rename, so we can have two
+            # tasks using the same cachedir ... mash does this.
+            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
 
Only in createrepo-0.9.5/createrepo: yumbased.py.orig


Index: createrepo.spec
===================================================================
RCS file: /cvs/pkgs/rpms/createrepo/F-9/createrepo.spec,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- createrepo.spec	22 Feb 2008 15:58:55 -0000	1.42
+++ createrepo.spec	9 Oct 2008 18:10:43 -0000	1.43
@@ -3,12 +3,13 @@
 Summary: Creates a common metadata repository
 Name: createrepo
 Version: 0.9.5
-Release: 2%{?dist}
+Release: 5%{?dist}
 License: GPLv2
 Group: System Environment/Base
 Source: %{name}-%{version}.tar.gz
 Patch0: ten-changelog-limit.patch
 Patch1:	empty-pkgid-raise.patch
+Patch2:	atomic-cache-checksum.patch
 URL: http://linux.duke.edu/projects/metadata/
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArchitectures: noarch
@@ -24,6 +25,7 @@
 %setup -q
 %patch0 -p0
 %patch1 -p0
+%patch2 -p1
 
 %build
 
@@ -45,6 +47,10 @@
 %{python_sitelib}/createrepo
 
 %changelog
+* Thu Oct  9 2008 James Antill <james at fedoraproject.org> - 0.9.5-5
+- Do atomic updates to the cachedir, for parallel runs
+- Fix the patch
+
 * Fri Feb 22 2008 Seth Vidal <skvidal at fedoraproject.org> - 0.9.5-2
 - patch for the mistake in the raise for an empty pkgid
 




More information about the fedora-extras-commits mailing list