extras-buildsys/utils extras-repomanage.py, NONE, 1.1 extras-repobuild.py, 1.24, 1.25

Michael Schwendt (mschwendt) fedora-extras-commits at redhat.com
Sun Sep 17 19:44:36 UTC 2006


Author: mschwendt

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

Modified Files:
	extras-repobuild.py 
Added Files:
	extras-repomanage.py 
Log Message:
All this takes way too much processing-time. So we split into two
scripts for now.



--- NEW FILE extras-repomanage.py ---
#!/usr/bin/python -t
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

import os, sys

#sys.path.append('/srv/extras-push/work/buildsys-utils')
from ExtrasPushUtils import *

# packages to exclude from being repomanaged: dist => shell quoted path regexp
keepdict = {'3': "'/\([^/]\+-\)\?kmod-'",
            '4': "'/\([^/]\+-\)\?kmod-'",
            '5': "'/\([^/]\+-\)\?kmod-'",
            'development': "'/\([^/]\+-\)\?kmod-'",
            }

DEBUG = False
setdebug(DEBUG)

def do_repo_stuff(repodir, keep=2, nomanage=None):
    print 'Processing: %s' % repodir
    print 'cleaning up older packages (keeping %d latest)' % (keep)
    repomanage = '/usr/bin/repomanage -c -k%d -o %s' % (keep, repodir)
    if nomanage:
        cmd = '%s | grep -v %s | xargs rm -f' % (repomanage, nomanage)
    else:
        cmd = '%s | xargs rm -f' % repomanage
    run_and_check(cmd)
        

def main(dist):
    if not archdict.has_key(dist):
        print "No Distribution named %s found" % dist
        sys.exit(1)
    distdir = '%s-%s-%s' % (distro, dist, project)
    destdir = os.path.join(treedir, dist)
    keep = (dist == 'development') and 1 or 2

    do_repo_stuff(os.path.join(destdir, 'SRPMS'), keep, keepdict.get(dist))

    # arch repo creation
    for arch in archdict[dist]:
        repodir = os.path.join(destdir, arch)
        do_repo_stuff(repodir, keep, keepdict.get(dist))


if __name__ == '__main__':
    me = os.getcwd()
    signer_gid_check()
    if len(sys.argv) < 2:
        print "Usage:\nextras-repomanage.py release\n\n"
        sys.exit(1)
    main(sys.argv[1])
    os.chdir(me)
    


Index: extras-repobuild.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/extras-repobuild.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- extras-repobuild.py	20 Aug 2006 23:13:19 -0000	1.24
+++ extras-repobuild.py	17 Sep 2006 19:44:33 -0000	1.25
@@ -19,61 +19,38 @@
 #sys.path.append('/srv/extras-push/work/buildsys-utils')
 from ExtrasPushUtils import *
 
-# get the path to where to look for the packages to be signed
-# make repo
-# make repoview
-# email to fedora-extras-list with the built packages list
-# sing, dance, romance
-
 cachedir = '/tmp/repomd-cache'
 compsname = 'comps.xml'
 
-# packages to exclude from being repomanaged: dist => shell quoted path regexp
-keepdict = {'3': "'/\([^/]\+-\)\?kmod-'",
-            '4': "'/\([^/]\+-\)\?kmod-'",
-            '5': "'/\([^/]\+-\)\?kmod-'",
-            'development': "'/\([^/]\+-\)\?kmod-'",
-            }
-
 DEBUG = False
 setdebug(DEBUG)
 
-def do_repo_stuff(repodir, keep=2, nomanage=None):
+def do_repo_stuff(repodir):
     compspath = os.path.join(repodir, compsname)
-    rpdata = os.path.join(repodir, 'repodata')
-    debugprint('removing tree %s' % rpdata)
 
-    if os.path.exists(rpdata) and not DEBUG:
-        shutil.rmtree(rpdata)
+	# Why remove the repodata dir? Isn't that entirely createrepo's work?
+    #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 'cleaning up older packages (keeping %d latest)' % (keep)
-    repomanage = '/usr/bin/repomanage -c -k%d -o %s' % (keep, repodir)
-    if nomanage:
-        cmd = '%s | grep -v %s | xargs rm -f' % (repomanage, nomanage)
-    else:
-        cmd = '%s | xargs rm -f' % repomanage
-    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)
-    
     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)
-
+#        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)            
 
@@ -84,14 +61,14 @@
         sys.exit(1)
     distdir = '%s-%s-%s' % (distro, dist, project)
     destdir = os.path.join(treedir, dist)
-    keep = (dist == 'development') and 1 or 2
 
-    do_repo_stuff(os.path.join(destdir, 'SRPMS'), keep, keepdict.get(dist))
+    do_repo_stuff(os.path.join(destdir, 'SRPMS'))
 
     # arch repo creation
     for arch in archdict[dist]:
         repodir = os.path.join(destdir, arch)
-        do_repo_stuff(repodir, keep, keepdict.get(dist))
+        do_repo_stuff(repodir)
+
 
 if __name__ == '__main__':
     me = os.getcwd()




More information about the scm-commits mailing list