extras-buildsys/utils/pushscript RepoPrune.py,1.6,1.7

Michael Schwendt mschwendt at fedoraproject.org
Thu Nov 6 12:16:45 UTC 2008


Author: mschwendt

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

Modified Files:
	RepoPrune.py 
Log Message:
- update for 'development' repo layout, especially the separate debug repo here must be handled as a separate source of rpms
- append std pushscript module main function
- add --dry-run option



Index: RepoPrune.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/pushscript/RepoPrune.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- RepoPrune.py	29 Oct 2007 14:16:03 -0000	1.6
+++ RepoPrune.py	6 Nov 2008 12:16:45 -0000	1.7
@@ -21,8 +21,7 @@
 
 import Utils
 
-DEBUG = False
-Utils.setdebug(DEBUG)
+dryrun = False
 
 def pruneRepo(keep,whitelist,srcdir,bindirlist):
     ts = rpmUtils.transaction.initReadOnlyTransaction()
@@ -93,7 +92,7 @@
         for (f,n,e,v,r) in oldies:
             print '  Removing', os.path.basename(f)
             srcfiles.remove(f)
-            if not DEBUG:
+            if not dryrun:
                 os.remove(f)
             changed = True
 
@@ -120,7 +119,7 @@
                     continue
                 if not os.path.join(srcdir,sourcerpm) in srcfiles:
                     print '  Removing', f
-                    if not DEBUG:
+                    if not dryrun:
                         os.remove(fullname)
                     changed = True
     return changed
@@ -142,27 +141,32 @@
         keep = (dist == 'development') and 1 or 2
         whitelist = keepdict
     
-    srcdir = os.path.join(cfg.treedir,dist,'SRPMS')
+    srcdir = Utils.srpm_repodir(cfg,dist)
     bindirs = []
     for arch in cfg.archdict[dist]:  # list of repo archs
-        bindirs.append(os.path.join(cfg.treedir,dist,arch))
-        
+        bindirs.append( Utils.rpm_repodir(cfg,dist,arch) )
+        if dist == 'development':  # hack for rawhide/releases repo path scheme
+            bindirs.append( Utils.debug_repodir(cfg,dist,arch) )
     return pruneRepo(keep,whitelist,srcdir,bindirs)
 
 
 if __name__ == '__main__':
+    dryrun = ('--dry-run' in sys.argv)
+    if dryrun:
+        sys.argv.remove('--dry-run')
+
     if len(sys.argv) < 3:
-        print 'Usage: %s <project> <release> [release]...\n' % os.path.basename(sys.argv[0])
+        print 'Usage: %s [--dry-run] <project> <release> [release]...\n' % os.path.basename(sys.argv[0])
         sys.exit(errno.EINVAL)
-
+    
     cfg = Utils.load_config_module(sys.argv[1])
 
+    me = os.getcwd()
     Utils.signer_gid_check(cfg.signersgid)
     os.umask(cfg.signersumask)
-    
     for dist in sys.argv[2:]:
         if not cfg.archdict.has_key(dist):
             print "No distribution release named '%s' found" % dist
-            sys.exit(errno.EINVAL)
+            continue
         main(cfg,dist)
-    sys.exit(0)
+    os.chdir(me)




More information about the fedora-extras-commits mailing list