extras-buildsys/utils ExtrasPushUtils.py, 1.5, 1.6 extras-repobuild.py, 1.27, 1.28

Michael Schwendt (mschwendt) fedora-extras-commits at redhat.com
Tue Sep 19 09:42:25 UTC 2006


Author: mschwendt

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

Modified Files:
	ExtrasPushUtils.py extras-repobuild.py 
Log Message:
- move do_repo_stuff() functionality into ExtrasPushUtils module:

new functions:
create_repository(repodir) : runs createrepo for a given path including
comps.xml if it exists

create_arch_repo(repodir) : runs create_repository(...) and runs it
once more if a "debug" sub-directory exists




Index: ExtrasPushUtils.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/ExtrasPushUtils.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ExtrasPushUtils.py	21 Aug 2006 20:42:55 -0000	1.5
+++ ExtrasPushUtils.py	19 Sep 2006 09:42:22 -0000	1.6
@@ -35,6 +35,9 @@
             'development':['ppc','x86_64','i386'],
             }
 
+cr_cachedir = '/tmp/repomd-cache'  # createrepo cachedir
+compsname = 'comps.xml'
+
 DEBUG = False
 
 def setdebug(onoff):
@@ -107,3 +110,35 @@
         print 'WARNING: Linking failed (%s), trying to copy...' % e
     if not linked:
         install_copy(src,dest)
+
+
+def create_repository(repodir):
+    """create/update repository metadata for a given directory"""
+
+    print 'Creating repository %s' % repodir
+    
+    # TODO: Why remove the repodata dir? Isn't that entirely createrepo's
+    # work? (also further below for "debug")
+    # ? -> https://devel.linux.duke.edu/bugzilla/show_bug.cgi?id=595
+    rpdata = os.path.join(repodir, 'repodata')
+    debugprint('removing tree %s' % rpdata)
+    if os.path.exists(rpdata) and not DEBUG:
+        shutil.rmtree(rpdata)
+    
+    compsarg = ''
+    if os.path.exists( os.path.join(repodir,compsname) ):
+        compsarg = '-g %s ' % compsname
+    cmd = '/usr/bin/createrepo -c %s -q %s -x \'*debuginfo*\' %s' % (cr_cachedir, compsarg, repodir)
+    run_and_check(cmd)            
+
+
+def create_arch_repo(repodir):
+    """create/update repository metadata for a given directory and
+its 'debug' sub-directory, if available"""
+    create_repository(repodir)
+    # If there's a debug subdir, make that a repo, too.
+    dbg_repodir = os.path.join(repodir, 'debug')
+    if os.path.exists(dbg_repodir):
+        create_repository(dbg_repodir)
+
+


Index: extras-repobuild.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/extras-repobuild.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- extras-repobuild.py	17 Sep 2006 20:28:14 -0000	1.27
+++ extras-repobuild.py	19 Sep 2006 09:42:22 -0000	1.28
@@ -14,49 +14,11 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 import os, sys
-import shutil
-
-#sys.path.append('/srv/extras-push/work/buildsys-utils')
 from ExtrasPushUtils import *
 
-cachedir = '/tmp/repomd-cache'
-compsname = 'comps.xml'
-
 DEBUG = False
 setdebug(DEBUG)
 
-def do_repo_stuff(repodir):
-    compspath = os.path.join(repodir, compsname)
-
-    # Why remove the repodata dir? Isn't that entirely createrepo's work?
-    # (also further below for "debug")
-    # ? -> https://devel.linux.duke.edu/bugzilla/show_bug.cgi?id=595
-    rpdata = os.path.join(repodir, 'repodata')
-    debugprint('removing tree %s' % rpdata)
-    if os.path.exists(rpdata) and not DEBUG:
-        shutil.rmtree(rpdata)
-    
-    print 'Processing: %s' % repodir
-        
-    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)
-    run_and_check(cmd)            
-
-    # if there's a debug subdir, make that a repo, too.
-    dbg_repodir = os.path.join(repodir, 'debug')
-    if os.path.exists(dbg_repodir):
-        dbg_rpdata = os.path.join(dbg_repodir, 'repodata')
-        debugprint('removing tree %s' % dbg_rpdata)
-        if os.path.exists(dbg_rpdata) and not DEBUG:
-            shutil.rmtree(dbg_rpdata)
-        print 'creating metadata for debug packages'
-        cmd = '/usr/bin/createrepo -c %s -q %s' % (cachedir, dbg_repodir)
-        run_and_check(cmd)            
-
-
 def main(dist):
     if not archdict.has_key(dist):
         print "No Distribution named %s found" % dist
@@ -64,12 +26,12 @@
     distdir = '%s-%s-%s' % (distro, dist, project)
     destdir = os.path.join(treedir, dist)
 
-    do_repo_stuff(os.path.join(destdir, 'SRPMS'))
+    create_repository(os.path.join(destdir, 'SRPMS'))
 
     # arch repo creation
     for arch in archdict[dist]:
         repodir = os.path.join(destdir, arch)
-        do_repo_stuff(repodir)
+        create_arch_repo(repodir)
 
 
 if __name__ == '__main__':




More information about the fedora-extras-commits mailing list