extras-buildsys/utils extras-push-new,1.4,1.5

Michael Schwendt (mschwendt) fedora-extras-commits at redhat.com
Wed May 10 15:13:10 UTC 2006


Author: mschwendt

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

Modified Files:
	extras-push-new 
Log Message:
- sync twice: before and after running repoview (which takes so long)
- use splitlines() when reading the pkglist file and be more explicit
  about which error conditions are harmless
- add option -f (=force) which re-runs repobuild/repoview for all dists
- update SYNTAX help
- update group check message




Index: extras-push-new
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/extras-push-new,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- extras-push-new	6 May 2006 23:38:31 -0000	1.4
+++ extras-push-new	10 May 2006 15:13:08 -0000	1.5
@@ -51,7 +51,9 @@
            'repoclosure' : False,
            'gidcheck' : True,
            'setumask' : True,
-           'mail' : True
+           'mail' : True,
+           'doublesync' : True,
+           'force' : False
            }
 
 alldists = [ 'development', '5', '4', '3' ]
@@ -132,15 +134,12 @@
 def getlinesfromrunfile(dist):
     runfilename = getrunfilename(dist)
     pkglist = []
-    if os.path.isfile(runfilename):
-        try:
-            rundirfile = open(runfilename,'r')
-            for line in rundirfile:
-                pkglist.append( line.rstrip() )
-            rundirfile.close()
-        except IOError:
-            print 'ERROR: Could not open %s' % runfilename
-            sys.exit(5)
+    try:
+        pkglist = file(runfilename).read().splitlines()
+    except IOError, (errno, strerr):
+        if errno != 2:  # everything but file_not_found is unexpected
+            print 'ERROR: %s: %s' % (strerr,runfilename)
+            sys.exit(errno)
     return pkglist
 
 
@@ -199,6 +198,7 @@
             filedict[which].append(fullfile)
     return filedict
 
+
 def naevr(pkg):
     """return nevra from the package srpm"""
 
@@ -416,14 +416,18 @@
 if __name__ == '__main__':
     if config['gidcheck']:
         if os.getgid() != signersgid:
-            print 'ERROR: Change into extras_signers group!'
+            print 'ERROR: Change into extras_signers group before running this!  Use "newgrp extras_signers".'
             sys.exit(13)
 
     if config['setumask']:
         os.umask(0002)
+
+    if '-f' in sys.argv[1:]:
+        sys.argv.remove('-f')
+        config['force'] = True
     
     if len(sys.argv) < 2:
-        print 'SYNTAX: %s <dist> [dist]...' % sys.argv[0]
+        print 'SYNTAX: %s <dist|all> [dist]...' % sys.argv[0]
         sys.exit(22)
     
     dists = []  # the list of distribution release we want to push
@@ -455,15 +459,26 @@
         if result and result != 4: # 4 = no packages to sign
             sys.exit(result)
 
-    for dist in dists:
-        # Process all dists for which we find a run-file which contains >= 1 pkg names.
-        pkglist = getlinesfromrunfile(dist)
-        if len(pkglist):
+    # Option -f re-runs repobuild/repoview for all dists, even if
+    # no new packages have been pushed for a dist.
+    changed = dists
+    if config['force']:
+        changed = alldists
+
+    # len(getlinesfromrunfile(dist)) is the number of packages
+    # per dist which have been pushed.
+
+    for dist in changed:
+        if config['force'] or len( getlinesfromrunfile(dist) ):
             run_and_check('extras-repobuild.py %s' % dist)
+
+    if config['doublesync']:
+        run_and_check('extras-sync')
+
+    for dist in changed:
+        if config['force'] or len( getlinesfromrunfile(dist) ):
             if config['repoview']:
                 run_and_check('extras-repoview.py %s' % dist)
-            if config['repoclosure']:
-                pass
 
     run_and_check('extras-sync')
 




More information about the fedora-extras-commits mailing list