| Age | Commit message (Collapse) | Author |
|
Needs an initial rm_config() after earlier reorganization.
|
|
Missing 'not'. Add some literals to the Kstrict testcase.
|
|
Settings KCONFIG_STRICT to y in the environment turns on warnings for
all references to undefined symbols within Kconfig files (with the only
gotcha that hex literals must be prefixed by 0x or 0X, to make it
possible to distinguish them from undefined references).
Always flagging undefined references gets awkward, as some projects
(e.g. the Linux kernel) use multiple Kconfig trees with shared files,
leading to some safe undefined references. It's helpful for other
projects though.
Having KCONFIG_STRICT as an environment variable is handy when multiple
tools are involved.
Piggyback a small README change re. warnings. Kconfiglib now has many
more warnings than the C tools.
|
|
Analogous to def_bool and def_tristate, setting the type and adding a
default at the same time.
This is a Kconfiglib extension. These keywords can be useful in projects
that make use of symbols defined in multiple locations, and remove some
Kconfig inconsistency.
|
|
Instead of having 'source' and 'gsource', have 'source' always glob, but
require the pattern to match at least one file, throwing KconfigError
otherwise.
Have separate 'osource' and 'orsource' statements (the o is for
"optional") for cases where it's okay for the pattern to not match any
files.
This is analogous to 'include' and '-include' in Make.
The biggest flaw with 'gsource' was that there was no way to do a
globbing match while requiring something to match, possibly leading to
subtle failures.
Preserve backwards compatibility by having "gsource" and "grsource" be
aliases for "osource" and "orsource", respectively.
Also include some related changes:
- Kconfig.srctree is now set to the empty string if $srctree is unset,
rather than to None. This gives nice behavior with os.path.join() and
os.path.relpath(), which treat the empty string as the current
directory (without adding './', for os.path.join()).
- When $srctree is set, Kconfig files in the current directory will no
longer override Kconfig files in $srctree when the relative paths
match. This was likely a bug all along in the C tools, and probably
only makes sense for .config files.
I've seen it cause breakage in Zephyr.
- Clarify the behavior of $srctree in the Kconfig.__init__() docstring.
- Make MenuNode.filename be relative to $srctree for the Kconfig file
passed to Kconfig.__init__(). This makes it consistent.
The major version will be bumped later due to the small Kconfig.srctree
API change.
|
|
When using gsource with $srctree set to an absolute path, the $srctree
prefix would show up in MenuNode.filename, trickling its way into e.g.
generated documentation.
This was due to a broken test: os.path.isabs() was checked after joining
the pattern with $srctree, making it mistake an absolute $srctree for an
absolute path in the Kconfig file.
Fix the test.
|
|
Only out-of-range user values generated warnings before.
The C tools warn for neither of them.
|
|
Implement the Kconfig preprocessor described in
https://github.com/torvalds/linux/blob/master/Documentation/kbuild/kconfig-macro-language.txt
(which is now in linux-next and will appear in Linux 4.18).
A new Kconfig.variables property holds all the preprocessor variables so
that they can be inspected programmatically. Preprocessor variables are
represented by a new Variable class.
With the preprocessor, environment variables are referenced with $(FOO)
instead of $FOO. For backwards compatibility, $FOO is accepted as well
for now (and leaves "$FOO" as-is if FOO doesn't exist). The $FOO syntax
might be dropped at some point in the future (together with a major
version increase). It should be supported for a few months at least.
Some internals were cleaned up too, mostly related to parsing. Some
outdated documentation was fixed as well.
|
|
Have _tokenize() take the string to tokenize and return a list of
tokens, and handle all the token list management outside.
Simplifies the internal logic a bit. Likely faster too.
|
|
Having it as a function is inconsistent, since all other read-only
fields use properties. Oversight.
Major version will be bumped to 7, though the function version wasn't in
for long.
|
|
Returns the union of the MenuNode.referenced() sets for all the menu
nodes of the symbol/choice.
|
|
This exception is generated for semantic errors and e.g. when dependency
loops are detected as well, so the name is bad.
Keep the old name as an alias for now for backwards compatibility.
|
|
Pretty long overdue.
Until now, dependency loops have raised a hard-to-debug Python
RecursionError during evaluation. A Kconfiglib exception is raised now
instead, with a message that lists all the items in the loop.
See the comment at the start of _check_dep_loop_sym() for an overview of
the algorithm. At a high level, it's loop detection in a directed graph
by keeping track of unvisited/visited nodes during depth-first search.
(A third "visited, known to not be in a dependency loop" state is used
as well.)
Choices complicate things, as they're inherently loopy: The choice
depends on the choice symbols and vice versa, and the choice symbols in
a sense all depend on each other.
Add the choice-to-choice-symbol dependencies separately after dependency
loop detection, so that there's just the choice-symbol-to-choice
dependencies to deal with. It simplifies things, as it makes it possible
to tell dependencies from 'prompt' and 'default' conditions on the
choice from choice symbol dependencies.
Do some flag shenanigans to prevent the choice from being "re-entered"
while looping through the choice symbols. Maybe this could be cleaned up
a bit somehow...
Example exception message:
Dependency loop
===============
A (defined at tests/Kdeploop10:1), with definition...
config A
bool
depends on B
...depends on B (defined at tests/Kdeploop10:5), with definition...
config B
bool
depends on C = 7
...depends on C (defined at tests/Kdeploop10:9), with definition...
config C
int
range D 8
...depends on D (defined at tests/Kdeploop10:13), with definition...
config D
int
default 3 if E
default 8
...depends on E (defined at tests/Kdeploop10:18), with definition...
config E
bool
(select-related dependencies: F && G)
...depends on G (defined at tests/Kdeploop10:25), with definition...
config G
bool
depends on H
...depends on the choice symbol H (defined at tests/Kdeploop10:32), with definition...
config H
bool
prompt "H" if I && <choice>
depends on I && <choice>
...depends on the choice symbol I (defined at tests/Kdeploop10:41), with definition...
config I
bool
prompt "I" if <choice>
depends on <choice>
...depends on <choice> (defined at tests/Kdeploop10:38), with definition...
choice
bool
prompt "choice" if J
...depends on J (defined at tests/Kdeploop10:46), with definition...
config J
bool
depends on A
...depends again on A (defined at tests/Kdeploop10:1)
|
|
This case wasn't covered.
|
|
The property lists weren't created for Kconfig.top_node, making
referenced() crash.
Add a MenuNode constructor and create the property lists there instead
of in _parse_properties().
|
|
_propagate_deps() visits menu nodes roughly breadth-first, meaning
properties on symbols and choices defined in multiple locations could
end up in the wrong order when copied from the menu node for some
unlucky if/menu nestings.
Fix it by moving the menu-node-to-symbol/choice property copying in
_finalize_tree() so that it's guaranteed to happen in definition order.
This bug was introduced by commit 63a4418 ("Record which MenuNode has
each property").
|
|
MenuNode.referenced() returns all symbols (and choices, for choice
symbols) referenced in the properties (prompt, defaults, selects,
ranges, etc.) and property conditions of the menu node.
Handy e.g. when generating cross-references.
|
|
Handy e.g. when searching.
|
|
The defconfig tests tend to find any issue quickly, so keep those first.
Go alldefconfig -> allnoconfig -> allmodconfig -> allyesconfig after
that, and do the sanity checks at the end.
|
|
Verified to produce identical output to 'make allmodconfig', for all
arches.
Will be packaged.
|
|
Will be packaged.
Piggyback test suite cleanups to make test names match the name of the
script being tested.
|
|
standard_kconfig() gets the top-level Kconfig file from the first
command-line argument, defaulting to "Kconfig". This removes some
boilerplate from tools.
|
|
Move to the root, simplify a bit, provide an entry point function (for
setuptools's entry_points).
|
|
Handy e.g. when implementing advanced search features.
|
|
Useful in various places outside the library, e.g. in the upcoming
packaged allyesconfig implementation, and when generating documentation.
|
|
Put to-be-packaged stuff in the root.
Use allnoconfig_simpler.py, and rename allnoconfig.py to
allnoconfig_walk.py and keep it as an example.
|
|
Had missed sys.exit(msg).
|
|
Commit cbf32e2 ("Expand environment variables in strings directly")
added direct expansion of environment variables is strings, with commit
b9384a1 ("Restore compatibility with $UNAME_RELEASE") adding a hack to
restore compatibility with the predefined $UNAME_RELEASE symbol, used by
DEFCONFIG_LIST in the Linux kernel.
With the compatibility hack in place, there's no longer any need to
define UNAME_RELEASE as a proper symbol. Remove it.
|
|
Shaves ~6% off the _parse_help() runtime for the x86 Kconfigs in
cProfile.
|
|
This allows accurate documentation to be generated for symbols and
choices defined in multiple locations. There are now MenuNode.defaults,
MenuNode.selects, etc., lists that mirror the corresponding
Symbol/Choice lists.
Symbol/Choice.__str__() now correctly show property locations as well,
by simply concatenating the strings returned by MenuNode.__str__() for
each node.
_parse_properties() was modified to add all properties directly to the
menu node instead of adding them to the contained symbol or choice. The
properties are then copied up to symbols and choices in
_finalize_tree(). Dependency propagation is handled at the same time.
As a side effect, this cleans up the code a bit and de-bloats
_parse_properties().
Update the menuconfig implementation to use the new functionality. It
now lists the menu nodes for symbols and choices with the correct
properties for each node (previously, all defaults, selects, implies,
and ranges appeared on the first definition).
|
|
Make "$FOO" directly reference the environment variable $FOO in e.g.
'source' statements, instead of the symbol FOO. Use os.path.expandvars()
to expand strings (which preserves "$FOO" as-is if no environment
variable FOO exists).
This gets rid of the 'option env' "bounce" symbols, which are mostly
just spam and are buggy in the C tools (dependencies aren't always
respected, due to parsing and evaluation getting mixed up). The same
change will probably appear soon in the C tools as well.
Keep accepting 'option env' to preserve some backwards compatibility,
but ignore it when expanding strings. For compatibility with the C
tools, bounce symbols will need to be named the same as the environment
variables they reference (which is the case for the Linux kernel).
This is a compatibility break, so the major version will be bumped to 6
at the next release.
The main motivation for adding this now is to allow recording properties
on each MenuNode in a clean way. 'option env' symbols interact badly
with delayed dependency propagation.
Side note: I have a feeling that recording environment variable values
might be redundant to trigger rebuilds if sync_deps() is run at each
compile. It should detect all changes to symbol values due to
environment variables changing value.
|
|
Also make printing of warnings to stderr optional. It's on by default,
since it's almost always what you want.
This makes printing and processing of warnings more flexible, compared
to always printing warnings to stderr as soon as they're generated. It
was inspired by wanting to promote certain warnings to errors in Zephyr,
which previously required capturing stderr.
|
|
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.
|
|
Oversight
|
|
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)".
|
|
- 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
|
|
The Kconfig object is replaced immediately after it.
|
|
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.
|
|
Removed in linux-next.
|
|
Just for completeness.
|
|
'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.
|
|
defconfig_files() yields all the defconfig files for a particular arch/
subdirectory. This will allow reuse when savedefconfig is tested.
Also simplify the code a bit.
|
|
Not that important of a stat, plus there might be more tests that
process defconfig files soon, making it kinda meaningless.
|
|
No great need to log timestamps anymore.
|
|
The 'for' overrode 'srcarch', which is currently harmless, but ugly.
|
|
Makes sense as SRCARCH holds the arch/ subdirectory and _arch might be
confused for ARCH.
|
|
Get rid of the compare_configs flag and just do the comparison from the
test functions themselves with a helper.
Also get rid of the test_load() test. That's indirectly tested through
the other tests, and test_alldefconfig() runs first and is speedy.
|
|
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().
|