Commit fcbd5218 authored by Pavel Yatsuk's avatar Pavel Yatsuk Committed by Commit Bot

tools/mb/mb.py should handle gn args with different number of spaces

Currently GNArgsFromDir expects gn arg to have exactly one space around
assignment operator (target_os = "android"). It removes both spaces so
that later the code could to a check in the form
('target_os="android"' in vals['gn_args']). If an arg doesn't have
spaces or have extra (target_os ="android"), the logic works
incorrectly.

This CL fixes GNArgsFromDir to break name/value line on '=' and strip
spaces around both name and value.

BUG=1066289

Change-Id: I958b2cb400415f33f6b5310da0f127df715bd059
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2127742
Commit-Queue: Pavel Yatsuk <pavely@chromium.org>
Reviewed-by: default avatarGarrett Beaty <gbeaty@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754718}
parent c275fc57
......@@ -884,10 +884,8 @@ class MetaBuildWrapper(object):
l = l.split('#', 2)[0].strip()
if not l:
continue
fields = l.split(' ')
name = fields[0]
val = ' '.join(fields[2:])
gn_args.append('%s=%s' % (name, val))
(name, value) = l.split('=', 1)
gn_args.append('%s=%s' % (name.strip(), value.strip()))
return ' '.join(gn_args)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment