Пример #1
0
def main():
    kconf = kconfiglib.standard_kconfig()

    # See allnoconfig.py
    kconf.disable_warnings()

    # Small optimizations
    BOOL = kconfiglib.BOOL
    TRISTATE = kconfiglib.TRISTATE

    for sym in kconf.unique_defined_syms:
        if sym.orig_type == BOOL:
            # 'bool' choice symbols get their default value, as determined by
            # e.g. 'default's on the choice
            if not sym.choice:
                # All other bool symbols get set to 'y', like for allyesconfig
                sym.set_value(2)
        elif sym.orig_type == TRISTATE:
            sym.set_value(1)

    for choice in kconf.unique_choices:
        choice.set_value(2 if choice.orig_type == BOOL else 1)

    kconf.enable_warnings()

    kconfiglib.load_allconfig(kconf, "allmod.config")

    kconf.write_config(kconfiglib.standard_config_filename())
Пример #2
0
def main():
    kconf = kconfiglib.standard_kconfig()

    # See allnoconfig.py
    kconf.disable_warnings()

    # Try to set all symbols to 'y'. Dependencies might truncate the value down
    # later, but this will at least give the highest possible value.
    #
    # Assigning 0/1/2 to non-bool/tristate symbols has no effect (int/hex
    # symbols still take a string, because they preserve formatting).
    for sym in kconf.unique_defined_syms:
        # Set choice symbols to 'm'. This value will be ignored for choices in
        # 'y' mode (the "normal" mode), which will instead just get their
        # default selection, but will set all symbols in m-mode choices to 'm',
        # which is as high as they can go.
        #
        # Here's a convoluted example of how you might get an m-mode choice
        # even during allyesconfig:
        #
        #   choice
        #           tristate "weird choice"
        #           depends on m
        sym.set_value(1 if sym.choice else 2)

    # Set all choices to the highest possible mode
    for choice in kconf.unique_choices:
        choice.set_value(2)

    kconf.enable_warnings()

    kconfiglib.load_allconfig(kconf, "allyes.config")

    kconf.write_config()
Пример #3
0
def main():
    kconf = kconfiglib.standard_kconfig()

    # See allnoconfig.py
    kconf.disable_warnings()

    # Try to set all symbols to 'y'. Dependencies might truncate the value down
    # later, but this will at least give the highest possible value.
    #
    # Assigning 0/1/2 to non-bool/tristate symbols has no effect (int/hex
    # symbols still take a string, because they preserve formatting).
    for sym in kconf.unique_defined_syms:
        # Set choice symbols to 'm'. This value will be ignored for choices in
        # 'y' mode (the "normal" mode), which will instead just get their
        # default selection, but will set all symbols in m-mode choices to 'm',
        # which is as high as they can go.
        sym.set_value(1 if sym.choice else 2)

    # Set all choices to the highest possible mode
    for choice in kconf.unique_choices:
        choice.set_value(2)

    kconf.enable_warnings()

    kconfiglib.load_allconfig(kconf, "allyes.config")

    kconf.write_config()
Пример #4
0
def _main():
    # Earlier symbols in Kconfig files might depend on later symbols and become
    # visible if their values change. This flag is set to True if the value of
    # any symbol changes, in which case we rerun the oldconfig to check for new
    # visible symbols.
    global conf_changed

    kconf = standard_kconfig()

    config_filename = standard_config_filename()
    if not os.path.exists(config_filename):
        sys.exit("{}: '{}' not found".format(sys.argv[0], config_filename))

    kconf.load_config(config_filename)

    while True:
        conf_changed = False

        for node in kconf.node_iter():
            oldconfig(node)

        if not conf_changed:
            break

    kconf.write_config(config_filename)

    print("Updated configuration written to '{}'".format(config_filename))
Пример #5
0
def main():
    kconf = kconfiglib.standard_kconfig(__doc__)

    # See allnoconfig.py
    kconf.warn = False

    # Try to set all symbols to 'y'. Dependencies might truncate the value down
    # later, but this will at least give the highest possible value.
    #
    # Assigning 0/1/2 to non-bool/tristate symbols has no effect (int/hex
    # symbols still take a string, because they preserve formatting).
    for sym in kconf.unique_defined_syms:
        # Set choice symbols to 'm'. This value will be ignored for choices in
        # 'y' mode (the "normal" mode), which will instead just get their
        # default selection, but will set all symbols in m-mode choices to 'm',
        # which is as high as they can go.
        #
        # Here's a convoluted example of how you might get an m-mode choice
        # even during allyesconfig:
        #
        #   choice
        #           tristate "weird choice"
        #           depends on m
        sym.set_value(1 if sym.choice else 2)

    # Set all choices to the highest possible mode
    for choice in kconf.unique_choices:
        choice.set_value(2)

    kconf.warn = True

    kconfiglib.load_allconfig(kconf, "allyes.config")

    print(kconf.write_config())
