Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 01_build
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Defaults:build env_keep += "DEBIAN_FRONTEND DEBIAN_PRIORITY DEBCONF_NONINTERACTIVE_SEEN APT_LISTCHANGES_FRONTEND TZ LANG LC_ALL LANGUAGE"
build ALL=(ALL:ALL) NOPASSWD:ALL
23 changes: 21 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ def run_command(args, logfile, cwd=None):
log(f"Running '{' '.join(args)}' in '{cwd if cwd is not None else os.getcwd()}'", logfile)
logfile.flush()
try:
subprocess.run(args, cwd=cwd, check=True, stderr=subprocess.STDOUT, stdout=logfile)
subprocess.run(
args,
cwd=cwd,
env=os.environ.copy(),
check=True,
stderr=subprocess.STDOUT,
stdout=logfile,
)
except:
log('Command failed.', logfile)
raise
Expand Down Expand Up @@ -52,6 +59,18 @@ def run_fetch(opts, logfile):

source_dir = os.path.join(opts.dir, ROOT)
run_command(['git', 'config', 'diff.ignoreSubmodules', 'dirty'], logfile, cwd=source_dir)

# Ensure any apt/dpkg activity triggered by Chromium's build-deps scripts runs
# fully non-interactively and doesn't prompt for locale/tz configuration.
os.environ.setdefault('DEBIAN_FRONTEND', 'noninteractive')
os.environ.setdefault('DEBIAN_PRIORITY', 'critical')
os.environ.setdefault('DEBCONF_NONINTERACTIVE_SEEN', 'true')
os.environ.setdefault('APT_LISTCHANGES_FRONTEND', 'none')
os.environ.setdefault('TZ', 'Etc/UTC')
os.environ.setdefault('LANG', 'C.UTF-8')
os.environ.setdefault('LC_ALL', 'C.UTF-8')
os.environ.setdefault('LANGUAGE', 'C.UTF-8')
Comment on lines +65 to +72

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve readability and make it easier to manage these environment variables, consider defining them in a dictionary and then iterating over it to set them. This groups related configuration together and makes it more maintainable.

Suggested change
os.environ.setdefault('DEBIAN_FRONTEND', 'noninteractive')
os.environ.setdefault('DEBIAN_PRIORITY', 'critical')
os.environ.setdefault('DEBCONF_NONINTERACTIVE_SEEN', 'true')
os.environ.setdefault('APT_LISTCHANGES_FRONTEND', 'none')
os.environ.setdefault('TZ', 'Etc/UTC')
os.environ.setdefault('LANG', 'C.UTF-8')
os.environ.setdefault('LC_ALL', 'C.UTF-8')
os.environ.setdefault('LANGUAGE', 'C.UTF-8')
env_vars = {
'DEBIAN_FRONTEND': 'noninteractive',
'DEBIAN_PRIORITY': 'critical',
'DEBCONF_NONINTERACTIVE_SEEN': 'true',
'APT_LISTCHANGES_FRONTEND': 'none',
'TZ': 'Etc/UTC',
'LANG': 'C.UTF-8',
'LC_ALL': 'C.UTF-8',
'LANGUAGE': 'C.UTF-8',
}
for key, value in env_vars.items():
os.environ.setdefault(key, value)


run_command(['./build/install-build-deps.sh'], logfile, cwd=source_dir)
run_command(['gclient', 'runhooks'], logfile, cwd=opts.dir)

Expand All @@ -60,7 +79,7 @@ def run_build(opts, logfile):
source_dir = os.path.join(opts.dir, ROOT)
build_opts = []
if opts.official:
build_opts.append('--extra-gn-args=is_official_build=true')
build_opts.append('--extra-gn-args=rtc_use_h265=true is_official_build=true chrome_pgo_phase=0')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability and maintainability, it's advisable to construct the gn_args string from a list of individual arguments. This approach makes it easier to add, remove, or conditionally include arguments in the future.

Suggested change
build_opts.append('--extra-gn-args=rtc_use_h265=true is_official_build=true chrome_pgo_phase=0')
gn_args = [
'rtc_use_h265=true',
'is_official_build=true',
'chrome_pgo_phase=0',
]
build_opts.append(f"--extra-gn-args={' '.join(gn_args)}")

if opts.unstripped:
build_opts.append('--use-unstripped-libs')
run_command(['./tools_webrtc/android/build_aar.py'] + build_opts, logfile, cwd=source_dir)
Expand Down