10
def missing(what, path):
11
print "E: %s %s is missing" % (what, path)
13
def compare(path, testpath):
14
if (path.endswith('.tar.gz') or path.endswith('.tar.bz2') or
15
path.endswith('.tar.xz')):
16
compare_bin(path, testpath)
17
elif path.endswith('.gz'):
18
compare_diff('zdiff', path, testpath)
19
elif path.endswith('.bz2'):
20
compare_diff('bzdiff', path, testpath)
21
elif path.endswith('/Release'):
22
compare_Release(path, testpath)
23
elif path.endswith('.deb'):
24
compare_deb(path, testpath)
26
compare_diff('diff', path, testpath)
28
def compare_diff(diffprog, path, testpath):
29
args = [diffprog, '-u', '--ignore-matching-lines=^Bugs:', '--ignore-matching-lines=^Origin:', '--ignore-matching-lines=^Task:', '--ignore-matching-lines=^Build-Essential:', '--ignore-matching-lines=^Supported:', path, testpath]
30
diff = subprocess.Popen(args, stdout=subprocess.PIPE)
31
output = diff.stdout.read()
33
# zdiff's header information is useless, so prepend our own
37
def compare_bin(path, testpath):
38
cmp = subprocess.Popen(['cmp', path, testpath])
41
def compare_Release(path, testpath):
43
print "W: Release comparison not implemented yet"
45
def compare_deb(path, testpath):
47
print "W: .deb comparison not implemented yet"
49
for dirpath, dirnames, filenames in os.walk(master):
50
relpath = dirpath[len(master):].strip('/')
54
testpath = os.path.join(testing,relpath,path)
55
if not os.path.isdir(testpath):
56
missing('directory', os.path.join(relpath,path))
57
missing_dirs.append(path)
58
for path in missing_dirs:
61
for path in filenames:
62
testpath = os.path.join(testing,relpath,path)
63
if not os.path.isfile(testpath):
64
missing('file', testpath)
67
compare(os.path.join(dirpath,path), testpath)