Chromium Code Reviews| 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..9f8aee2e8aee4c7988beb2832c7ddb174a0c53a6 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 = { |
|
Tom (Use chromium acct)
2016/08/25 03:09:56
Not sure if this is the most pythonic way to do th
Dirk Pranke
2016/08/25 03:27:22
Nit: It's a constant, so, SYSROOTS. Otherwise, yes
Tom (Use chromium acct)
2016/08/25 18:28:51
Done.
|
| + ('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' |
| @@ -124,10 +145,16 @@ def InstallDefaultSysroots(): |
| compile sysroot for ARM/MIPS if cross compiling environment can be detected. |
| """ |
| 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') |
|
Dirk Pranke
2016/08/25 03:27:22
Another reason we're installing this by default is
Tom (Use chromium acct)
2016/08/25 18:28:51
Done.
|
| # Finally, if we can detect a non-standard target_arch such as ARM or |
| # MIPS, then install the sysroot too. |
| @@ -135,7 +162,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 +182,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 +221,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) |