print("""Usage: diffconfig [-h] [-m] [<config1> <config2>]
Diffconfig is a simple utility for comparing two .config files.
Using standard diff to compare .config files often includes extraneous and
distracting information. This utility produces sorted output with only the
changes in configuration values between the two files.
Added and removed items are shown with a leading plus or minus, respectively.
Changed items show the old and new values on a single line.
If -m is specified, then output will be in "merge" style, which has the
changed and new values in kernel config option format.
If no config files are specified, .config and .config.old are used.
$ diffconfig .config config-with-some-changes
def readconfig(config_file):
if line[:7] == "CONFIG_":
name, val = line[7:].split("=", 1)
if line[-11:] == " is not set":
def print_config(op, config, value, new_value):
print("# CONFIG_%s is not set" % config)
print("CONFIG_%s=%s" % (config, new_value))
print("-%s %s" % (config, value))