Support keyword 'reset'
ElonH opened this issue · comments
I try to parse openwrt project via this python library
btw, get error
tmp/.config-target.in:2554: error: couldn't parse 'reset if !DEVEL': syntax error
tmp/.config-target.in:
choice
prompt "Target System"
default TARGET_x86
reset if !DEVEL
Traceback:
---------------------------------------------------------------------------
KconfigError Traceback (most recent call last)
/mnt/A/opde/openwrt.ipynb in
2 # os.environ['srctree'] = SourceDir.as_posix()
3 os.environ['srctree'] = '/mnt/A/openwrt'
----> 4 kconf = kconfiglib.Kconfig('Config.in')
5 kconf.srctree
/mnt/A/opde/.venv/lib/python3.6/site-packages/kconfiglib.py in __init__(self, filename, warn, warn_to_stderr, encoding, suppress_traceback)
945 """
946 try:
--> 947 self._init(filename, warn, warn_to_stderr, encoding)
948 except (EnvironmentError, KconfigError) as e:
949 if suppress_traceback:
/mnt/A/opde/.venv/lib/python3.6/site-packages/kconfiglib.py in _init(self, filename, warn, warn_to_stderr, encoding)
1083 # Parse the Kconfig files. Returns the last node, which we
1084 # terminate with '.next = None'.
-> 1085 self._parse_block(None, self.top_node, self.top_node).next = None
1086 self.top_node.list = self.top_node.next
1087 self.top_node.next = None
/mnt/A/opde/.venv/lib/python3.6/site-packages/kconfiglib.py in _parse_block(self, end_token, parent, prev)
2987 for filename in filenames:
2988 self._enter_file(filename)
-> 2989 prev = self._parse_block(None, parent, prev)
2990 self._leave_file()
2991
/mnt/A/opde/.venv/lib/python3.6/site-packages/kconfiglib.py in _parse_block(self, end_token, parent, prev)
2987 for filename in filenames:
2988 self._enter_file(filename)
-> 2989 prev = self._parse_block(None, parent, prev)
2990 self._leave_file()
2991
/mnt/A/opde/.venv/lib/python3.6/site-packages/kconfiglib.py in _parse_block(self, end_token, parent, prev)
3077 choice.nodes.append(node)
3078
-> 3079 self._parse_props(node)
3080 self._parse_block(_T_ENDCHOICE, node, node)
3081 node.list = node.next
/mnt/A/opde/.venv/lib/python3.6/site-packages/kconfiglib.py in _parse_props(self, node)
3139 node.dep = self.y
3140
-> 3141 while self._next_line():
3142 t0 = self._tokens[0]
3143
/mnt/A/opde/.venv/lib/python3.6/site-packages/kconfiglib.py in _next_line(self)
2234 self.linenr += 1
2235
-> 2236 self._tokens = self._tokenize(line)
2237 # Initialize to 1 instead of 0 to factor out code from _parse_block()
2238 # and _parse_props(). They immediately fetch self._tokens[0].
/mnt/A/opde/.venv/lib/python3.6/site-packages/kconfiglib.py in _tokenize(self, s)
2369 # we have a preprocessor variable assignment (or a bare macro on a
2370 # line)
-> 2371 self._parse_assignment(s)
2372 return (None,)
2373
/mnt/A/opde/.venv/lib/python3.6/site-packages/kconfiglib.py in _parse_assignment(self, s)
2625 rhs_match = _assignment_rhs_match(s, i)
2626 if not rhs_match:
-> 2627 self._parse_error("syntax error")
2628
2629 op, val = rhs_match.groups()
/mnt/A/opde/.venv/lib/python3.6/site-packages/kconfiglib.py in _parse_error(self, msg)
3880 "" if self.filename is None else
3881 "{}:{}: ".format(self.filename, self.linenr),
-> 3882 self._line.strip(), msg))
3883
3884 def _trailing_tokens_error(self):
KconfigError: tmp/.config-target.in:2554: error: couldn't parse 'reset if !DEVEL': syntax error
I found the openwrt ducument.
openwrt changed some code at kconfig
These files were taken from the Linux Kernel Configuration System at commit
089b7d890f972f6b649fedc9259f6b93a18fb970 (Feb 4, 2020) and modified for the
OpenWrt Buildroot:
- Removed gconf, tests and kernel configuration targets.
- Adjusted the Makefile to compile outside the kernel.
- Always use default file when running make all{no,mod,yes}config.
- Added a 'reset' command to reset config when the target changes.
- Allow config reading from & writing to a different file.
- Allow 'source' command to use globs to include multiple files.
- Don't warn when selecting a symbol with unmet direct dependencies.
- Don't write auto.conf and other files under include/ directory.
- Reverted a commit to allow use of '/' & '.' in unquoted config symbols.
There are too many of those in OpenWrt right now.
- Reverted a commit that was issuing a warning when there were more than
one help text. This is used in a few packages to use different texts
for the menuconfig help, and the ipkg package description.
- Reverted an upstream change that avoids writing symbols that are not
visible to .config, which breaks OpenWrt busybox's '.config' generation
logic.
- Treat recursive dependency as a warning only; add a --fatalrecursive
option to conf to treat recursive deps as a fatal error.
- Use pre-built *.lex.c *.tab.[ch] files by default, to avoid depending on
flex & bison. Rebuild/remove these files only if running make with
BUILD_SHIPPED_FILES defined
For a full list of changes, see the repository at:
https://github.com/cotequeiroz/linux/commits/openwrt/scripts/kconfig