# Marc E. Fiuczynski <mef@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
-# $Id: compare,v 1.1 2006/11/30 16:39:29 mef Exp $
+# $Id: kompare,v 1.1 2006/11/30 16:41:09 mef Exp $
#
import sys, re, os
CONFIGS = {}
for line in file.readlines():
iline = line.lower()
-
- offset=iline.find(" is not set")
- if offset <> -1:
- config = line[line.find("CONFIG"):offset].strip()
- if CONFIGS.has_key(config): print "duplicate entry %s" % config
- CONFIGS[config]=0
- ORDER.append(config)
- continue
-
- offset = iline.find("=y")
- if offset <> -1:
- config = line[line.find("CONFIG"):offset].strip()
- if CONFIGS.has_key(config): print "duplicate entry %s" % config
- CONFIGS[config]=1
- ORDER.append(config)
- continue
-
- offset = iline.find("=m")
- if iline.find("=m") <> -1:
- config = line[line.find("CONFIG"):offset].strip()
- if CONFIGS.has_key(config): print "duplicate entry %s" % config
- CONFIGS[config]=2
- ORDER.append(config)
- continue
-
+ iline.strip()
+ if len(iline)==0: continue
+ firstchar = iline[0]
+
+ if firstchar == '#':
+ offset=iline.find(" is not set")
+ if offset <> -1:
+ config = line[line.find("CONFIG"):offset].strip()
+ if CONFIGS.has_key(config): print "duplicate entry %s" % config
+ CONFIGS[config]="is not set"
+ ORDER.append(config)
+ else:
+ # skip over comments that do not contain the "is not set" string
+ pass
+
+ else:
+ offset = iline.find('=')
+ if offset <> -1:
+ config = line[line.find("CONFIG"):offset].strip()
+ if CONFIGS.has_key(config): print "duplicate entry %s" % config
+ CONFIGS[config] = line[offset+1:].strip()
+ ORDER.append(config)
+
return (CONFIGS,ORDER)
-
showall=False
args = sys.argv[1:]
-a Show all differences
State Legend
- A Added config (exists in to.config, but not in from.config)
- R Removed config (exists in from.config, but not in to.config)
- B Builtin
- M Module
- D Disabled
+ ADD Added config (exists in to.config, but not in from.config)
+ REM Removed config (exists in from.config, but not in to.config)
+ BLT Builtin
+ MOD Module
+ DIS Disabled
"""
sys.exit(0)
(old,oldorder)= process(open(args[0]))
(new,neworder)= process(open(args[1]))
-oldstate = {-1:'A',0:'D',1:'B',2:'M'}
-newstate = {-1:'R',0:'D',1:'B',2:'M'}
-
+newstate = {None:'REM',"is not set":'DIS','y':'BLT','m':'MOD'}
keys = neworder
for key in keys:
- o = old.get(key,-1)
+ o = old.get(key,None)
n = new[key]
if n==o and not showall: continue
- print "%c -> %c : %s" % (newstate[o],newstate[n],key)
+ print "%6s -> %6s : %s" % (newstate.get(o,o),newstate.get(n,n),key)
# not sure we care about what options have been removed
# from from.config file
sys.exit(0)
+oldstate = {None:'A',"is not set":'D','y':'B','m':'M'}
keys = oldorder
for key in keys:
n = new.get(key,-1)