extras-buildsys/utils extras-repobuild.py,1.5,1.6

Seth Vidal (skvidal) fedora-extras-commits at redhat.com
Wed Nov 2 16:55:00 UTC 2005


Author: skvidal

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

Modified Files:
	extras-repobuild.py 
Log Message:

more unnecessary code reduction



Index: extras-repobuild.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/extras-repobuild.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- extras-repobuild.py	2 Nov 2005 14:46:45 -0000	1.5
+++ extras-repobuild.py	2 Nov 2005 16:54:58 -0000	1.6
@@ -49,71 +49,68 @@
             print >> sys.stderr, 'Error running command: %s ' % cmd
             sys.exit(result)
 
-def main(dist):
-    if not archdict.has_key(dist):
-        print "No Distribution named %s found" % dist
-        sys.exit(1)
-    distdir = 'fedora-%s-extras' % dist        
-    destdir = os.path.join(treedir, dist)
-
 
-    print "Making Repository Metadata"
-    # SRPM repo creation
-    repodir = os.path.join(destdir, 'SRPMS')
+def do_repo_stuff(repodir):
+    compspath = os.path.join(repodir, compsname)
     rpdata = os.path.join(repodir, 'repodata')
     debugprint('removing tree %s' % rpdata)
-    if not DEBUG:
-        if os.path.exists(rpdata): shutil.rmtree(rpdata)
 
+    if not DEBUG:        
+        if os.path.exists(rpdata): shutil.rmtree(rpdata)
+    
+    print 'processing: %s' % repodir
     print 'Cleaning up older packages'
     cmd = '/usr/bin/repomanage -k2 -o %s | xargs rm -f' % (repodir)
     run_and_check(cmd)
-
-    cmd = '/usr/bin/createrepo -c %s -q %s' % (cachedir, repodir)
-    run_and_check(cmd)    
         
-    cmd = '/usr/bin/repoview %s' % repodir
-    run_and_check(cmd)        
+    print 'Creating repository metadata'
+    if os.path.exists(compspath):
+        cmd = '/usr/bin/createrepo -c %s -q -g %s -x *debuginfo* %s' % (cachedir, compsname, repodir)
+    else:
+        cmd = '/usr/bin/createrepo -c %s -q -x *debuginfo* %s' % (cachedir, repodir)
     
-    # arch repo creation
-    for arch in archdict[dist]:
-        repodir = os.path.join(destdir, arch)
-        compspath = os.path.join(repodir, compsname)
-        rpdata = os.path.join(repodir, 'repodata')
-        debugprint('removing tree %s' % rpdata)
-        if not DEBUG:        
-            if os.path.exists(rpdata): shutil.rmtree(rpdata)
-            
-        print 'Cleaning up older packages'
-        cmd = '/usr/bin/repomanage -k2 -o %s | xargs rm -f' % (repodir)
-        run_and_check(cmd)            
-            
-        if os.path.exists(compspath):
-            cmd = '/usr/bin/createrepo -c %s -q -g %s -x *debuginfo* %s' % (cachedir, compsname, repodir)
-        else:
-            cmd = '/usr/bin/createrepo -c %s -q -x *debuginfo* %s' % (cachedir, repodir)
-        run_and_check(cmd)            
-            
-        cmd = '/usr/bin/repoview %s' % repodir
-        run_and_check(cmd)            
-        
-        dbg_repodir = os.path.join(destdir, arch, 'debug')
-        dbg_rpdata = os.path.join(dbg_repodir, 'repodata')
-        debugprint('removing tree %s' % dbg_rpdata)
+    run_and_check(cmd)            
+    
+    print 'Generating repoview'
+    cmd = '/usr/bin/repoview %s' % repodir
+    run_and_check(cmd)            
+
+    # if there's a debug subdir, make that a repo, too.
+    dbg_repodir = os.path.join(destdir, arch, 'debug')
+    dbg_rpdata = os.path.join(dbg_repodir, 'repodata')
+    debugprint('removing tree %s' % dbg_rpdata)
+
+    if os.path.exists(dbg_rpdata):
         if not DEBUG:
-            if os.path.exists(dbg_rpdata): shutil.rmtree(dbg_rpdata)
-        
+            shutil.rmtree(dbg_rpdata)
+        print 'processing debug packages'
         print 'Cleaning up older packages'
         cmd = '/usr/bin/repomanage -k2 -o %s | xargs rm -f' % (repodir)
         run_and_check(cmd)                    
-
+    
         cmd = '/usr/bin/createrepo -c %s -q %s' % (cachedir, dbg_repodir)
         run_and_check(cmd)            
             
         cmd = '/usr/bin/repoview %s' % dbg_repodir
         run_and_check(cmd)                    
-            
-    
+
+
+def main(dist):
+    if not archdict.has_key(dist):
+        print "No Distribution named %s found" % dist
+        sys.exit(1)
+    distdir = 'fedora-%s-extras' % dist        
+    destdir = os.path.join(treedir, dist)
+
+    print "Making Repository Metadata"
+
+    do_repo_stuff(repodir)
+
+    # arch repo creation
+    for arch in archdict[dist]:
+        repodir = os.path.join(destdir, arch)
+        do_repo_stuff(repodir)
+
 if __name__ == '__main__':
     me = os.getcwd()
     if len(sys.argv) < 2:




More information about the fedora-extras-commits mailing list