extras-buildsys/utils ExtrasMultiLib.py, 1.10, 1.11 ExtrasPushUtils.py, 1.8, 1.9

Michael Schwendt (mschwendt) fedora-extras-commits at redhat.com
Tue Sep 19 23:34:11 UTC 2006


Author: mschwendt

Update of /cvs/fedora/extras-buildsys/utils
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv26008

Modified Files:
	ExtrasMultiLib.py ExtrasPushUtils.py 
Log Message:
Fix mdcache group-access privilege problems also here, because
they break utime in urlgrabber here, too.

Re-use the work-around from Extras repoclosure report script.
New function in ExtrasPushUtils: fix_mdcache_access(workdir,cachedir)




Index: ExtrasMultiLib.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/ExtrasMultiLib.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ExtrasMultiLib.py	19 Sep 2006 16:13:17 -0000	1.10
+++ ExtrasMultiLib.py	19 Sep 2006 23:34:09 -0000	1.11
@@ -306,6 +306,7 @@
         else:
             repo.enable()
     my.repos.setCacheDir(cachedir)
+    fix_mdcache_access(rundir,cachedir)
     try:
         print 'Reading metadata...'
         my.readMetadata()


Index: ExtrasPushUtils.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/ExtrasPushUtils.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ExtrasPushUtils.py	19 Sep 2006 09:58:46 -0000	1.8
+++ ExtrasPushUtils.py	19 Sep 2006 23:34:09 -0000	1.9
@@ -18,6 +18,7 @@
 import errno
 import os, sys
 import shutil
+import stat, tempfile
 
 signersgid = 100581  # signers group
 
@@ -148,3 +149,36 @@
     create_repository( os.path.join(treedir,dist,'SRPMS') )
 
 
+def fix_mdcache_access(workdir,cachedir):
+# Work around explicit mode 0755 in yum/repos.py and an utime access
+# denied problem in urlgrabber.
+# We copy the mdcache tree to a temporary directory in order to
+# become the owner of all files, then remove the copied tree and fix
+# up directory modes. For this to work flawlessly, all files must be
+# readable by our group.
+    try:
+        tmpdir = tempfile.mkdtemp('','.mdcache.tmp',workdir)
+        if tmpdir == workdir: # paranoid, should never happen
+            raise Exception
+    except:
+        sys.exit(errno.EIO)
+    if os.path.isdir(cachedir):
+        tmpcachedir = os.path.join(tmpdir,'mdcache')
+        try:
+            shutil.copytree(src=cachedir,dst=tmpcachedir,symlinks=True)
+        except:
+            print 'FATAL ERROR: mdcache copytree failed'
+            print '%s must be writable\n%s must be readable' % (workdir, cachedir)
+            shutil.rmtree(tmpdir)
+            sys.exit(1)
+        for root, dirs, files in os.walk(tmpcachedir):
+            for file in files:
+                fullpath = os.path.join(root,file)
+                filemode = stat.S_IMODE( os.stat(fullpath).st_mode )
+                filemode |= stat.S_IWGRP
+                os.chmod(fullpath,filemode)
+        shutil.rmtree(cachedir)
+        shutil.move(src=tmpcachedir,dst=cachedir)
+        shutil.rmtree(tmpdir)
+
+




More information about the scm-commits mailing list