]>
Commit | Line | Data |
---|---|---|
df78f748 MM |
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 | |
796b7867 | 7 | from config import ftp_dir,all_ftp_archs |
0bf1ad60 | 8 | import config |
df78f748 MM |
9 | import ftpio |
10 | ||
11 | if len(sys.argv) < 2: | |
749b120d | 12 | print "ERR: not enough parameters given" |
df78f748 MM |
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: | |
749b120d | 29 | print "ERR: %s tree already locked" % tree |
df78f748 MM |
30 | for i in locked: |
31 | ftpio.unlock(i) | |
32 | sys.exit(1) | |
33 | ||
34 | home=os.environ['HOME'] | |
35 | ||
36 | for tree in trees: | |
37 | print '-------------------------- %s --------------------------' % tree | |
796b7867 | 38 | for arch in all_ftp_archs: |
df78f748 | 39 | print 'ARCHITECTURE: %s' % arch |
0bf1ad60 MM |
40 | if config.old_poldek: |
41 | os.system('%s.stat/bin/poldek --cachedir=%s/tmp/poldek -c %.stat/etc/poldek.conf -s %s%s/%s/RPMS/ --mkidxz' % | |
42 | (ftp_dir,home,ftp_dir,ftp_dir,tree,arch)) | |
43 | else: | |
44 | os.system('%s.stat/bin/poldek --cachedir=%s/tmp/poldek --conf %s.stat/etc/poldek.conf -s %s%s/%s/RPMS/ --mkidxz --mkidx-type pdir' % | |
df78f748 MM |
45 | (ftp_dir,home,ftp_dir,ftp_dir,tree,arch)) |
46 | ||
47 | for tree in trees: | |
48 | ftpio.unlock(tree) | |
49 |