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.5 2006/12/14 05:08:53 mef Exp $
16 for line in file.readlines():
19 if len(iline)==0: continue
23 offset=iline.find(" is not set")
25 config = line[line.find("CONFIG"):offset].strip()
26 if CONFIGS.has_key(config): print "duplicate entry %s" % config
27 CONFIGS[config]="is not set"
30 # skip over comments that do not contain the "is not set" string
34 offset = iline.find('=')
36 config = line[line.find("CONFIG"):offset].strip()
37 if CONFIGS.has_key(config): print "duplicate entry %s" % config
38 CONFIGS[config] = line[offset+1:].strip()
41 return (CONFIGS,ORDER)
47 name = os.path.basename(sys.argv[0])
48 print "USAGE: %s [options] from.config to.config" % name
51 -a Show all differences
54 ADD Added config (exists in to.config, but not in from.config)
55 REM Removed config (exists in from.config, but not in to.config)
66 (old,oldorder)= process(open(args[0]))
67 (new,neworder)= process(open(args[1]))
69 newstate = {None:'REMOVED',"is not set":'DISABLE','y':'BUILTIN','m':'MODULE '}
75 if n==o and not showall: continue
76 print "%6s -> %6s : %s" % (newstate.get(o,o),newstate.get(n,n),key)
79 # not sure we care about what options have been removed
80 # from from.config file
81 oldstate = {None:'REMOVED',"is not set":'DISABLE','y':'BUILTIN','m':'MODULE '}
84 if seen.has_key(key): continue
87 if n == o and not showall: continue
88 print "%6s -> %6s : %s" % (oldstate.get(o,o),oldstate.get(n,n),key)