Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathdated-packages
More file actions
Latest commit
executable file
·77 lines (55 loc) · 1.61 KB
/
Copy pathdated-packages
File metadata and controls
executable file
·77 lines (55 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/python
importos
importos.path
importsys
importtime
frompisi.specfileimportSpecFile
SUCCESS, FAIL=xrange(2)
defisExpired(date, days):
diff=time.time() -time.mktime(time.strptime(date, '%Y-%m-%d'))
secs=60*60*24*days
returndiff>secs
defgetSpecs(folder):
specs= []
forroot, dirs, filesinos.walk(folder):
if'pspec.xml'infiles:
specs.append(root)
if'.svn'indirs:
dirs.remove('.svn')
returnspecs
defmain():
iflen(sys.argv) !=3:
print'Usage: %s repo-path [-]days'%sys.argv[0]
returnFAIL
ifnotos.path.isdir(sys.argv[1]):
print'Repo path is not valid.'
returnFAIL
days=sys.argv[2]
revert=days[0] =='-'
ifrevert:
days=days[1:]
ifnotdays.isdigit():
print'Days must be integer.'
returnFAIL
repopath=sys.argv[1]
days=int(days)
errors= []
forpackagediringetSpecs(repopath):
shortpath='%s/pspec.xml'%packagedir[len(repopath):]
specfile=SpecFile(os.path.join(packagedir, 'pspec.xml'))
date=specfile.history[0].date
try:
expired=isExpired(date, days)
exceptValueError:
errors.append('Invalid date: %s (%s)'% (shortpath, date))
continue
if (notrevertandexpired) or (revertandnotexpired):
print'%s %s'% (date, shortpath)
iflen(errors):
print
print'Errors:'
foreinerrors:
print' ', e
returnSUCCESS
if__name__=='__main__':
sys.exit(main())