From 77ec648740bebad586d890216243e711b1a87e79 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 22 May 2017 09:27:32 -0700 Subject: [PATCH] Obtain SHA-1 of libcc commit from submodule --- script/bootstrap.py | 22 +++++++++++++++++----- script/create-dist.py | 3 +-- script/lib/config.py | 2 -- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/script/bootstrap.py b/script/bootstrap.py index 0feee9b50028..ed1f8a0bba0f 100755 --- a/script/bootstrap.py +++ b/script/bootstrap.py @@ -3,12 +3,13 @@ import argparse import errno import os +import re import subprocess import sys -from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, PLATFORM, \ - enable_verbose_mode, is_verbose_mode, get_target_arch -from lib.util import execute_stdout, get_electron_version, scoped_cwd +from lib.config import BASE_URL, PLATFORM, enable_verbose_mode, \ + is_verbose_mode, get_target_arch +from lib.util import execute, execute_stdout, get_electron_version, scoped_cwd SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) @@ -143,8 +144,8 @@ def setup_libchromiumcontent(is_dev, target_arch, url, target_dir = os.path.join(DOWNLOAD_DIR, 'libchromiumcontent') download = os.path.join(VENDOR_DIR, 'libchromiumcontent', 'script', 'download') - args = ['-f', '-c', LIBCHROMIUMCONTENT_COMMIT, '--target_arch', target_arch, - url, target_dir] + args = ['-f', '-c', get_libchromiumcontent_commit(), '--target_arch', + target_arch, url, target_dir] if (libcc_source_path != None and libcc_shared_library_path != None and libcc_static_library_path != None): @@ -275,6 +276,17 @@ def create_node_headers(): '--version', get_electron_version()]) +def get_libchromiumcontent_commit(): + commit = os.getenv('LIBCHROMIUMCONTENT_COMMIT') + if commit: + return commit + + # Extract full SHA-1 of libcc submodule commit + output = execute(['git', 'submodule', 'status', 'vendor/libchromiumcontent']) + commit = re.split('^(?:\s*)([a-f0-9]{40})(?:\s+)', output)[1] + return commit + + def mkdir_p(path): try: os.makedirs(path) diff --git a/script/create-dist.py b/script/create-dist.py index 3c61f06ac066..f39283d52e75 100755 --- a/script/create-dist.py +++ b/script/create-dist.py @@ -9,8 +9,7 @@ import subprocess import sys import stat -from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, PLATFORM, \ - get_target_arch, get_zip_name +from lib.config import BASE_URL, PLATFORM, get_target_arch, get_zip_name from lib.util import scoped_cwd, rm_rf, get_electron_version, make_zip, \ execute, electron_gyp diff --git a/script/lib/config.py b/script/lib/config.py index 20adff20e416..58f467b5b64d 100644 --- a/script/lib/config.py +++ b/script/lib/config.py @@ -8,8 +8,6 @@ import sys BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \ 'https://s3.amazonaws.com/github-janky-artifacts/libchromiumcontent' -LIBCHROMIUMCONTENT_COMMIT = os.getenv('LIBCHROMIUMCONTENT_COMMIT') or \ - 'a3cff052273b659702c6a8728e28a3b45659cd76' PLATFORM = { 'cygwin': 'win32',