From 7a428aa415606820a44291f475248b08e3952c4b Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sun, 15 Jul 2018 13:16:47 +0200 Subject: Switch to more sensible globbing statements (w/ backwards compatibility) 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. --- tests/Klocation | 14 ++++++++++++-- tests/Kmissingrsource | 1 + tests/Kmissingsource | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 tests/Kmissingrsource create mode 100644 tests/Kmissingsource (limited to 'tests') diff --git a/tests/Klocation b/tests/Klocation index 887e4a0..2604f5b 100644 --- a/tests/Klocation +++ b/tests/Klocation @@ -47,14 +47,24 @@ rsource "$SUB_DIR_FROM_ENV/Klocation$_RSOURCED" # Expands to "tests/*ub/Klocation_gsourced[12]", matching # tests/sub/Klocation_gsourced{1,2} +source "$TESTS_DIR_FROM_ENV/*ub/Klocation$_GSOURCED[12]" +# Test old syntax too gsource "$TESTS_DIR_FROM_ENV/*ub/Klocation$_GSOURCED[12]" # Expands to "sub/Klocation_grsourced[12]", matching # tests/sub/Klocation_grsourced{1,2} +rsource "$SUB_DIR_FROM_ENV/Klocation$_GRSOURCED[12]" +# Test old syntax too grsource "$SUB_DIR_FROM_ENV/Klocation$_GRSOURCED[12]" # No-ops -gsource "nonexistent file" -grsource "nonexistent file" +osource "nonexistent" +osource "nonexistent*" +gsource "nonexistent" +gsource "nonexistent*" +orsource "nonexistent" +orsource "nonexistent*" +grsource "nonexistent" +grsource "nonexistent*" config MULTI_DEF diff --git a/tests/Kmissingrsource b/tests/Kmissingrsource new file mode 100644 index 0000000..924b0b3 --- /dev/null +++ b/tests/Kmissingrsource @@ -0,0 +1 @@ +rsource "nonexistent" diff --git a/tests/Kmissingsource b/tests/Kmissingsource new file mode 100644 index 0000000..a3a6c25 --- /dev/null +++ b/tests/Kmissingsource @@ -0,0 +1 @@ +source "nonexistent" -- cgit v1.2.3