]> git.pld-linux.org Git - projects/pld-ftp-admin.git/blob - bin/pfa-genindex
382bcb08d843c63178fd8111d159580cc85c46d0
[projects/pld-ftp-admin.git] / bin / pfa-genindex
1 #!/usr/bin/env python
2 # vi: encoding=utf-8 ts=8 sts=4 sw=4 et
3
4 import sys, os
5 sys.path.insert(0, os.environ['HOME']+'/pld-ftp-admin/modules')
6 from common import checkdir
7 from config import ftp_dir,all_ftp_archs
8 import config
9 import ftpio
10
11 if len(sys.argv) < 2:
12     print "ERR: not enough parameters given"
13     print "gen-indexes.py tree [tree2...]"
14     sys.exit(1)
15
16 trees=sys.argv[1:]
17
18 for tree in trees:
19     checkdir(tree)
20
21 ftpio.connect('gen-indexes')
22
23 locked=[]
24
25 for tree in trees:
26     if ftpio.lock(tree, True):
27         locked.append(tree)
28     else:
29         print "ERR: %s tree already locked" % tree
30         for i in locked:
31             ftpio.unlock(i)
32         sys.exit(1)
33
34 home=os.environ['HOME']
35
36 os.umask(022)
37
38 for tree in trees:
39     print '-------------------------- %s --------------------------' % tree
40     for arch in all_ftp_archs:
41         print 'ARCHITECTURE: %s' % arch
42         if config.old_poldek:
43             os.system('%s.stat/bin/poldek --cachedir=%s/tmp/poldek -c %s.stat/etc/poldek.conf -s %s%s/%s/RPMS/ --mkidxz' %
44                 (ftp_dir,home,ftp_dir,ftp_dir,tree,arch))
45         else:
46             if config.poldek_indexes != "old":
47                 os.system('%s.stat/bin/poldek-new --cachedir=%s/tmp/poldek --conf %s.stat/etc/poldek.conf -s %s%s/%s/RPMS/ --mkidxz --mkidx-type pndir' %
48                         (ftp_dir,home,ftp_dir,ftp_dir,tree,arch))
49             if config.poldek_indexes != "new":
50                 os.system('%s.stat/bin/poldek-new --cachedir=%s/tmp/poldek --conf %s.stat/etc/poldek.conf -s %s%s/%s/RPMS/ --mkidxz --mkidx-type pdir' %
51                         (ftp_dir,home,ftp_dir,ftp_dir,tree,arch))
52
53 for tree in trees:
54     ftpio.unlock(tree)
55
This page took 0.034273 seconds and 2 git commands to generate.