Commit 66d5aafd authored by justincohen's avatar justincohen Committed by Commit bot

Support bot sudoers for xcode-select and xcodebuild.

BUG=474373

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

Cr-Commit-Position: refs/heads/master@{#383869}
parent 947c4975
...@@ -10,8 +10,9 @@ xcode-select is already set and points to an external folder ...@@ -10,8 +10,9 @@ xcode-select is already set and points to an external folder
|TOOLCHAIN_REVISION|-|TOOLCHAIN_SUB_REVISION| below, GYP_DEFINE |TOOLCHAIN_REVISION|-|TOOLCHAIN_SUB_REVISION| below, GYP_DEFINE
mac_toolchain_revision can be used instead. mac_toolchain_revision can be used instead.
This script will only run on machines if /usr/bin/xcodebuild has been added to This script will only run on machines if /usr/bin/xcodebuild and
the sudoers list so the license can be accepted. /usr/bin/xcode-select has been added to the sudoers list so the license can be
accepted.
Otherwise, user input would be required to complete the script. Perhaps future Otherwise, user input would be required to complete the script. Perhaps future
versions can be modified to allow for user input on developer machines. versions can be modified to allow for user input on developer machines.
...@@ -93,10 +94,13 @@ def CanAccessToolchainBucket(): ...@@ -93,10 +94,13 @@ def CanAccessToolchainBucket():
def AcceptLicense(directory): def AcceptLicense(directory):
"""Use xcodebuild to accept new toolchain license. This only """Use xcodebuild to accept new toolchain license. This only
works if xcodebuild is in sudoers.""" works if xcodebuild and xcode-select are in sudoers."""
xcodebuild = os.path.join(TOOLCHAIN_BUILD_DIR, xcodebuild_dir = os.path.join(TOOLCHAIN_BUILD_DIR, 'Contents/Developer')
'Contents/Developer/usr/bin/xcodebuild') old_path = subprocess.Popen(['/usr/bin/xcode-select', '-p'],
subprocess.check_call(['sudo', xcodebuild, '-license', 'accept']) stdout=subprocess.PIPE).communicate()[0].strip()
subprocess.check_call(['sudo', '/usr/bin/xcode-select', '-s', xcodebuild_dir])
subprocess.check_call(['sudo', '/usr/bin/xcodebuild', '-license', 'accept'])
subprocess.check_call(['sudo', '/usr/bin/xcode-select', '-s', old_path])
def UseLocalMacSDK(): def UseLocalMacSDK():
......
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