Commit 890362ea authored by Erik Chen's avatar Erik Chen Committed by Commit Bot

Prompt for cipd authentication if 'cipd ensure' fails.

That should be the only reason that 'cipd ensure' ever fails when downloading
the macOS toolchain. Currenlty this is unnecessary because the check already
exists when installing the old toolchain. But this will become necessary after
removing the old toolchain.

Bug: 984746
Change-Id: Icfd51072207e0e140c6059892d665d306b32e32a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1711149
Commit-Queue: Erik Chen <erikchen@chromium.org>
Auto-Submit: Erik Chen <erikchen@chromium.org>
Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#679740}
parent 25782635
......@@ -152,8 +152,16 @@ def InstallXcodeBinaries():
args = [
'cipd', 'ensure', '-root', binaries_root, '-ensure-file', '-'
]
p = subprocess.Popen(args, stdin=subprocess.PIPE)
p.communicate(input=MAC_BINARIES_LABEL + ' ' + MAC_BINARIES_TAG)
p = subprocess.Popen(
args, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, stderr = p.communicate(
input=MAC_BINARIES_LABEL + ' ' + MAC_BINARIES_TAG)
if p.returncode != 0:
print(stdout)
print(stderr)
RequestCipdAuthentication()
return 1
# Accept the license for this version of Xcode if it's newer than the
# currently accepted version.
......@@ -177,7 +185,7 @@ def InstallXcodeBinaries():
should_overwrite_license = False
if not should_overwrite_license:
return
return 0
# Use puppet's sudoers script to accept the license if its available.
license_accept_script = '/usr/local/bin/xcode_accept_license.py'
......@@ -185,7 +193,7 @@ def InstallXcodeBinaries():
args = ['sudo', license_accept_script, '--xcode_version',
cipd_xcode_version, '--license-version', cipd_license_version]
subprocess.call(args)
return
return 0
# Otherwise manually accept the license. This will prompt for sudo.
print('Accepting new Xcode license. Requires sudo.')
......@@ -199,6 +207,8 @@ def InstallXcodeBinaries():
args = ['sudo', 'plutil', '-convert', 'xml1', current_license_path]
subprocess.call(args)
return 0
def main():
if sys.platform != 'darwin':
......@@ -227,9 +237,7 @@ def main():
if not success:
return 1
InstallXcodeBinaries()
return 0
return InstallXcodeBinaries()
if __name__ == '__main__':
......
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