Пример #6
0
def main():
    kconf = standard_kconfig()
    # Make it possible to filter this message out
    sys.stderr.write(kconf.load_config() + "\n")

    for sym in kconf.unique_defined_syms:
        # Only show symbols that can be toggled. Choice symbols are a special
        # case in that sym.assignable will be (2,) (length 1) for visible
        # symbols in choices in y mode, but they can still be toggled by
        # selecting some other symbol.
        if sym.user_value is None and \
           (len(sym.assignable) > 1 or
            (sym.visibility and (sym.orig_type in (INT, HEX, STRING) or
                                 sym.choice))):

            # Don't reuse the 'config_string' format for bool/tristate symbols,
            # to show n-valued symbols as 'CONFIG_FOO=n' instead of
            # '# CONFIG_FOO is not set'. This matches the C tools.
            if sym.orig_type in (BOOL, TRISTATE):
                s = "{}{}={}\n".format(kconf.config_prefix, sym.name,
                                       TRI_TO_STR[sym.tri_value])
            else:
                s = sym.config_string

            sys.stdout.write(s)
Пример #7
0
def main():
    config_filename = kconfiglib.standard_config_filename()
    if not os.path.exists(config_filename):
        sys.exit("{}: '{}' not found".format(sys.argv[0], config_filename))

    kconf = kconfiglib.standard_kconfig()
    kconf.load_config(config_filename)
    kconf.write_config(config_filename)
    print("Updated configuration written to '{}'".format(config_filename))
Пример #8
0
def main():
    kconf = standard_kconfig()

    config_filename = standard_config_filename()
    if not os.path.exists(config_filename):
        sys.exit("{}: '{}' does not exist".format(sys.argv[0],
                                                  config_filename))

    kconf.load_config(config_filename)
    do_oldconfig(kconf)
    kconf.write_config(config_filename)

    print("Configuration saved to '{}'".format(config_filename))
Пример #9
0
def main():
    kconf = kconfiglib.standard_kconfig()

    # Avoid warnings that would otherwise get printed by Kconfiglib for the
    # following:
    #
    # 1. Assigning a value to a symbol without a prompt, which never has any
    #    effect
    #
    # 2. Assigning values invalid for the type (only bool/tristate symbols
    #    accept 0/1/2, for n/m/y). The assignments will be ignored for other
    #    symbol types, which is what we want.
    kconf.disable_warnings()

    for sym in kconf.unique_defined_syms:
        sym.set_value(2 if sym.is_allnoconfig_y else 0)

    kconf.write_config(kconfiglib.standard_config_filename())
Пример #10
0
def _main():
    # Earlier symbols in Kconfig files might depend on later symbols and become
    # visible if their values change. This flag is set to True if the value of
    # any symbol changes, in which case we rerun the oldconfig to check for new
    # visible symbols.
    global conf_changed

    kconf = standard_kconfig()
    kconf.load_config()

    while True:
        conf_changed = False

        for node in kconf.node_iter():
            oldconfig(node)

        if not conf_changed:
            break

    kconf.write_config()
Пример #11
0
def main():
    kconf = kconfiglib.standard_kconfig()

    # Avoid warnings that would otherwise get printed by Kconfiglib for the
    # following:
    #
    # 1. Assigning a value to a symbol without a prompt, which never has any
    #    effect
    #
    # 2. Assigning values invalid for the type (only bool/tristate symbols
    #    accept 0/1/2, for n/m/y). The assignments will be ignored for other
    #    symbol types, which is what we want.
    kconf.disable_warnings()
    for sym in kconf.unique_defined_syms:
        sym.set_value(2 if sym.is_allnoconfig_y else 0)
    kconf.enable_warnings()

    kconfiglib.load_allconfig(kconf, "allno.config")

    kconf.write_config()
