3 # compare: a tool to compare kernel config files
5 # Marc E. Fiuczynski <mef@cs.princeton.edu>
6 # Copyright (C) 2006 The Trustees of Princeton University
16 for line in file.readlines():
19 offset=iline.find(" is not set")
21 config = line[line.find("CONFIG"):offset].strip()
22 if CONFIGS.has_key(config): print "duplicate entry %s" % config
27 offset = iline.find("=y")
29 config = line[line.find("CONFIG"):offset].strip()
30 if CONFIGS.has_key(config): print "duplicate entry %s" % config
35 offset = iline.find("=m")
36 if iline.find("=m") <> -1:
37 config = line[line.find("CONFIG"):offset].strip()
38 if CONFIGS.has_key(config): print "duplicate entry %s" % config
43 return (CONFIGS,ORDER)
50 name = os.path.basename(sys.argv[0])
51 print "USAGE: %s [options] from.config to.config" % name
54 -a Show all differences
57 A Added config (exists in to.config, but not in from.config)
58 R Removed config (exists in from.config, but not in to.config)
69 (old,oldorder)= process(open(args[0]))
70 (new,neworder)= process(open(args[1]))
72 oldstate = {-1:'A',0:'D',1:'B',2:'M'}
73 newstate = {-1:'R',0:'D',1:'B',2:'M'}
79 if n==o and not showall: continue
80 print "%c -> %c : %s" % (newstate[o],newstate[n],key)
82 # not sure we care about what options have been removed
83 # from from.config file
89 if n == -1 and not showall:
90 print "%c -> %c : %s" % (oldstate[o],oldstate[n],key)