]>
Commit | Line | Data |
---|---|---|
074b4414 MM |
1 | # vi: encoding=utf-8 ts=8 sts=4 sw=4 et |
2 | ||
3 | from config import config, init_conf | |
97c8f39c MM |
4 | import path |
5 | import os | |
6 | import time | |
7 | import util | |
8 | ||
9 | def clean_dir(path, max): | |
10 | curtime=time.time() | |
11 | for i in os.listdir(path): | |
12 | if curtime - os.path.getmtime(path+'/'+i) > max: | |
13 | if os.path.isdir(path+'/'+i): | |
14 | print "rmdir: %s" % path+'/'+i | |
15 | else: | |
16 | print "rmfile: %s" % path+'/'+i | |
074b4414 MM |
17 | |
18 | def handle_src(): | |
97c8f39c | 19 | clean_dir(path.www_dir+'srpms', 2592000) # a month |
074b4414 MM |
20 | |
21 | def handle_bin(): | |
97c8f39c | 22 | pass |
074b4414 MM |
23 | |
24 | if __name__ == '__main__': | |
25 | init_conf() | |
26 | bb=config.binary_builders[:] | |
97c8f39c | 27 | clean_dir(path.spool_dir+'builds', config.max_keep_time) |
074b4414 MM |
28 | if config.src_builder: |
29 | try: | |
30 | init_conf(config.src_builder) | |
31 | except: | |
32 | pass | |
33 | else: | |
34 | handle_src() | |
35 | for b in bb: | |
36 | try: | |
37 | init_conf(b) | |
38 | except: | |
39 | continue | |
40 | else: | |
41 | handle_bin() | |
42 |