Пример #12
0
def _main():
    # Earlier symbols in Kconfig files might depend on later symbols and become
    # visible if their values change. This flag is set to True if the value of
    # any symbol changes, in which case we rerun the oldconfig to check for new
    # visible symbols.
    global conf_changed

    kconf = standard_kconfig(__doc__)
    print(kconf.load_config())

    while True:
        conf_changed = False

        for node in kconf.node_iter():
            oldconfig(node)

        if not conf_changed:
            break

    print(kconf.write_config())
Пример #13
0
def main():
    kconf = standard_kconfig()
    kconf.load_config()
    for sym in kconf.unique_defined_syms:
        # Only show symbols that can be toggled. Choice symbols are a special
        # case in that sym.assignable will be (2,) (length 1) for visible
        # symbols in choices in y mode, but they can still be toggled by
        # selecting some other symbol.
        if sym.user_value is None and \
           (len(sym.assignable) > 1 or
            (sym.visibility and (sym.orig_type in (INT, HEX, STRING) or
                                 sym.choice))):

            # Don't reuse the 'config_string' format for bool/tristate symbols,
            # to show n-valued symbols as 'CONFIG_FOO=n' instead of
            # '# CONFIG_FOO is not set'. This matches the C tools.
            if sym.orig_type in (BOOL, TRISTATE):
                s = "{}{}={}\n".format(kconf.config_prefix, sym.name,
                                       TRI_TO_STR[sym.tri_value])
            else:
                s = sym.config_string

            sys.stdout.write(s)
Пример #14
0
def main():
    kconf = kconfiglib.standard_kconfig()

    # See allnoconfig.py
    kconf.disable_warnings()

    for sym in kconf.unique_defined_syms:
        if sym.orig_type == kconfiglib.BOOL:
            # 'bool' choice symbols get their default value, as determined by
            # e.g. 'default's on the choice
            if not sym.choice:
                # All other bool symbols get set to 'y', like for allyesconfig
                sym.set_value(2)
        elif sym.orig_type == kconfiglib.TRISTATE:
            sym.set_value(1)

    for choice in kconf.unique_choices:
        choice.set_value(2 if choice.orig_type == kconfiglib.BOOL else 1)

    kconf.enable_warnings()

    kconfiglib.load_allconfig(kconf, "allmod.config")

    kconf.write_config()
Пример #15
0
def main():
    kconf = kconfiglib.standard_kconfig(__doc__)

    # See allnoconfig.py
    kconf.warn = False

    for sym in kconf.unique_defined_syms:
        if sym.orig_type == kconfiglib.BOOL:
            # 'bool' choice symbols get their default value, as determined by
            # e.g. 'default's on the choice
            if not sym.choice:
                # All other bool symbols get set to 'y', like for allyesconfig
                sym.set_value(2)
        elif sym.orig_type == kconfiglib.TRISTATE:
            sym.set_value(1)

    for choice in kconf.unique_choices:
        choice.set_value(2 if choice.orig_type == kconfiglib.BOOL else 1)

    kconf.warn = True

    kconf.load_allconfig("allmod.config")

    print(kconf.write_config())
Пример #16
0
def main():
    kconfiglib.standard_kconfig().write_config(
        kconfiglib.standard_config_filename())
Пример #17
0
def main():
    kconf = kconfiglib.standard_kconfig()
    kconfiglib.load_allconfig(kconf, "alldef.config")
    kconf.write_config()
Пример #18
0
def main():
    kconf = kconfiglib.standard_kconfig()
    kconfiglib.load_allconfig(kconf, "alldef.config")
    kconf.write_config(kconfiglib.standard_config_filename())
Пример #19
0
def main():
    kconf = kconfiglib.standard_kconfig()
    kconfiglib.load_allconfig(kconf, "alldef.config")
    print(kconf.write_config())
Пример #20
0
def main():
    kconf = kconfiglib.standard_kconfig(__doc__)
    print(kconf.load_config())
    print(kconf.write_config())
Пример #21
0
def main():
    hardenconfig(standard_kconfig())
Пример #22
0
def main():
    kconf = kconfiglib.standard_kconfig(__doc__)
    kconf.load_allconfig("alldef.config")
    print(kconf.write_config())
Пример #23
0
def main():
    kconf = kconfiglib.standard_kconfig()
    kconf.load_config()
    kconf.write_config()
Пример #24
0
def main():
    kconf = kconfiglib.standard_kconfig()
    kconf.load_config()
    kconf.write_config()