-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiff-vproxy.py
More file actions
executable file
·69 lines (59 loc) · 2.16 KB
/
Copy pathdiff-vproxy.py
File metadata and controls
executable file
·69 lines (59 loc) · 2.16 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
#!/usr/bin/env python3
import sys
import os
import subprocess
if len(sys.argv) < 2:
print ('the script accept an argument: root directory of the vproxy project')
sys.exit(1)
VPROXY_DIR = sys.argv[1]
if not VPROXY_DIR.endswith('/'):
VPROXY_DIR = VPROXY_DIR + '/'
BASE_DIR = 'src/main/'
def diff(a, b, n):
p = subprocess.run(['git', 'diff', a, b], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
stdout = p.stdout.strip()
lines = p.stdout.strip().split('\n')
if len(stdout) == 0 and p.returncode == 0:
print ('##### files are the same: ' + n + ' #####')
else:
print ('!!!!! diff ' + n + ' !!!!!')
for line in lines:
if line.startswith('diff --git ') or \
line.startswith('--- a/') or line.startswith('--- b/') or \
line.startswith('+++ a/') or line.startswith('+++ b/') or \
line.startswith('index '):
continue
print ('!!!!! ' + line)
print ('!!!!! diff return code ' + str(p.returncode) + ' !!!!!')
print ()
def diff_file(base, n):
a = base + n
b = VPROXY_DIR + 'base/' + BASE_DIR + n
if not os.path.exists(b):
print ('!!!!! vproxy missing: ' + n + ' !!!!!')
else:
diff(a, b, n)
def handle(base, name):
ls = sorted(os.listdir(base + name))
for n in ls:
if n == 'generated':
continue
if os.path.isdir(base + name + '/' + n):
handle(base, name + '/' + n)
elif n.endswith('.java') or n.endswith('.kt'):
diff_file(base, name + '/' + n)
handle('./' + BASE_DIR, '')
def handle_vproxy(base, name):
ls = sorted(os.listdir(VPROXY_DIR + 'base/' + BASE_DIR + name))
for n in ls:
if n == 'generated':
continue
if os.path.isdir(VPROXY_DIR + 'base/' + BASE_DIR + name + '/' + n):
handle_vproxy(base, name + '/' + n)
continue
if not n.endswith('.java') and not n.endswith('.kt'):
continue
nn = base + name + '/' + n
if not os.path.exists(nn):
print ('##### commons missing: ' + name + '/' + n + ' #####')
handle_vproxy('./' + BASE_DIR, '')