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

Unified Diff: build/linux/install-arm-sysroot.py

Issue 11468014: Download arm sysroot as part of gclient hooks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit Created 8 years 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
« no previous file with comments | « build/install-build-deps.sh ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/linux/install-arm-sysroot.py
diff --git a/build/linux/install-arm-sysroot.py b/build/linux/install-arm-sysroot.py
new file mode 100755
index 0000000000000000000000000000000000000000..8b1fcb2ed47378b0e239f89e546ac53422b6a835
--- /dev/null
+++ b/build/linux/install-arm-sysroot.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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 to install arm choot image for cross building of arm chrome on linux.
+# This script can be run manually but is more often run as part of gclient
+# hooks. When run from hooks this script should be a no-op on non-linux
+# platforms.
+
+# The sysroot image could be constructed from scratch based on the current
+# state or precise/arm but for consistency we currently use a pre-built root
+# image which was originally designed for building trusted NaCl code. The image
+# will normally need to be rebuilt every time chrome's build dependancies are
+# changed.
+
+import os
+import sys
+
+
+script_dir = os.path.dirname(os.path.abspath(__file__))
iannucci 2012/12/07 22:43:39 nit: I would upcase SCRIPT_DIR
Sam Clegg 2012/12/07 23:39:19 Done.
+
+
+def main(args):
+ if '--linux-only' in args:
+ # This argument is passed when run from the gclient hooks.
+ # In this case we return early on non-linux platforms
+ # or if GYP_DEFINES doesn't include target_arch=arm
+ if not sys.platform.startswith('linux'):
+ return 0
+
+ if "target_arch=arm" not in os.environ.get('GYP_DEFINES', ''):
+ return 0
+
+ src_root = os.path.dirname(os.path.dirname(script_dir))
+ sysroot = os.path.join(src_root, 'arm-sysroot')
+ url_prefix = 'https://commondatastorage.googleapis.com/nativeclient-archive2/toolchain'
+ rev = 8002
+ url = "%s/%s/naclsdk_linux_arm-trusted.tgz" % (url_prefix, rev)
iannucci 2012/12/07 22:43:39 nit: These could be globals, since the don't reall
Sam Clegg 2012/12/07 23:39:19 Done.
+
+ stamp = os.path.join(sysroot, ".stamp")
+ if os.path.exists(stamp):
+ with open(stamp) as s:
+ if s.read() == url:
+ print "ARM root image already up-to-date: %s" % sysroot
+ return 0
+
+ print "Installing ARM root image: %s" % sysroot
+ if not os.path.isdir(sysroot):
+ os.mkdir(sysroot)
+ tarball = os.path.join(sysroot, 'naclsdk_linux_arm-trusted.tgz')
+ rtn = os.system('curl -L "%s" -o "%s"' % (url, tarball))
+ if rtn:
+ return rtn
iannucci 2012/12/07 22:43:39 Could this make an extra tarball file if curl abor
Sam Clegg 2012/12/07 23:39:19 I'm actually not a fan of too much use of tmpfiles
+ rtn = os.system('tar xf %s -C %s' % (tarball, sysroot))
iannucci 2012/12/07 22:43:39 Does it make sense to nuke the existing sysroot?
Sam Clegg 2012/12/07 23:39:19 Ooops, yes, thanks. Done
+ if rtn:
+ return rtn
+ os.remove(tarball)
+ open(stamp, 'w').write(url)
iannucci 2012/12/07 22:43:39 nit: I would explicitly close the file (probably w
Sam Clegg 2012/12/07 23:39:19 Done.
+
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))
« no previous file with comments | « build/install-build-deps.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698