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
|
#!/usr/bin/python3
from __future__ import print_function
import os
import sys
import subprocess
master = sys.argv[1]
testing = sys.argv[2]
def missing(what, path):
print("E: %s %s is missing" % (what, path))
def compare(path, testpath):
if (path.endswith('.tar.gz') or path.endswith('.tar.bz2') or
path.endswith('.tar.xz')):
compare_bin(path, testpath)
elif path.endswith('.gz'):
compare_diff('zdiff', path, testpath)
elif path.endswith('.bz2'):
compare_diff('bzdiff', path, testpath)
elif path.endswith('.xz'):
compare_diff('xzdiff', path, testpath)
elif path.endswith('/Release'):
compare_Release(path, testpath)
elif path.endswith('.deb'):
compare_deb(path, testpath)
else:
compare_diff('diff', path, testpath)
def compare_diff(diffprog, path, testpath):
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]
diff = subprocess.Popen(
args, stdout=subprocess.PIPE, universal_newlines=True)
output = diff.stdout.read()
if diff.wait() != 0:
# zdiff's header information is useless, so prepend our own
print(' '.join(args))
print(output, end="")
def compare_bin(path, testpath):
subprocess.call(['cmp', path, testpath])
def compare_Release(path, testpath):
return
print("W: Release comparison not implemented yet")
def compare_deb(path, testpath):
return
print("W: .deb comparison not implemented yet")
for dirpath, dirnames, filenames in os.walk(master):
relpath = dirpath[len(master):].strip('/')
missing_dirs = []
for path in dirnames:
testpath = os.path.join(testing,relpath,path)
if not os.path.isdir(testpath):
missing('directory', os.path.join(relpath,path))
missing_dirs.append(path)
for path in missing_dirs:
dirnames.remove(path)
for path in filenames:
testpath = os.path.join(testing,relpath,path)
if not os.path.isfile(testpath):
missing('file', testpath)
continue
compare(os.path.join(dirpath,path), testpath)
|