forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Build Chromium] Improve git checkout (elastic#83225)
* [Build Chromium] Document steps for local build, improve checkout commit e817796d107d554504870cdb8e6dd10db1079a1e Merge: 19e6b300260 61b4e052fdd Author: Timothy Sullivan <tsullivan@elastic.co> Date: Thu Nov 12 13:25:09 2020 -0700 Merge branch 'chore/build_chromium/improvements' of github.com:tsullivan/kibana into chore/build_chromium/improvements commit 19e6b300260822418cea4dc594bdfdf621a331e0 Author: Timothy Sullivan <tsullivan@elastic.co> Date: Thu Nov 12 13:23:01 2020 -0700 fixes commit 9de24ec298792a46e88207f41c9f6aff1997dbf1 Author: Timothy Sullivan <tsullivan@elastic.co> Date: Thu Nov 12 13:22:52 2020 -0700 add instructions to build local commit 872c0f68e0077ad50c541b605a87253befd1a891 Author: Timothy Sullivan <tsullivan@elastic.co> Date: Thu Nov 12 11:58:25 2020 -0700 simplify commit 8dae9484efcdc483ad20ceab32cae4e97735ab1c Author: Timothy Sullivan <tsullivan@elastic.co> Date: Thu Nov 12 10:28:18 2020 -0700 fixes commit 492f5cfe25e2c7ccffce55a8733383a30aae1cb6 Author: Timothy Sullivan <tsullivan@elastic.co> Date: Wed Nov 11 20:15:43 2020 -0700 --wip-- [skip ci] commit acba359b121f7be8e6c353f90e938bc5d88658a1 Author: Timothy Sullivan <tsullivan@elastic.co> Date: Wed Nov 11 15:47:50 2020 -0700 [Build Chromium] Improve git checkout commit 61b4e052fdd04456fe23956ad8ce99c8e771c01e Author: Timothy Sullivan <tsullivan@elastic.co> Date: Wed Nov 11 20:15:43 2020 -0700 --wip-- [skip ci] commit 58300c9deeca15cce838b3956c55c2994f99f530 Author: Timothy Sullivan <tsullivan@elastic.co> Date: Wed Nov 11 15:47:50 2020 -0700 [Build Chromium] Improve git checkout * Apply suggestions from code review Co-authored-by: Joel Griffith <joel@joelgriffith.net> Co-authored-by: Joel Griffith <joel@joelgriffith.net> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
8a2cd92
commit 9374360
Showing
4 changed files
with
200 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,45 @@ | ||
import os, hashlib | ||
import os, hashlib, platform, sys | ||
|
||
# This file contains various utility functions used by the init and build scripts | ||
|
||
# Compute the root build and script directory as relative to this file | ||
script_dir = os.path.realpath(os.path.join(__file__, '..')) | ||
root_dir = os.path.realpath(os.path.join(script_dir, '..')) | ||
def runcmdsilent(cmd): | ||
"""Executes a string command in the shell""" | ||
print(' > ' + cmd) | ||
return os.system(cmd) | ||
|
||
def runcmd(cmd): | ||
"""Executes a string command in the shell""" | ||
print(cmd) | ||
print(' > ' + cmd) | ||
result = os.system(cmd) | ||
if result != 0: | ||
raise Exception(cmd + ' returned ' + str(result)) | ||
|
||
def mkdir(dir): | ||
print(' > mkdir -p ' + dir) | ||
"""Makes a directory if it doesn't exist""" | ||
if not os.path.exists(dir): | ||
print('mkdir -p ' + dir) | ||
return os.makedirs(dir) | ||
|
||
def md5_file(filename): | ||
"""Builds a hex md5 hash of the given file""" | ||
md5 = hashlib.md5() | ||
with open(filename, 'rb') as f: | ||
for chunk in iter(lambda: f.read(128 * md5.block_size), b''): | ||
with open(filename, 'rb') as f: | ||
for chunk in iter(lambda: f.read(128 * md5.block_size), b''): | ||
md5.update(chunk) | ||
return md5.hexdigest() | ||
|
||
def configure_environment(): | ||
"""Configures temporary environment variables required by Chromium's build""" | ||
depot_tools_path = os.path.join(root_dir, 'depot_tools') | ||
os.environ['PATH'] = depot_tools_path + os.pathsep + os.environ['PATH'] | ||
def configure_environment(arch_name, build_path, src_path): | ||
"""Runs install scripts for deps, and configures temporary environment variables required by Chromium's build""" | ||
|
||
if platform.system() == 'Linux': | ||
if arch_name: | ||
print('Running sysroot install script...') | ||
sysroot_cmd = src_path + '/build/linux/sysroot_scripts/install-sysroot.py --arch=' + arch_name | ||
runcmd(sysroot_cmd) | ||
print('Running install-build-deps...') | ||
runcmd(src_path + '/build/install-build-deps.sh') | ||
|
||
depot_tools_path = os.path.join(build_path, 'depot_tools') | ||
full_path = depot_tools_path + os.pathsep + os.environ['PATH'] | ||
print('Updating PATH for depot_tools: ' + full_path) | ||
os.environ['PATH'] = full_path |
Oops, something went wrong.