| Age | Commit message (Collapse) | Author |
|
These errors are a pain to debug otherwise, and might look like
Kconfiglib brokenness.
Another option would be ignore decoding errors, or do the
'surrogateescape' thing on reading and writing, but keep it simple for
now. Pointing out the problem might be more helpful.
|
|
Flag lines matching neither 'CONFIG_FOO=...' nor
'# CONFIG_FOO is not set' that aren't blank or comments.
|
|
Same as Symbol.direct_dep (OR of node dependencies from all definition
locations). It's handy to have available when generating information
about choices.
|
|
I've had to implement the logic for walking reverse dependencies (from
select) a couple of times now, and it's always a bit tricky to get
right. Reduce code duplication and simplify things by adding a helper
function split_expr() that splits an expression into a list of either
its AND or OR operands.
A nice side effect is that e.g. the warning generated for selecting a
symbol with unsatisfied direct dependencies now lists the selecting
symbols in the order that they appear in the Kconfig files.
split_expr() might be helpful for splitting other types of expressions
as well, e.g. to put operands on separate lines when generating
documentation.
|
|
Previously, the warnings
warning: FOO (defined at Kconfig:1, Kconfig:6) defined with type unknown
warning: the default selection BAR (defined at Kconfig:9) of FOO (defined at Kconfig:1, Kconfig:6) is not contained in the choice
were printed for this (obscure, but okay) pair of definitions:
choice FOO
default BAR
endchoice
choice FOO
prompt "foo"
config BAR
bool "bar"
endchoice
The problem is that BAR is not known to be a choice symbol by the time
the first choice definition is encountered in _finalize_tree(), since
that's determined only when the second definition is encountered (it
needs to happen there, because implicit submenus can influence whether a
symbol is a choice symbol or not, and implicit submenus are determined
in _finalize_tree()).
Fix it by moving the sanity checks out of _finalize_tree() and into a
separate pass over all symbols and choices that runs after
_finalize_tree(). That might avoid other gotchas too.
|
|
Oversight
|
|
'is_menuconfig' is set after 'item' in the other cases.
|
|
Extending the scope of is_menuconfig so that it's True for all items
whose children should be displayed in a separate menu turns out to be
handy when implementing menuconfig-like functionality.
Keep the old name for backwards compatibility. It's good enough.
|
|
This is redundant from an evaluation perspective, as && has higher
precedence than ||, but is easier to read.
A && B || C && D is now rendered as "(A && B) || (C && D)".
|
|
This is redundant on its own, as only a single symbol can be
selected/implied, meaning just .name will work fine too. It means that
all symbols appearing in the __str__() representation of symbols and
choices are now printed via expr_str() though, which might come in handy
soon.
|
|
- Detect Symbol directly instead of as (not tuple) + (not choice)
- Test explicitly for a tuple (non-Symbol) in NOT
- Add some tests to get better coverage for NOT and parentheses
|
|
This has no effect.
Model the warning on the one for selecting a symbol with unsatisfied
dependencies.
This is a Kconfiglib-exclusive warning so far.
|
|
|
|
Bit shorter, still clear in context.
|
|
Simplify the looping and remove some comments that aren't super helpful.
Also put " - " at the beginning of the lines listing the selecting
symbols. Bit more readable.
|
|
A valid int/hex user value can never be an empty string, so they test
can be simplified.
|
|
Example warning:
warning: user value 0x100 on the hex symbol HEX (defined at Kconfig:18) ignored due to being outside the active range ([0x13, 0x73]) -- falling back on defaults
This is a Kconfiglib-exclusive warning. It might be tricky to implement
in the C tools, due to weird two-phase handling of int/hex symbols.
There is unfortunately no easy way to map the warning back to a .config
line, as the active 'range' can't be known in general until the entire
configuration has been read (consider 'range 0 10 if FOO' for example).
Instead, the warning is generated when the symbol value is calculated.
|
|
set_value() already rejects invalid int/hex values, so there's no need
to check the value in str_value().
|
|
No need to create a list. glob() just does list(iglob()) internally as
well.
|
|
There's no need to handle prompts like defaults, selects, etc. in
_parse_properties(), because prompts belong to menu nodes, which means
only local dependencies will be propagated anyway.
Makes the code a bit less twisty.
|
|
Consistent with how dependencies are propagated elsewhere.
Get rid of the 'parent_dep' variable too.
|
|
|
|
|
|
Bit more readable to have the parent node and the previous node next to
each other.
Also rename 'prev_node' to just 'prev', to be consistent with 'parent'.
There's fewer parameters than in the past now, making it pretty easy to
follow anyway. Remove some inline parameter-related comments too.
|
|
- Restructure the test.
- Call the function _int_hex_ok() instead. Bit less spammy. Also add a
doc-comment to explain it.
|
|
'left' is guaranteed to be 'sym' if the preceding conditional was true.
|
|
Also rename it to _auto_menu_dep().
|
|
Originally taken from the C implementation, but seems pointless. The
only way to get an empty prompt text is to explicitly define a symbol
with e.g. 'prompt ""'.
|
|
'gsource' works like 'source', but takes a glob pattern and sources all
matching files. Works as a no-op if no files match, and hence doubles as
an include-if-exists function, similar to '-include' in 'make'.
Add a 'grsource' statement as well, mirroring 'rsource'.
Came up in https://github.com/ulfalizer/Kconfiglib/pull/40.
|
|
Works like 'make savedefconfig' in the C tools. Call it
write_min_config() rather than write_defconfig() to be a bit more
explicit.
Add a test similar to test_defconfig that compares Kconfiglib minimal
configuration output against the C implementation, for all defconfig
files.
Disable the tests for now. The C tools have a bug that causes an
incorrect configuration to be generated for tristate choices in some
cases. They will be re-enabled once those are fixed.
|
|
Commit e8b4ecb ("Don't special-case user_value for choice symbols set to
y") was meant to make user_value reflect an y value assigned to a choice
symbol, but didn't get it right for load_config() with replace=True: The
user value was set at first, but was then unset again due to a misplaced
'_was_set = True' assignment.
This commit makes y choice symbol user values always be remembered. The
correctness of generated files was not affected, since the user
selection of a choice is actually remembered as Choice.user_selection.
The previous commit just turned into a no-op for load_config() with
replace=True.
|
|
The original idea was that it might be handy to look up docstrings for
internal functions from the Python prompt (or an IDE) while figuring out
the code.
Not sure it's that useful in practice though. Comments shorten the code
a bit, and might make it clearer at a glance that the function is
internal.
|
|
Makes it harder to miss.
|
|
The _get_* prefixes don't improve readability and are inconsistent: All
other getters are simply named after the thing they fetch.
Leftover from Kconfiglib 1.
|
|
s/the defconfig_list/the defconfig_list symbol/
|
|
Mirrors the following change to the C tools, now in linux-next:
commit c21a6e352766005d42c1ccae32b31e0438903eb9
Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Date: Sat Feb 17 03:38:32 2018 +0900
kconfig: set SYMBOL_AUTO to the symbol marked with defconfig_list
The 'defconfig_list' is a weird attribute. If the '.config' is
missing, conf_read_simple() iterates over all visible defaults,
then it uses the first one for which fopen() succeeds.
config DEFCONFIG_LIST
string
depends on !UML
option defconfig_list
default "/lib/modules/$UNAME_RELEASE/.config"
default "/etc/kernel-config"
default "/boot/config-$UNAME_RELEASE"
default "$ARCH_DEFCONFIG"
default "arch/$ARCH/defconfig"
However, like other symbols, the first visible default is always
written out to the .config file. This might be different from what
has been actually used.
For example, on my machine, the third one "/boot/config-$UNAME_RELEASE"
is opened, like follows:
$ rm .config
$ make oldconfig 2>/dev/null
scripts/kconfig/conf --oldconfig Kconfig
#
# using defaults found in /boot/config-4.4.0-112-generic
#
*
* Restart config...
*
*
* IRQ subsystem
*
Expose irq internals in debugfs (GENERIC_IRQ_DEBUGFS) [N/y/?] (NEW)
However, the resulted .config file contains the first one since it is
visible:
$ grep CONFIG_DEFCONFIG_LIST .config
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
In order to stop confusing people, prevent this CONFIG option from
being written to the .config file.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
|
|
Use the result from the initial str_value call in more places.
Also add a comment to make it clear how _write_to_conf is calculated,
mirroring the ones in write_config() and write_autoconf().
|
|
|
|
Instead of creating an empty initial auto.conf and immediately loading
it, look for a missing auto.conf in _load_old_vals() and treat that the
same as an empty auto.conf (by returning after clearing the old values).
The initial auto.conf will then be written as normal by
_write_old_vals().
Also flesh out the sync_deps() docstring a bit:
- Make it clear that sync_deps() should be run at each build
- Be more explicit about what it means for a symbol to have changed
(different output in autoconf.h)
|
|
An initial empty auto.conf will be created, just as when sync_deps()
creates the directory.
This is more flexible. There's no good reason to require the directory
to be created by sync_deps().
|
|
"malformed expression" should be clear enough for a missing end
parenthesis too. Expressions are generally short.
|
|
Oversight
|
|
This gets rid of _TOKEN_TO_REL and removes the conversion in
_parse_factor(). It's pretty easy to understand too.
Having e.g. just EQUAL and no _T_EQUAL would be too confusing, so keep
the separate names still.
Piggyback small _REL_TO_STR and _T_OPEN_PAREN code nits.
|
|
This mirrors a change I made to the C tools, which is now in linux-next:
https://www.spinics.net/lists/linux-kbuild/msg17074.html.
Add a note to the README to make it clear that the test suite now needs
to be run against recent kernels in order to pass.
Copy-pasted commit message from the C tools commit below:
=== Background ===
- Visible n-valued bool/tristate symbols generate a
'# CONFIG_FOO is not set' line in the .config file. The idea is to
remember the user selection without having to set a Makefile
variable. Having n correspond to the variable being undefined in the
Makefiles makes for easy CONFIG_* tests.
- Invisible n-valued bool/tristate symbols normally do not generate a
'# CONFIG_FOO is not set' line, because user values from .config
files have no effect on invisible symbols anyway.
Currently, there is one exception to this rule: Any bool/tristate symbol
that gets the value n through a 'default' property generates a
'# CONFIG_FOO is not set' line, even if the symbol is invisible.
Note that this only applies to explicitly given defaults, and not when
the symbol implicitly defaults to n (like bool/tristate symbols without
'default' properties do).
This is inconsistent, and seems redundant:
- As mentioned, the '# CONFIG_FOO is not set' won't affect the symbol
once the .config is read back in.
- Even if the symbol is invisible at first but becomes visible later,
there shouldn't be any harm in recalculating the default value
rather than viewing the '# CONFIG_FOO is not set' as a previous
user value of n.
=== Changes ===
Change sym_calc_value() to only set SYMBOL_WRITE (write to .config) for
non-n-valued 'default' properties.
Note that SYMBOL_WRITE is always set for visible symbols regardless of whether
they have 'default' properties or not, so this change only affects invisible
symbols.
This reduces the size of the x86 .config on my system by about 1% (due
to removed '# CONFIG_FOO is not set' entries).
One side effect of (and the main motivation for) this change is making
the following two definitions behave exactly the same:
config FOO
bool
config FOO
bool
default n
With this change, neither of these will generate a
'# CONFIG_FOO is not set' line (assuming FOO isn't selected/implied).
That might make it clearer to people that a bare 'default n' is
redundant.
This change only affects generated .config files and not autoconf.h:
autoconf.h only includes #defines for non-n bool/tristate symbols.
=== Testing ===
The following testing was done with the x86 Kconfigs:
- .config files generated before and after the change were compared to
verify that the only difference is some '# CONFIG_FOO is not set'
entries disappearing. A couple of these were inspected manually, and
most turned out to be from redundant 'default n/def_bool n'
properties.
- The generated include/generated/autoconf.h was compared before and
after the change and verified to be identical.
- As a sanity check, the same modification was done to Kconfiglib.
The Kconfiglib test suite was then run to check for any mismatches
against the output of the C implementation.
|
|
|
|
|
|
Forgot to rename the helper as well after renaming sync_sym_files() to
sync_deps().
|
|
Implement a scheme from the C tools where symbols get corresponding
files that are touch'ed whenever the symbol's value changes. This can be
used to add e.g. Makefile dependencies between source files and
particular symbols.
See the docstring of the new sync_deps() function for more information.
Piggyback a small sanity check for write_autoconf().
|
|
They're really minor, and copying them around when new output functions
are added gets a bit silly.
These functions are used as a reference too, so maximum readability
helps.
|
|
The previous return value was None.
Returning "" makes write_config() neater and feels a bit more Pythonic.
It might simplify the implementation of some planned features as well.
This is a small API break, so the major version will be bumped to 4 in
the next release.
Only code that explicitly tests Symbol.config_string against None will
be affected: 'if sym.config_string is None:' will break, but not
'if not sym.config_string:'.
|