deploy_chrome: Actually warn if deploying a component build.
Previously we were just looking at the GYP_DEFINES variable to identify
component builds, but this doesn't work if the user has overrides in
their .gyp/include.gypi file. So now we analyze the chrome ELF itself
and look for dependencies.
BUG=chromium:196317
TEST=ran locally. unit tests.
Change-Id: I58054fb63f6841eb8c0503a9b8f98dadda058bf2
Reviewed-on: https://gerrit.chromium.org/gerrit/49570
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Ryan Cui <rcui@chromium.org>
Tested-by: Ryan Cui <rcui@chromium.org>
diff --git a/scripts/deploy_chrome.py b/scripts/deploy_chrome.py
index 2caf771..7cb1323 100644
--- a/scripts/deploy_chrome.py
+++ b/scripts/deploy_chrome.py
@@ -38,6 +38,7 @@
from chromite.lib import parallel
from chromite.lib import remote_access as remote
from chromite.lib import stats
+from chromite.scripts import lddtree
_USAGE = "deploy_chrome [--]\n\n %s" % __doc__
@@ -348,12 +349,15 @@
cros_build_lib.Die('When --strict is set, the GYP_DEFINES environment '
'variable must be set.')
- if (options.gyp_defines and
- options.gyp_defines.get('component') == 'shared_library'):
- cros_build_lib.Warning(
- "Detected 'component=shared_library' in GYP_DEFINES. "
- "deploy_chrome currently doesn't work well with component build. "
- "See crosbug.com/196317. Use at your own risk!")
+ if options.build_dir:
+ chrome_path = os.path.join(options.build_dir, 'chrome')
+ if os.path.isfile(chrome_path):
+ deps = lddtree.ParseELF(chrome_path)
+ if 'libbase.so' in deps['libs']:
+ cros_build_lib.Warning(
+ 'Detected a component build of Chrome. component build is '
+ 'not working properly for Chrome OS. See crbug.com/196317. '
+ 'Use at your own risk!')
def _FetchChromePackage(cache_dir, tempdir, gs_path):