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
8 # $Id: kompare,v 1.2 2006/11/30 17:07:03 mef Exp $
17 for line in file.readlines():
20 if len(iline)==0: continue
24 offset=iline.find(" is not set")
26 config = line[line.find("CONFIG"):offset].strip()
27 if CONFIGS.has_key(config): print "duplicate entry %s" % config
28 CONFIGS[config]="is not set"
31 # skip over comments that do not contain the "is not set" string
35 offset = iline.find('=')
37 config = line[line.find("CONFIG"):offset].strip()
38 if CONFIGS.has_key(config): print "duplicate entry %s" % config
39 CONFIGS[config] = line[offset+1:].strip()
42 return (CONFIGS,ORDER)
48 name = os.path.basename(sys.argv[0])
49 print "USAGE: %s [options] from.config to.config" % name
52 -a Show all differences
55 ADD Added config (exists in to.config, but not in from.config)
56 REM Removed config (exists in from.config, but not in to.config)
67 (old,oldorder)= process(open(args[0]))
68 (new,neworder)= process(open(args[1]))
70 newstate = {None:'REM',"is not set":'DIS','y':'BLT','m':'MOD'}
75 if n==o and not showall: continue
76 print "%6s -> %6s : %s" % (newstate.get(o,o),newstate.get(n,n),key)
77 if not showall: continue
78 helptxt=kread.gethelp(key)
79 if helptxt<>'':print helptxt
81 # not sure we care about what options have been removed
82 # from from.config file
84 oldstate = {None:'A',"is not set":'D','y':'B','m':'M'}
89 if n == -1 and not showall:
90 print "%c -> %c : %s" % (oldstate[o],oldstate[n],key)