Commit 95c26718 authored by sbc's avatar sbc Committed by Commit bot

Add --running-as-hooks argument to install-debian.wheezy.sysroot.py

Previously this was called --linux-only which was a little
misleading since this flag is really used to detect when
it running via the hooks.

Review URL: https://codereview.chromium.org/1099003002

Cr-Commit-Position: refs/heads/master@{#329579}
parent baf3044e
...@@ -549,7 +549,7 @@ hooks = [ ...@@ -549,7 +549,7 @@ hooks = [
'action': [ 'action': [
'python', 'python',
'src/chrome/installer/linux/sysroot_scripts/install-debian.wheezy.sysroot.py', 'src/chrome/installer/linux/sysroot_scripts/install-debian.wheezy.sysroot.py',
'--linux-only'], '--running-as-hook'],
}, },
{ {
# Update the Windows toolchain if necessary. # Update the Windows toolchain if necessary.
......
...@@ -88,10 +88,7 @@ def DetectArch(gyp_defines): ...@@ -88,10 +88,7 @@ def DetectArch(gyp_defines):
def main(): def main():
if options.linux_only: if options.running_as_hook and not sys.platform.startswith('linux'):
# This argument is passed when run from the gclient hooks.
# In this case we return early on non-linux platforms.
if not sys.platform.startswith('linux'):
return 0 return 0
gyp_defines = os.environ.get('GYP_DEFINES', '') gyp_defines = os.environ.get('GYP_DEFINES', '')
...@@ -104,15 +101,15 @@ def main(): ...@@ -104,15 +101,15 @@ def main():
print 'Unable to detect host architecture' print 'Unable to detect host architecture'
return 1 return 1
if options.linux_only and target_arch != 'arm': if options.running_as_hook and target_arch != 'arm':
# When run from runhooks, only install the sysroot for an Official Chrome # When run from runhooks, only install the sysroot for an Official Chrome
# Linux build, except on ARM where we always use a sysroot. # Linux build, except on ARM where we always use a sysroot.
defined = ['branding=Chrome', 'buildtype=Official'] skip_if_defined = ['branding=Chrome', 'buildtype=Official']
undefined = ['chromeos=1'] skip_if_undefined = ['chromeos=1']
for option in defined: for option in skip_if_defined:
if option not in gyp_defines: if option not in gyp_defines:
return 0 return 0
for option in undefined: for option in skip_if_undefined:
if option in gyp_defines: if option in gyp_defines:
return 0 return 0
...@@ -173,9 +170,11 @@ def main(): ...@@ -173,9 +170,11 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
parser = optparse.OptionParser('usage: %prog [OPTIONS]') parser = optparse.OptionParser('usage: %prog [OPTIONS]')
parser.add_option('--linux-only', action='store_true', parser.add_option('--running-as-hook', action='store_true',
default=False, help='Only install sysroot for official ' default=False, help='Used when running from gclient hooks.'
'Linux builds') ' In this mode the sysroot will only '
'be installed for official Linux '
'builds or ARM Linux builds')
parser.add_option('--arch', type='choice', choices=valid_archs, parser.add_option('--arch', type='choice', choices=valid_archs,
help='Sysroot architecture: %s' % ', '.join(valid_archs)) help='Sysroot architecture: %s' % ', '.join(valid_archs))
options, _ = parser.parse_args() options, _ = parser.parse_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