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

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

Issue 2272273002: Desktop Chrome OS: Build with precise sysroot (Reland) (Closed)
Patch Set: Update license check scripts Created 4 years, 4 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
« no previous file with comments | « build/config/sysroot.gni ('k') | tools/checklicenses/checklicenses.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/linux/sysroot_scripts/install-sysroot.py
diff --git a/build/linux/sysroot_scripts/install-sysroot.py b/build/linux/sysroot_scripts/install-sysroot.py
index 9622176bf9b0f17a06a9439bcf38135942e6557e..3e842a47cdd9312a1a7af030aa417957684e465f 100755
--- a/build/linux/sysroot_scripts/install-sysroot.py
+++ b/build/linux/sysroot_scripts/install-sysroot.py
@@ -35,26 +35,45 @@ import gyp_environment
URL_PREFIX = 'https://commondatastorage.googleapis.com'
URL_PATH = 'chrome-linux-sysroot/toolchain'
-REVISION_AMD64 = '24f935a3d8cdfcdfbabd23928a42304b1ffc52ba'
-REVISION_ARM = '24f935a3d8cdfcdfbabd23928a42304b1ffc52ba'
-REVISION_ARM64 = '24f935a3d8cdfcdfbabd23928a42304b1ffc52ba'
-REVISION_I386 = '24f935a3d8cdfcdfbabd23928a42304b1ffc52ba'
-REVISION_MIPS = '24f935a3d8cdfcdfbabd23928a42304b1ffc52ba'
-TARBALL_AMD64 = 'debian_wheezy_amd64_sysroot.tgz'
-TARBALL_ARM = 'debian_wheezy_arm_sysroot.tgz'
-TARBALL_ARM64 = 'debian_jessie_arm64_sysroot.tgz'
-TARBALL_I386 = 'debian_wheezy_i386_sysroot.tgz'
-TARBALL_MIPS = 'debian_wheezy_mips_sysroot.tgz'
-TARBALL_AMD64_SHA1SUM = 'a7f3df28b02799fbd7675c2ab24f1924c104c0ee'
-TARBALL_ARM_SHA1SUM = '2df01b8173a363977daf04e176b8c7dba5b0b933'
-TARBALL_ARM64_SHA1SUM = 'df9270e00c258e6cd80f8172b1bfa39aafc4756f'
-TARBALL_I386_SHA1SUM = 'e2c7131fa5f711de28c37fd9442e77d32abfb3ff'
-TARBALL_MIPS_SHA1SUM = '22fe7b45b144691aeb515083025f0fceb131d724'
-SYSROOT_DIR_AMD64 = 'debian_wheezy_amd64-sysroot'
-SYSROOT_DIR_ARM = 'debian_wheezy_arm-sysroot'
-SYSROOT_DIR_ARM64 = 'debian_jessie_arm64-sysroot'
-SYSROOT_DIR_I386 = 'debian_wheezy_i386-sysroot'
-SYSROOT_DIR_MIPS = 'debian_wheezy_mips-sysroot'
+
+SYSROOTS = {
+ ('Wheezy', 'amd64'): {
+ 'Revision' : '24f935a3d8cdfcdfbabd23928a42304b1ffc52ba',
+ 'Tarball' : 'debian_wheezy_amd64_sysroot.tgz',
+ 'Sha1Sum' : 'a7f3df28b02799fbd7675c2ab24f1924c104c0ee',
+ 'SysrootDir' : 'debian_wheezy_amd64-sysroot'
+ },
+ ('Wheezy', 'arm'): {
+ 'Revision' : '24f935a3d8cdfcdfbabd23928a42304b1ffc52ba',
+ 'Tarball' : 'debian_wheezy_arm_sysroot.tgz',
+ 'Sha1Sum' : '2df01b8173a363977daf04e176b8c7dba5b0b933',
+ 'SysrootDir' : 'debian_wheezy_arm-sysroot'
+ },
+ ('Wheezy', 'i386'): {
+ 'Revision' : '24f935a3d8cdfcdfbabd23928a42304b1ffc52ba',
+ 'Tarball' : 'debian_wheezy_i386_sysroot.tgz',
+ 'Sha1Sum' : 'e2c7131fa5f711de28c37fd9442e77d32abfb3ff',
+ 'SysrootDir' : 'debian_wheezy_i386-sysroot'
+ },
+ ('Wheezy', 'mips'): {
+ 'Revision' : '24f935a3d8cdfcdfbabd23928a42304b1ffc52ba',
+ 'Tarball' : 'debian_wheezy_mips_sysroot.tgz',
+ 'Sha1Sum' : '22fe7b45b144691aeb515083025f0fceb131d724',
+ 'SysrootDir' : 'debian_wheezy_mips-sysroot'
+ },
+ ('Jessie', 'arm64'): {
+ 'Revision' : '24f935a3d8cdfcdfbabd23928a42304b1ffc52ba',
+ 'Tarball' : 'debian_jessie_arm64_sysroot.tgz',
+ 'Sha1Sum' : 'df9270e00c258e6cd80f8172b1bfa39aafc4756f',
+ 'SysrootDir' : 'debian_jessie_arm64-sysroot'
+ },
+ ('Precise', 'amd64'): {
+ 'Revision' : '24f935a3d8cdfcdfbabd23928a42304b1ffc52ba',
+ 'Tarball' : 'ubuntu_precise_amd64_sysroot.tgz',
+ 'Sha1Sum' : '67985675e64e1d3cf6574088f36f89092ae9e86b',
+ 'SysrootDir' : 'ubuntu_precise_amd64-sysroot'
+ }
+}
valid_archs = ('arm', 'arm64', 'i386', 'amd64', 'mips')
@@ -85,6 +104,8 @@ def DetectHostArch():
return 'i386'
elif detected_host_arch == 'arm':
return 'arm'
+ elif detected_host_arch == 'arm64':
+ return 'arm64'
elif detected_host_arch == 'mips':
return 'mips'
@@ -122,12 +143,23 @@ def InstallDefaultSysroots():
This includes at least the sysroot for host architecture, and the 32-bit
sysroot for building the v8 snapshot image. It can also include the cross
compile sysroot for ARM/MIPS if cross compiling environment can be detected.
+
+ Another reason we're installing this by default is so that developers can
+ compile and run on our supported platforms without having to worry about
+ flipping things back and forth and whether the sysroots have been downloaded
+ or not.
"""
host_arch = DetectHostArch()
- InstallSysroot(host_arch)
+ InstallDefaultSysrootForArch(host_arch)
if host_arch == 'amd64':
- InstallSysroot('i386')
+ InstallDefaultSysrootForArch('i386')
+
+ # Desktop Chromium OS builds require the precise sysroot.
+ # TODO(thomasanderson): only download this when the GN arg target_os
+ # == 'chromeos', when the functionality to perform the check becomes
+ # available.
+ InstallSysroot('Precise', 'amd64')
# Finally, if we can detect a non-standard target_arch such as ARM or
# MIPS, then install the sysroot too.
@@ -135,7 +167,7 @@ def InstallDefaultSysroots():
# architecture.
target_arch = DetectTargetArch()
if target_arch and target_arch not in (host_arch, 'i386'):
- InstallSysroot(target_arch)
+ InstallDefaultSysrootForArch(target_arch)
def main(args):
@@ -155,46 +187,38 @@ def main(args):
if not options.arch:
print 'You much specify either --arch or --running-as-hook'
return 1
- InstallSysroot(options.arch)
+ InstallDefaultSysrootForArch(options.arch)
return 0
-
-def InstallSysroot(target_arch):
- # The sysroot directory should match the one specified in build/common.gypi.
- # TODO(thestig) Consider putting this else where to avoid having to recreate
- # it on every build.
- linux_dir = os.path.dirname(SCRIPT_DIR)
- debian_release = 'Wheezy'
+def InstallDefaultSysrootForArch(target_arch):
if target_arch == 'amd64':
- sysroot = os.path.join(linux_dir, SYSROOT_DIR_AMD64)
- tarball_filename = TARBALL_AMD64
- tarball_sha1sum = TARBALL_AMD64_SHA1SUM
- revision = REVISION_AMD64
+ InstallSysroot('Wheezy', 'amd64')
elif target_arch == 'arm':
- sysroot = os.path.join(linux_dir, SYSROOT_DIR_ARM)
- tarball_filename = TARBALL_ARM
- tarball_sha1sum = TARBALL_ARM_SHA1SUM
- revision = REVISION_ARM
+ InstallSysroot('Wheezy', 'arm')
elif target_arch == 'arm64':
- debian_release = 'Jessie'
- sysroot = os.path.join(linux_dir, SYSROOT_DIR_ARM64)
- tarball_filename = TARBALL_ARM64
- tarball_sha1sum = TARBALL_ARM64_SHA1SUM
- revision = REVISION_ARM64
+ InstallSysroot('Jessie', 'arm64')
elif target_arch == 'i386':
- sysroot = os.path.join(linux_dir, SYSROOT_DIR_I386)
- tarball_filename = TARBALL_I386
- tarball_sha1sum = TARBALL_I386_SHA1SUM
- revision = REVISION_I386
+ InstallSysroot('Wheezy', 'i386')
elif target_arch == 'mips':
- sysroot = os.path.join(linux_dir, SYSROOT_DIR_MIPS)
- tarball_filename = TARBALL_MIPS
- tarball_sha1sum = TARBALL_MIPS_SHA1SUM
- revision = REVISION_MIPS
+ InstallSysroot('Wheezy', 'mips')
else:
raise Error('Unknown architecture: %s' % target_arch)
+def InstallSysroot(target_platform, target_arch):
+ # The sysroot directory should match the one specified in build/common.gypi.
+ # TODO(thestig) Consider putting this else where to avoid having to recreate
+ # it on every build.
+ linux_dir = os.path.dirname(SCRIPT_DIR)
+
+ if (target_platform, target_arch) not in SYSROOTS:
+ raise Error('No sysroot for: %s %s' % (target_platform, target_arch))
+ sysroot_dict = SYSROOTS[(target_platform, target_arch)]
+ revision = sysroot_dict['Revision']
+ tarball_filename = sysroot_dict['Tarball']
+ tarball_sha1sum = sysroot_dict['Sha1Sum']
+ sysroot = os.path.join(linux_dir, sysroot_dict['SysrootDir'])
+
url = '%s/%s/%s/%s' % (URL_PREFIX, URL_PATH, revision, tarball_filename)
stamp = os.path.join(sysroot, '.stamp')
@@ -202,11 +226,11 @@ def InstallSysroot(target_arch):
with open(stamp) as s:
if s.read() == url:
print 'Debian %s %s root image already up to date: %s' % \
- (debian_release, target_arch, sysroot)
+ (target_platform, target_arch, sysroot)
return
print 'Installing Debian %s %s root image: %s' % \
- (debian_release, target_arch, sysroot)
+ (target_platform, target_arch, sysroot)
if os.path.isdir(sysroot):
shutil.rmtree(sysroot)
os.mkdir(sysroot)
« no previous file with comments | « build/config/sysroot.gni ('k') | tools/checklicenses/checklicenses.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698