forked from tass-belgium/picotcp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
modcheck.py
executable file
·50 lines (44 loc) · 1.03 KB
/
modcheck.py
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
#!/usr/bin/python
import os,sys
import subprocess
f = open('MODTREE')
mods = {}
commands = []
def get_deps(mod):
if not mod in mods.keys():
return []
deps = mods[mod]
retlist = [mod]
for i in deps.split(' '):
retlist.append(i)
for j in get_deps(i):
retlist.append(j)
return retlist
while(True):
r = f.readline()
if r == '':
break
if r != '\n':
strings = r.split(':')
mod = strings[0]
deps = strings[1].rstrip('\n')
mods[mod] = deps.strip(' ')
for k,v in mods.iteritems():
command = 'make dummy '
deps = get_deps(k)
for i in mods.keys():
if i in deps:
command += i + "=1 "
else:
command += i + "=0 "
commands.append(command)
nul = open('/dev/null', 'w')
for i in commands:
print 'Checking config:\n\t%s' % i
os.system('make clean >/dev/null')
args = i.split(' ')
subprocess.call(['make','clean'], shell=True, stdout=nul, stderr=nul)
subprocess.call(args[-1], shell=True,stdout=nul, stderr=nul)==0 or sys.exit(1)
print "CONFIG OK!"
print
sys.exit(0)