Commit 279f3ffa authored by Junji Watanabe's avatar Junji Watanabe Committed by Chromium LUCI CQ

[build] remove unused Swarming xcode install scripts

run_swarming_xcode_install.py triggers a Swarming task to install Xcode using Isolate server.
But Isolate server will be deprecated, soon.

I don't see the Xcode install Swarming tasks in BigQuery. (past 1.5 years)
http://screen/3SWDKkx69n3U8Hp

So should be safe to remove them.

Bug: 1163817
Change-Id: Ic52eb284f1209a370f02ebb0383180ab31f555d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2626480
Auto-Submit: Junji Watanabe <jwata@google.com>
Reviewed-by: default avatarTakuto Ikuta <tikuta@chromium.org>
Reviewed-by: default avatarZhaoyang Li <zhaoyangli@chromium.org>
Commit-Queue: Junji Watanabe <jwata@google.com>
Cr-Commit-Position: refs/heads/master@{#843339}
parent 64cc7d2e
#!/usr/bin/env python
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This script runs swarming_xcode_install on the bots. It should be run when we
need to upgrade all the swarming testers. It:
1) Packages two python files into an isolate.
2) Runs the isolate on swarming machines that satisfy certain dimensions.
Example usage:
$ ./build/run_swarming_xcode_install.py --luci_path ~/work/luci-py \
--swarming-server touch-swarming.appspot.com \
--isolate-server touch-isolate.appspot.com
"""
from __future__ import print_function
import argparse
import os
import shutil
import subprocess
import sys
import tempfile
def main():
parser = argparse.ArgumentParser(
description='Run swarming_xcode_install on the bots.')
parser.add_argument('--luci_path', required=True, type=os.path.abspath)
parser.add_argument('--swarming-server', required=True, type=str)
parser.add_argument('--isolate-server', required=True, type=str)
parser.add_argument('--batches', type=int, default=25,
help="Run xcode install in batches of size |batches|.")
parser.add_argument('--dimension', nargs=2, action='append')
args = parser.parse_args()
args.dimension = args.dimension or []
script_dir = os.path.dirname(os.path.abspath(__file__))
tmp_dir = tempfile.mkdtemp(prefix='swarming_xcode')
try:
print('Making isolate.')
shutil.copyfile(os.path.join(script_dir, 'swarming_xcode_install.py'),
os.path.join(tmp_dir, 'swarming_xcode_install.py'))
shutil.copyfile(os.path.join(script_dir, 'mac_toolchain.py'),
os.path.join(tmp_dir, 'mac_toolchain.py'))
luci_client = os.path.join(args.luci_path, 'client')
cmd = [
sys.executable, os.path.join(luci_client, 'isolateserver.py'), 'archive',
'-I', args.isolate_server, tmp_dir,
]
isolate_hash = subprocess.check_output(cmd).split()[0]
print('Running swarming_xcode_install.')
# TODO(crbug.com/765361): The dimensions below should be updated once
# swarming for iOS is fleshed out, likely removing xcode_version 9 and
# adding different dimensions.
luci_tools = os.path.join(luci_client, 'tools')
dimensions = [['pool', 'Chrome'], ['xcode_version', '9.0']] + args.dimension
dim_args = []
for d in dimensions:
dim_args += ['--dimension'] + d
cmd = [
sys.executable, os.path.join(luci_tools, 'run_on_bots.py'),
'--swarming', args.swarming_server, '--isolate-server',
args.isolate_server, '--priority', '20', '--batches', str(args.batches),
'--tags', 'name:run_swarming_xcode_install',
] + dim_args + ['--name', 'run_swarming_xcode_install', '--', isolate_hash,
'python', 'swarming_xcode_install.py',
]
subprocess.check_call(cmd)
print('All tasks completed.')
finally:
shutil.rmtree(tmp_dir)
return 0
if __name__ == '__main__':
sys.exit(main())
#!/usr/bin/env python
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Script used to install Xcode on the swarming bots.
"""
from __future__ import print_function
import os
import shutil
import subprocess
import sys
import tarfile
import tempfile
import mac_toolchain
VERSION = '9A235'
URL = 'gs://chrome-mac-sdk/ios-toolchain-9A235-1.tgz'
REMOVE_DIR = '/Applications/Xcode9.0-Beta4.app/'
OUTPUT_DIR = '/Applications/Xcode9.0.app/'
def main():
# Check if it's already installed.
if os.path.exists(OUTPUT_DIR):
env = os.environ.copy()
env['DEVELOPER_DIR'] = OUTPUT_DIR
cmd = ['xcodebuild', '-version']
found_version = \
subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE).communicate()[0]
if VERSION in found_version:
print("Xcode %s already installed" % VERSION)
sys.exit(0)
# Confirm old dir is there first.
if not os.path.exists(REMOVE_DIR):
print("Failing early since %s isn't there." % REMOVE_DIR)
sys.exit(1)
# Download Xcode.
with tempfile.NamedTemporaryFile() as temp:
env = os.environ.copy()
env['PATH'] += ":/b/depot_tools"
subprocess.check_call(['gsutil.py', 'cp', URL, temp.name], env=env)
if os.path.exists(OUTPUT_DIR):
shutil.rmtree(OUTPUT_DIR)
if not os.path.exists(OUTPUT_DIR):
os.makedirs(OUTPUT_DIR)
tarfile.open(mode='r:gz', name=temp.name).extractall(path=OUTPUT_DIR)
# Accept license, call runFirstLaunch.
mac_toolchain.FinalizeUnpack(OUTPUT_DIR, 'ios')
# Set new Xcode as default.
subprocess.check_call(['sudo', '/usr/bin/xcode-select', '-s', OUTPUT_DIR])
if os.path.exists(REMOVE_DIR):
shutil.rmtree(REMOVE_DIR)
if __name__ == '__main__':
sys.exit(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