1 | #!/usr/bin/env python |
---|
2 | |
---|
3 | # feed this the results of 'tahoe catalog-shares' for all servers |
---|
4 | |
---|
5 | |
---|
6 | import sys |
---|
7 | |
---|
8 | chk_encodings = {} |
---|
9 | sdmf_encodings = {} |
---|
10 | sdmf_versions = {} |
---|
11 | |
---|
12 | for catalog in sys.argv[1:]: |
---|
13 | for line in open(catalog, "r").readlines(): |
---|
14 | line = line.strip() |
---|
15 | pieces = line.split() |
---|
16 | if pieces[0] == "CHK": |
---|
17 | ftype, si, kN, size, ueb_hash, expiration, filename = pieces |
---|
18 | if si not in chk_encodings: |
---|
19 | chk_encodings[si] = (set(), set()) |
---|
20 | chk_encodings[si][0].add( (si, kN) ) |
---|
21 | chk_encodings[si][1].add( line ) |
---|
22 | if pieces[0] == "SDMF": |
---|
23 | ftype, si, kN, size, ver, expiration, filename = pieces |
---|
24 | if si not in sdmf_encodings: |
---|
25 | sdmf_encodings[si] = (set(), set()) |
---|
26 | sdmf_encodings[si][0].add( (si, kN) ) |
---|
27 | sdmf_encodings[si][1].add( line ) |
---|
28 | if si not in sdmf_versions: |
---|
29 | sdmf_versions[si] = (set(), set()) |
---|
30 | sdmf_versions[si][0].add( ver ) |
---|
31 | sdmf_versions[si][1].add( line ) |
---|
32 | |
---|
33 | del si |
---|
34 | chk_multiple_encodings = [(si,lines) |
---|
35 | for si,(encodings,lines) in chk_encodings.items() |
---|
36 | if len(encodings) > 1] |
---|
37 | chk_multiple_encodings.sort() |
---|
38 | sdmf_multiple_encodings = [(si,lines) |
---|
39 | for si,(encodings,lines) in sdmf_encodings.items() |
---|
40 | if len(encodings) > 1 |
---|
41 | ] |
---|
42 | sdmf_multiple_encodings.sort() |
---|
43 | sdmf_multiple_versions = [(si,lines) |
---|
44 | for si,(versions,lines) in sdmf_versions.items() |
---|
45 | if len(versions) > 1] |
---|
46 | sdmf_multiple_versions.sort() |
---|
47 | |
---|
48 | if chk_multiple_encodings: |
---|
49 | print() |
---|
50 | print("CHK multiple encodings:") |
---|
51 | for (si,lines) in chk_multiple_encodings: |
---|
52 | print(" " + si) |
---|
53 | for line in sorted(lines): |
---|
54 | print(" " + line) |
---|
55 | if sdmf_multiple_encodings: |
---|
56 | print() |
---|
57 | print("SDMF multiple encodings:") |
---|
58 | for (si,lines) in sdmf_multiple_encodings: |
---|
59 | print(" " + si) |
---|
60 | for line in sorted(lines): |
---|
61 | print(" " + line) |
---|
62 | if sdmf_multiple_versions: |
---|
63 | print() |
---|
64 | print("SDMF multiple versions:") |
---|
65 | for (si,lines) in sdmf_multiple_versions: |
---|
66 | print(" " + si) |
---|
67 | for line in sorted(lines): |
---|
68 | print(" " + line) |
---|