summaryrefslogtreecommitdiffstats
path: root/chrome/installer/linux
diff options
context:
space:
mode:
authorhenrika <henrika@chromium.org>2015-01-08 02:48:32 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-08 10:49:16 +0000
commit9c5c0565bfe3b438b018fc284f752f7766fdd9ea (patch)
tree257fed895a7c46718ddd8849ff5b46febeb187f9 /chrome/installer/linux
parent711802679ce2feb228ad418dd117ae23301e5c02 (diff)
downloadchromium_src-9c5c0565bfe3b438b018fc284f752f7766fdd9ea.zip
chromium_src-9c5c0565bfe3b438b018fc284f752f7766fdd9ea.tar.gz
chromium_src-9c5c0565bfe3b438b018fc284f752f7766fdd9ea.tar.bz2
Revert of Only run install-debian.wheezy.sysroot.py once during runhooks (patchset #2 id:20001 of https://codereview.chromium.org/834133003/)
Reason for revert: See failing gclient runhooks after this patch and the Chrome build tree turned red (see http://build.chromium.org/p/chromium.win/waterfall?builder=Win8%20GN for details). I can't find any other reason for this failure and will will try to revert. Original issue's description: > Only run install-debian.wheezy.sysroot.py once during runhooks > > This script was previously run three times, once for > each arch, with two of the three always being no-ops. > > Instead just run the script once and have the script > figure out which image to download. > > TEST=trybots + 'gclient runhooks' locally > > Committed: https://crrev.com/711802679ce2feb228ad418dd117ae23301e5c02 > Cr-Commit-Position: refs/heads/master@{#310467} TBR=thestig@chromium.org,sbc@chromium.org NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/843683003 Cr-Commit-Position: refs/heads/master@{#310468}
Diffstat (limited to 'chrome/installer/linux')
-rwxr-xr-xchrome/installer/linux/sysroot_scripts/install-debian.wheezy.sysroot.py97
1 files changed, 45 insertions, 52 deletions
diff --git a/chrome/installer/linux/sysroot_scripts/install-debian.wheezy.sysroot.py b/chrome/installer/linux/sysroot_scripts/install-debian.wheezy.sysroot.py
index 66ee65a..c9248f9 100755
--- a/chrome/installer/linux/sysroot_scripts/install-debian.wheezy.sysroot.py
+++ b/chrome/installer/linux/sysroot_scripts/install-debian.wheezy.sysroot.py
@@ -41,10 +41,8 @@ SYSROOT_DIR_AMD64 = 'debian_wheezy_amd64-sysroot'
SYSROOT_DIR_I386 = 'debian_wheezy_i386-sysroot'
SYSROOT_DIR_ARM = 'debian_wheezy_arm-sysroot'
-valid_archs = ('arm', 'i386', 'amd64')
-
-def GetSha1(filename):
+def get_sha1(filename):
sha1 = hashlib.sha1()
with open(filename, 'rb') as f:
while True:
@@ -56,45 +54,10 @@ def GetSha1(filename):
return sha1.hexdigest()
-def DetectArch(gyp_defines):
- # Check for optional target_arch and only install for that architecture.
- # If target_arch is not specified, then only install for the host
- # architecture.
- if 'target_arch=x64' in gyp_defines:
- return 'amd64'
- elif 'target_arch=ia32' in gyp_defines:
- return 'i386'
- elif 'target_arch=arm' in gyp_defines:
- return 'arm'
- else:
- # Figure out host arch using build/detect_host_arch.py and
- # set target_arch to host arch
- SRC_DIR = os.path.abspath(
- os.path.join(SCRIPT_DIR, '..', '..', '..', '..'))
- sys.path.append(os.path.join(SRC_DIR, 'build'))
- import detect_host_arch
-
- detected_host_arch = detect_host_arch.HostArch()
- if detected_host_arch == 'x64':
- return 'amd64'
- elif detected_host_arch == 'ia32':
- return 'i386'
- elif detected_host_arch == 'arm':
- return 'arm'
-
- return None
-
-
def main():
- gyp_defines = os.environ.get('GYP_DEFINES', '')
-
- if options.arch:
- target_arch = options.arch
- else:
- target_arch = DetectArch(gyp_defines)
- if not target_arch:
- print 'Unable to detect desired architecture'
- return 1
+ if options.arch not in ['amd64', 'i386', 'arm']:
+ print 'Unknown architecture: %s' % options.arch
+ return 1
if options.linux_only:
# This argument is passed when run from the gclient hooks.
@@ -102,9 +65,11 @@ def main():
if not sys.platform.startswith('linux'):
return 0
+ gyp_defines = os.environ.get('GYP_DEFINES', '')
+
# Only install the sysroot for an Official Chrome Linux build, except
# for ARM where we always use a sysroot.
- if target_arch != 'arm':
+ if options.arch != 'arm':
defined = ['branding=Chrome', 'buildtype=Official']
undefined = ['chromeos=1']
for option in defined:
@@ -114,29 +79,58 @@ def main():
if option in gyp_defines:
return 0
+ # Check for optional target_arch and only install for that architecture.
+ # If target_arch is not specified, then only install for the host
+ # architecture.
+ target_arch = ''
+ if 'target_arch=x64' in gyp_defines:
+ target_arch = 'amd64'
+ elif 'target_arch=ia32' in gyp_defines:
+ target_arch = 'i386'
+ elif 'target_arch=arm' in gyp_defines:
+ target_arch = 'arm'
+ else:
+ # Figure out host arch using build/detect_host_arch.py and
+ # set target_arch to host arch
+ SRC_DIR = os.path.abspath(
+ os.path.join(SCRIPT_DIR, '..', '..', '..', '..'))
+ sys.path.append(os.path.join(SRC_DIR, 'build'))
+ import detect_host_arch
+
+ detected_host_arch = detect_host_arch.HostArch()
+ if detected_host_arch == 'x64':
+ target_arch = 'amd64'
+ elif detected_host_arch == 'ia32':
+ target_arch = 'i386'
+ elif detected_host_arch == 'arm':
+ target_arch = 'arm'
+
+ if target_arch != options.arch:
+ return 0
+
# 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_arch == 'amd64':
+ if options.arch == 'amd64':
sysroot = os.path.join(linux_dir, SYSROOT_DIR_AMD64)
tarball_filename = TARBALL_AMD64
tarball_sha1sum = TARBALL_AMD64_SHA1SUM
revision = REVISION_AMD64
- elif target_arch == 'arm':
+ elif options.arch == 'arm':
sysroot = os.path.join(linux_dir, SYSROOT_DIR_ARM)
tarball_filename = TARBALL_ARM
tarball_sha1sum = TARBALL_ARM_SHA1SUM
revision = REVISION_ARM
- elif target_arch == 'i386':
+ elif options.arch == 'i386':
sysroot = os.path.join(linux_dir, SYSROOT_DIR_I386)
tarball_filename = TARBALL_I386
tarball_sha1sum = TARBALL_I386_SHA1SUM
revision = REVISION_I386
else:
- print 'Unknown architecture: %s' % target_arch
assert(False)
+
url = '%s/%s/%s/%s' % (URL_PREFIX, URL_PATH, revision, tarball_filename)
stamp = os.path.join(sysroot, '.stamp')
@@ -144,10 +138,10 @@ def main():
with open(stamp) as s:
if s.read() == url:
print 'Debian Wheezy %s root image already up-to-date: %s' % \
- (target_arch, sysroot)
+ (options.arch, sysroot)
return 0
- print 'Installing Debian Wheezy %s root image: %s' % (target_arch, sysroot)
+ print 'Installing Debian Wheezy %s root image: %s' % (options.arch, sysroot)
if os.path.isdir(sysroot):
shutil.rmtree(sysroot)
os.mkdir(sysroot)
@@ -156,7 +150,7 @@ def main():
sys.stdout.flush()
sys.stderr.flush()
subprocess.check_call(['curl', '--fail', '-L', url, '-o', tarball])
- sha1sum = GetSha1(tarball)
+ sha1sum = get_sha1(tarball)
if sha1sum != tarball_sha1sum:
print 'Tarball sha1sum is wrong.'
print 'Expected %s, actual: %s' % (tarball_sha1sum, sha1sum)
@@ -174,7 +168,6 @@ if __name__ == '__main__':
parser.add_option('--linux-only', action='store_true',
default=False, help='Only install sysroot for official '
'Linux builds')
- parser.add_option('--arch', type='choice', choices=valid_archs,
- help='Sysroot architecture: %s' % ', '.join(valid_archs))
- options, _ = parser.parse_args()
+ parser.add_option('--arch', help='Sysroot architecture: i386, amd64 or arm')
+ options, args = parser.parse_args()
sys.exit(main())