File: RapidInfos.py

package info (click to toggle)
spring 106.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 55,316 kB
  • sloc: cpp: 543,954; ansic: 44,800; python: 12,575; java: 12,201; awk: 5,889; sh: 1,796; asm: 1,546; xml: 655; perl: 405; php: 211; objc: 194; makefile: 76; sed: 2
file content (44 lines) | stat: -rwxr-xr-x 951 bytes parent folder | download | duplicates (6)
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
#!/usr/bin/env python

#prints all stable / test tag in a rapid dir

import gzip,sys,os

# returns all stable tags
def getTags(filename):
	tags = {}
	lines = gzip.open(filename).readlines()
	for line in lines:
		line = line.strip("\r\n")
		items = line.split(",")
		if len(items) < 1:
			continue
		tag = items[0]
		if len(tag.split(':')) == 3:
			continue
		tags[items[0]] = items[3]
	return tags

def getfiles(dirname):
	tags = {}
	for f in os.listdir(dirname):
		if f != "versions.gz":
			continue
		filename = os.path.join(dirname, f)
		if os.path.isfile(filename):
			tags.update(getTags(filename))
	return tags

rootdir = sys.argv[1]
tags = {}
for d in os.listdir(rootdir):
	repodir = os.path.join(rootdir, d)
	if os.path.isdir(repodir):
		tags.update(getfiles(repodir))

print("<table>")
print("<tr><td>Tag</td><td>Name</td></tr>")
for tag in sorted(tags.items()):
	print("<tr><td>%s</td><td>%s</td></tr>" %(tag[0], tag[1]))
print("</table>")