pld-ftp-admin: scripts/gen-indexes.py - add rpmrepo support, summertic --rp...

glen glen at pld-linux.org
Fri Nov 14 15:05:43 CET 2008


Author: glen                         Date: Fri Nov 14 14:05:43 2008 GMT
Module: pld-ftp-admin                 Tag: HEAD
---- Log message:
- add rpmrepo support, summertic --rpmrepo, etc options

---- Files affected:
pld-ftp-admin/scripts:
   gen-indexes.py (1.22 -> 1.23) 

---- Diffs:

================================================================
Index: pld-ftp-admin/scripts/gen-indexes.py
diff -u pld-ftp-admin/scripts/gen-indexes.py:1.22 pld-ftp-admin/scripts/gen-indexes.py:1.23
--- pld-ftp-admin/scripts/gen-indexes.py:1.22	Fri Aug 29 09:46:46 2008
+++ pld-ftp-admin/scripts/gen-indexes.py	Fri Nov 14 15:05:38 2008
@@ -10,23 +10,33 @@
 import ftpio
 
 try:
-    opts, args = getopt.getopt(sys.argv[1:], None, ["nopoldek", "noyum"])
+    opts, args = getopt.getopt(sys.argv[1:], None, ["nopoldek", "noyum", "norpmrepo", "poldek", "yum", "rpmrepo"])
 except getopt.GetoptError:
     print "ERR: not enough parameters given"
-    print "gen-indexes.py [--nopoldek] [--noyum] tree [tree2...]"
+    print "gen-indexes.py [--[no]poldek] [--[no]yum] [--[no]rpmrepo] tree [tree2...]"
     sys.exit(1)
 
 do_poldek = True
 do_yum = True
+do_rpmrepo = False
 
 for o, a in opts:
     if o == "--nopoldek":
         do_poldek = False
     if o == "--noyum":
         do_yum = False
+    if o == "--norpmrepo":
+        do_rpmrepo = False
 
-if not do_poldek and not do_yum:
-    print "ERR: option --nopoldek conflicts with --noyum"
+    if o == "--poldek":
+        do_poldek = True
+    if o == "--yum":
+        do_yum = True
+    if o == "--rpmrepo":
+        do_rpmrepo = True
+
+if not do_poldek and not do_yum and not do_rpmrepo:
+    print "ERR: speciy at least one action"
     sys.exit(1)
 
 trees=args
@@ -56,7 +66,7 @@
     for tree in trees:
         print '-------------------------- %s --------------------------' % tree
         for arch in all_ftp_archs:
-            print 'ARCHITECTURE: %s' % arch
+            print 'generate poldek index for %s' % arch
             if config.old_poldek:
                 os.system('%s.stat/bin/poldek --cachedir=%s/tmp/poldek -c %s.stat/etc/poldek.conf -s %s%s/%s/RPMS/ --mkidxz' %
                     (ftp_dir,home,ftp_dir,ftp_dir,tree,arch))
@@ -69,15 +79,23 @@
                             (ftp_dir,home,ftp_dir,ftp_dir,tree,arch))
 
 if do_yum:
-    os.system('cd %s.stat/repodata && cvs up comps.xml' % ftp_dir)
+    os.system('set -x; cd %s.stat/repodata && cvs up comps.xml' % ftp_dir)
     for tree in trees:
         print '-------------------------- %s --------------------------' % tree
         for arch in all_ftp_archs:
-            print 'ARCHITECTURE: %s' % arch
+            print 'generate repodata for %s using createrepo' % arch
             # Creating indexes for yum and other supporting xml repodata.
-            os.system('%s.stat/bin/createrepo -d -g %s.stat/repodata/comps.xml --cache %s/tmp/createrepo/%s-%s %s%s/%s/RPMS' %
+            os.system('time %s.stat/bin/createrepo -d -g %s.stat/repodata/comps.xml --cache %s/tmp/createrepo/%s-%s %s%s/%s/RPMS' %
                     (ftp_dir,ftp_dir,home,tree,arch,ftp_dir,tree,arch))
 
+if do_rpmrepo:
+    os.system('set -x; cd %s.stat/repodata && cvs up comps.xml' % ftp_dir)
+    for tree in trees:
+        print '-------------------------- %s --------------------------' % tree
+        for arch in all_ftp_archs:
+            dir = '%s/%s/%s/RPMS' % (ftp_dir, tree, arch)
+            print 'generate repodata for %s using rpmrepo (in %s)' % (arch, dir)
+            os.system('time rpmrepo %s -o %s' % (dir, dir))
+
 for tree in trees:
     ftpio.unlock(tree)
-
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/pld-ftp-admin/scripts/gen-indexes.py?r1=1.22&r2=1.23&f=u



More information about the pld-cvs-commit mailing list