summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-08-04 09:30:30 (GMT)
committerSimon Glass <sjg@chromium.org>2017-09-12 03:43:58 (GMT)
commit8639f69a61b47971dba47ab5ed72e47436729bb1 (patch)
tree05510aa7c0d0ef1acc2aab1561c6f65b1ca133be /tools
parentee3e520dad0b368df4541cd0af0d4011cf481e5b (diff)
downloadu-boot-8639f69a61b47971dba47ab5ed72e47436729bb1.tar.xz
genconfig.py: Print defconfig next to warnings
At present we sometimes see warnings of the form: /tmp/tmpMA89kB:36: warning: overriding the value of CMD_SPL. Old value: "y", new value: "y". This is not very useful as it does not show whch defconfig file it relates to. Update the tool to show this. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/buildman/kconfiglib.py22
-rwxr-xr-xtools/genboardscfg.py7
2 files changed, 21 insertions, 8 deletions
diff --git a/tools/buildman/kconfiglib.py b/tools/buildman/kconfiglib.py
index d28bbf0..352ad43 100644
--- a/tools/buildman/kconfiglib.py
+++ b/tools/buildman/kconfiglib.py
@@ -204,6 +204,7 @@ class Config(object):
self.print_warnings = print_warnings
self.print_undef_assign = print_undef_assign
+ self._warnings = []
# For parsing routines that stop when finding a line belonging to a
# different construct, these holds that line and the tokenized version
@@ -398,8 +399,12 @@ class Config(object):
need to refer to the top-level kernel directory with "$srctree".
replace (default: True): True if the configuration should replace the
- old configuration; False if it should add to it."""
+ old configuration; False if it should add to it.
+ Returns a list or warnings (hopefully empty)
+ """
+
+ self._warnings = []
# Put this first so that a missing file doesn't screw up our state
filename = os.path.expandvars(filename)
line_feeder = _FileFeed(filename)
@@ -449,7 +454,7 @@ class Config(object):
while 1:
line = line_feeder.get_next()
if line is None:
- return
+ return self._warnings
line = line.rstrip()
@@ -1763,8 +1768,10 @@ class Config(object):
def _warn(self, msg, filename=None, linenr=None):
"""For printing warnings to stderr."""
+ msg = _build_msg("warning: " + msg, filename, linenr)
if self.print_warnings:
- _stderr_msg("warning: " + msg, filename, linenr)
+ sys.stderr.write(msg + "\n")
+ self._warnings.append(msg)
class Item(object):
@@ -3369,10 +3376,13 @@ def _clean_up_path(path):
path = path[2:]
return path.rstrip("/")
-def _stderr_msg(msg, filename, linenr):
+def _build_msg(msg, filename, linenr):
if filename is not None:
- sys.stderr.write("{0}:{1}: ".format(_clean_up_path(filename), linenr))
- sys.stderr.write(msg + "\n")
+ msg = "{0}:{1}: ".format(_clean_up_path(filename), linenr) + msg
+ return msg
+
+def _stderr_msg(msg, filename, linenr):
+ sys.stderr.write(_build_msg(msg, filename, linenr) + "\n")
def _tokenization_error(s, filename, linenr):
loc = "" if filename is None else "{0}:{1}: ".format(filename, linenr)
diff --git a/tools/genboardscfg.py b/tools/genboardscfg.py
index 2e871fe..2345a19 100755
--- a/tools/genboardscfg.py
+++ b/tools/genboardscfg.py
@@ -124,7 +124,7 @@ class KconfigScanner:
os.environ['srctree'] = os.getcwd()
os.environ['UBOOTVERSION'] = 'dummy'
os.environ['KCONFIG_OBJDIR'] = ''
- self._conf = kconfiglib.Config()
+ self._conf = kconfiglib.Config(print_warnings=False)
def __del__(self):
"""Delete a leftover temporary file before exit.
@@ -166,7 +166,10 @@ class KconfigScanner:
else:
f.write(line[colon + 1:])
- self._conf.load_config(self._tmpfile)
+ warnings = self._conf.load_config(self._tmpfile)
+ if warnings:
+ for warning in warnings:
+ print '%s: %s' % (defconfig, warning)
try_remove(self._tmpfile)
self._tmpfile = None