extras-buildsys/utils/pushscript Utils.py, 1.29, 1.30 RepoBuild.py, 1.7, 1.8 Push.py, 1.61, 1.62

Michael Schwendt mschwendt at fedoraproject.org
Sun May 10 09:28:07 UTC 2009


Author: mschwendt

Update of /cvs/fedora/extras-buildsys/utils/pushscript
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv18019

Modified Files:
	Utils.py RepoBuild.py Push.py 
Log Message:
Add optional 'repomdsigncmds' dict to config file.

[Wanted to take the opportunity and merge dist-related options into one
section per dist (also to decrease redundancy), but it would not be that
much of a gain because not everything is configurable per dist - several
values are global per Config file.]



Index: Utils.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/pushscript/Utils.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- Utils.py	22 Mar 2009 10:01:17 -0000	1.29
+++ Utils.py	10 May 2009 09:28:06 -0000	1.30
@@ -205,8 +205,13 @@
             shutil.move(sourcefile,targetfile)
 
         _create_repository(cfg,dist,repodir,debuginfo)
-        
         _restore_repodata_dir(tmpdir,rpdata)
+
+        # Remove old detached GPG sig (if any).
+        signedrepomdfile = os.path.join(rpdata,'repomd.xml.asc')
+        if os.path.exists(signedrepomdfile):
+            os.remove(signedrepomdfile)
+
         shutil.rmtree(tmpdir)
     except:  # everything is bad at this point
         print 'ERROR: Exception during "safe createrepo". Cleaning up for exit.'


Index: RepoBuild.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/pushscript/RepoBuild.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- RepoBuild.py	7 Nov 2008 15:26:50 -0000	1.7
+++ RepoBuild.py	10 May 2009 09:28:06 -0000	1.8
@@ -43,6 +43,40 @@
                 os.symlink(cfg.repobuild_linkdict[dist][link], flink)
 
 
+def SignRepoMD(cfg,dist):
+    if not hasattr(cfg,'repomdsigncmds'):
+        return True
+    if dist in cfg.repomdsigncmds.keys():
+        signcmd = cfg.repomdsigncmds[dist]
+    else:  # dist repo not configured to be signed
+        return True
+
+    print "Signing repomd.xml files:"
+    paths = [Utils.srpm_repodir(cfg,dist)]
+    for arch in cfg.archdict[dist]:
+        paths.append(Utils.rpm_repodir(cfg,dist,arch))  # binary rpms
+        paths.append(Utils.debug_repodir(cfg,dist,arch))
+
+    for path in paths:
+        repomdfile = os.path.join(path,'repodata','repomd.xml')
+        signedfile = repomdfile+'.asc'
+        if os.path.exists(signedfile):
+            continue
+        while (True):
+            print repomdfile
+            result = os.system( '%s %s' % (signcmd,repomdfile) )
+            if not result:
+                break
+            while (True):
+                print 'Retry? (y/n)',
+                a = raw_input().lower()
+                if a=='n':
+                    return False
+                if a=='y':
+                    break
+    return True
+
+
 if __name__ == '__main__':
     if len(sys.argv) < 3:
         print 'Usage: %s <project> <release> [release]...\n' % os.path.basename(sys.argv[0])


Index: Push.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/pushscript/Push.py,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- Push.py	22 Mar 2009 10:01:17 -0000	1.61
+++ Push.py	10 May 2009 09:28:06 -0000	1.62
@@ -501,6 +501,12 @@
     for dist in changed:
         if cfg.opts.repoview:
             RepoView.main(cfg,dist)
+    
+    for dist in diststopush:
+        if not RepoBuild.SignRepoMD(cfg,dist):
+            print 'ERROR: Could not GPG sign repomd.xml files!'
+            lock.unlock()
+            sys.exit(1)
 
     if changed or mustfinish:
         Utils.run_and_check( getattr(cfg,'sync_cmd','') )




More information about the fedora-extras-commits mailing list