Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: third_party/mac_sdk/package.py

Issue 1759793003: Scripts to upload and update the mac toolchain. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use full path Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/mac_sdk/package.py
diff --git a/third_party/mac_sdk/package.py b/third_party/mac_sdk/package.py
new file mode 100755
index 0000000000000000000000000000000000000000..8d930a3078d456ccac5c749839464c8b4358fafc
--- /dev/null
+++ b/third_party/mac_sdk/package.py
@@ -0,0 +1,93 @@
+#!/usr/bin/env python
+# Copyright (c) 2016 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.
+
+"""Compress and upload Xcode sdk files."""
+
+import argparse
+import glob
+import os
+import plistlib
+import re
+import subprocess
+import sys
+import tarfile
+import tempfile
+
+
+SDK_URL = "gs://chrome-mac-sdk"
+
+
+
+EXCLUDE_FOLDERS = [
erikchen 2016/03/03 01:45:47 This will need to be manually updated with each ro
justincohen 2016/03/03 18:58:33 Added a comment explaining. /Platforms!MacOsx giv
+'Contents/Applications',
+'Contents/Developer/Documentation',
+'Contents/Developer/Platforms/AppleTVOS.platform',
+'Contents/Developer/Platforms/AppleTVSimulator.platform',
+'Contents/Developer/Platforms/WatchOS.platform',
+'Contents/Developer/Platforms/WatchSimulator.platform',
+'Contents/Developer/Platforms/iPhoneOS.platform',
+'Contents/Developer/Platforms/iPhoneSimulator.platform',
+'Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator',
+'Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift',
+'Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/share/man',
+'Contents/Developer/Library/Xcode/Templates'
+]
+
+def PrintTarProgress(tarinfo):
+ print 'Adding', tarinfo.name
erikchen 2016/03/03 01:45:47 I'm not a python guru, but I think it's good pract
justincohen 2016/03/03 18:58:33 Removed.
+ return tarinfo
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('target_dir',
+ help="Xcode installation contents directory.")
+ parser.add_argument('args', nargs='*', help="run ibtool command")
+ args = parser.parse_args()
+
+ contents_dir = os.path.join(args.target_dir, 'Contents')
+ plist_file = os.path.join(contents_dir, 'version.plist')
+ try:
+ info = plistlib.readPlist(plist_file)
+ except:
+ print "Invalid Xcode contents dir."
+ return 0
+ build_version = info['ProductBuildVersion']
+
+ p = subprocess.Popen(['gsutil.py', '--force-version', '4.15', '--', 'ls',
erikchen 2016/03/03 01:45:46 why --force-version?
justincohen 2016/03/03 18:58:33 Removed.
+ '%s/sdk-%s-*.tgz' % (SDK_URL, build_version)],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+
+ output = p.communicate()[0]
+ next_count = 1
+ if p.returncode == 0:
+ next_count = len(output.split('\n'))
+ sys.stdout.write("%s already exists %s times. "
+ "Do you want to create another? [y/n] "
+ % (build_version, next_count - 1))
+
+ if raw_input().lower() not in set(['yes','y', 'ye']):
+ print "Skipping additional upload."
+ return 0
+
+ os.chdir(args.target_dir)
+ sdk_file_name = "sdk-%s-%s" % (build_version, next_count)
+ sdk_name = tempfile.mktemp(suffix='sdk.tgz')
erikchen 2016/03/03 01:45:47 caller is responsible for cleaning up directory af
justincohen 2016/03/03 18:58:33 Done.
+ print "Creating %s (%s)." % (sdk_file_name, sdk_name)
+ os.environ["COPYFILE_DISABLE"] = "1"
+ args = ['tar', '-cvpzf', sdk_name]
erikchen 2016/03/03 01:45:47 preserve permissions? How does that work when you
justincohen 2016/03/03 18:58:33 Removed 'p'
+ args.extend(map('--exclude={0}'.format, EXCLUDE_FOLDERS))
+ args.extend(['.'])
+ subprocess.check_call(args)
+
+ print "Uploading %s SDK." % sdk_file_name
+ subprocess.check_call(['gsutil.py', '--force-version', '4.15', '--', 'cp',
+ '-n', '-a', 'public-read', sdk_name,
+ '%s/%s.tgz' % (SDK_URL, sdk_file_name)])
+ print "Done with %s upload." % sdk_file_name
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(main())

Powered by Google App Engine
This is Rietveld 408576698