gecko-dev/build
Ricky Stewart bbfa258584 Bug 1656993: Create and require by default global `virtualenv`s in `~/.mozbuild` for `mach` r=mhentges,ahal
In two different places we've been encountering issues regarding 1) how we configure the system Python environment and 2) how the system Python environment relates to the `virtualenv`s that we use for building, testing, and other dev tasks. Specifically:

1. With the push to use `glean` for telemetry in `mach`, we are requiring (or rather, strongly encouraging) the `glean_sdk` Python package to be installed with bug 1651424. `mach bootstrap` upgrades the library using your system Python 3 in bug 1654607. We can't vendor it due to the package containing native code. Since we generally vendor all code required for `mach` to function, requiring that the system Python be configured with a certain version of `glean` is an unfortunate change.

2. The build uses the vendored `glean_parser` for a number of build tasks. Since the vendored `glean_parser` conflicts with the globally-installed `glean_sdk` package, we had to add special ad-hoc handling to allow us to circumvent this conflict in bug 1655781.

3. We begin to rely more and more on the `zstandard` package during build tasks, this package again being one that we can't vendor due to containing native code. Bug 1654994 contained more ad-hoc code which subprocesses out from the build system's `virtualenv` to the SYSTEM `python3` binary, assuming that the system `python3` has `zstandard` installed.

As we rely more on `glean_sdk`, `zstandard`, and other packages that are not vendorable, we need to settle on a standard model for how `mach`, the build process, and other `mach` commands that may make their own `virtualenv`s work in the presence of unvendorable packages.

With that in mind, this patch does all the following:

1. Separate out the `mach` `virtualenv_packages` from the in-build `virtualenv_packages`. Refactor the common stuff into `common_virtualenv_packages.txt`. Add functionality to the `virtualenv_packages` manifest parsing to allow the build `virtualenv` to "inherit" from the parent by pointing to the parent's `site-packages`. The `in-virtualenv` feature from bug 1655781 is no longer necessary, so delete it.

2. Add code to `bootstrap`, as well as a new `mach` command `create-mach-environment` to create `virtualenv`s in `~/.mozbuild`.

3. Add code to `mach` to dispatch either to the in-`~/.mozbuild` `virtualenv`s (or to the system Python 3 for commands which cannot run in the `virtualenv`s, namely `bootstrap` and `create-mach-environment`).

4. Remove the "add global argument" feature from `mach`. It isn't used and conflicts with (3).

5. Remove the `--print-command` feature from `mach` which is obsoleted by these changes.

This has the effect of allowing us to install packages that cannot be vendored into a "common" place (namely the global `~/.mozbuild` `virtualenv`s) and use those from the build without requiring us to hit the network. Miscellaneous implementation notes:

1. We allow users to force running `mach` with the system Python if they like. For now it doesn't make any sense to require 100% of people to create these `virtualenv`s when they're allowed to continue on with the old behavior if they like. We also skip this in CI.

2. We needed to duplicate the global-argument logic into the `mach` script to allow for the dispatch behavior. This is something we avoided with the Python 2 -> Python 3 migration with the `--print-command` feature, justifying its use by saying it was only temporarily required until all `mach` commands were running with Python 3. With this change, we'll need to be able to determine the `mach` command from the shell script for the forseeable future, and committing to this forever with the cost that `--print-command` incurs (namely `mach` startup time, an additional .4s on my machine) didn't seem worth it to me. It's not a ton of duplicated code.

Differential Revision: https://phabricator.services.mozilla.com/D85916
2020-08-17 17:21:02 +00:00
..
autoconf Bug 1658053 - update config.{guess,sub} with arm64 macOS support; r=glandium 2020-08-13 11:36:08 +00:00
build-clang Bug 1598226 - Create task definitions for external clang-tidy checks; r=andi,tjr,glandium 2020-08-10 21:02:04 +00:00
build-infer
clang-plugin Bug 1657521 - P3. Have the RemoteDecoderManagerChild use its own dedicated thread. r=mattwoodrow 2020-08-13 03:19:36 +00:00
compare-mozconfig Bug 1651824 - Run `mozboot` and `compare-mozconfig` unit tests in `mozbuild` task and not in `make check` r=froydnj 2020-07-10 18:25:07 +00:00
debian-packages Bug 1647880 - Upgrade cmake to 3.16.3 for toolchain builds. r=firefox-build-system-reviewers,rstewart 2020-06-24 15:17:03 +00:00
docs Bug 1658483 - Remove references to the github repo that contains MacOSX-SDKs r=mhentges,dmajor 2020-08-11 17:24:34 +00:00
gyp_includes
liblowercase Bug 1638401 - Make liblowercase also wrap fxstatat. r=froydnj 2020-05-15 17:10:34 +00:00
macosx Bug 1654845 - use new dump_syms for Mac builds; r=dmajor 2020-07-23 17:01:21 +00:00
mobile Bug 1658679 - Fix Python 3 compatibility in RemoteAutomation.read_stdout(). r=jmaher 2020-08-13 14:02:37 +00:00
moz.configure Bug 1656993: Create and require by default global `virtualenv`s in `~/.mozbuild` for `mach` r=mhentges,ahal 2020-08-17 17:21:02 +00:00
package/mac_osx
pgo Bug 634697 - Add permanent storage to user's client certificate selection r=keeler,baku,fluent-reviewers,Gijs 2020-08-03 13:24:34 +00:00
sanitizers Bug 1614375: bustage fix, add a couple more suppressions for straggler failures 2020-05-12 14:50:34 -04:00
sparse-profiles Bug 1656993: Create and require by default global `virtualenv`s in `~/.mozbuild` for `mach` r=mhentges,ahal 2020-08-17 17:21:02 +00:00
tests/cram
unix Bug 1652374 - Use LLD for non-PGO-profile-use clang builds on automation. r=froydnj 2020-08-04 02:26:42 +00:00
valgrind Bug 1657650 - Require that Mach command providers subclass MachCommandBase. r=remote-protocol-reviewers,marionette-reviewers,maja_zf,mhentges,froydnj 2020-08-07 18:24:59 +00:00
win32 Bug 1647301 - Remove forceCharset from nsIContentViewer. r=m_kato 2020-07-02 06:23:24 +00:00
win64 Backed out changeset 722854464579 (bug 1623520) for multiple failures on Win10 x64 asan. CLOSED TREE 2020-06-17 01:49:36 +03:00
win64-aarch64 Bug 1620165 - Prepare win64-aarch64 mozconfigs for cross-compilation. r=dmajor 2020-03-05 22:56:28 +00:00
workspace-hack Bug 1622328 - build/workspace-hack/src/lib.rs: Add the license r=firefox-build-system-reviewers,rstewart 2020-03-13 21:32:12 +00:00
.gdbinit Bug 1642121 - Remove directory dependence of GDB init files. r=nalexander 2020-06-16 15:45:43 +00:00
.gdbinit.loader Bug 1642121 - Remove directory dependence of GDB init files. r=nalexander 2020-06-16 15:45:43 +00:00
.gdbinit.py.in Bug 1642121 - Remove directory dependence of GDB init files. r=nalexander 2020-06-16 15:45:43 +00:00
.lldbinit.in Bug 1654994 - Switch full symbols archive to tar.zst. r=firefox-build-system-reviewers,rstewart,tomprince 2020-07-31 20:27:54 +00:00
RunCbindgen.py Bug 1646936 - Generate a single metadata file in the objdir, and feed it to cbindgen. r=glandium 2020-06-26 10:41:26 +00:00
__init__.py
appini_header.py Bug 1625461 - Fix bug where conditionally including the update URL in application.ini breaks building without the updater r=rstewart 2020-03-31 21:11:10 +00:00
application.ini.in Bug 1630041 - Allow setting the update host via set define at build time. r=glandium 2020-04-23 08:08:39 +00:00
binary-location.mk
build_virtualenv_packages.txt Bug 1656993: Create and require by default global `virtualenv`s in `~/.mozbuild` for `mach` r=mhentges,ahal 2020-08-17 17:21:02 +00:00
buildconfig.py
cargo-host-linker
cargo-host-linker.bat
cargo-linker
cargo-linker.bat
checksums.py
common_virtualenv_packages.txt Bug 1656993: Create and require by default global `virtualenv`s in `~/.mozbuild` for `mach` r=mhentges,ahal 2020-08-17 17:21:02 +00:00
defines.sh
dumbmake-dependencies
gecko_templates.mozbuild
gen_symverscript.py
gen_test_packages_manifest.py Bug 1644778 - add a mozperftest to measure browser.xhtml DOM size, r=tarek,dhouse,sparky 2020-07-13 15:44:38 +00:00
genrc.sh
gn.mozbuild
gyp.mozbuild Bug 1638830 - Remove `MOZ_WEBRTC_HARDWARE_AEC_NS` and its related code r=padenot 2020-05-20 13:22:40 +00:00
gyp_base.mozbuild
mach_bootstrap.py Bug 1656993: Create and require by default global `virtualenv`s in `~/.mozbuild` for `mach` r=mhentges,ahal 2020-08-17 17:21:02 +00:00
mach_virtualenv_packages.txt Bug 1656993: Create and require by default global `virtualenv`s in `~/.mozbuild` for `mach` r=mhentges,ahal 2020-08-17 17:21:02 +00:00
moz-automation.mk Bug 1648651 - Fix building with --disable-compile-environment. r=firefox-build-system-reviewers,rstewart 2020-06-28 23:43:18 +00:00
moz.build Bug 1646936 - Generate a single metadata file in the objdir, and feed it to cbindgen. r=glandium 2020-06-26 10:41:26 +00:00
mozconfig.artifact Bug 1654994 - Make full symbols archive opt-in rather than opt-out. r=froydnj 2020-07-31 10:01:54 +00:00
mozconfig.artifact.automation Bug 1607193 - Remove MOZ_AUTOMATION_L10N_CHECK; r=firefox-build-system-reviewers,rstewart 2020-03-13 18:34:05 +00:00
mozconfig.automation Bug 1607193 - Remove MOZ_AUTOMATION_L10N_CHECK; r=firefox-build-system-reviewers,rstewart 2020-03-13 18:34:05 +00:00
mozconfig.cache Bug 1632723 - Update builders to rustc 1.43. r=firefox-build-system-reviewers,rstewart 2020-04-29 21:21:36 +00:00
mozconfig.clang-cl Bug 1648519 - Add back clang lib directory to LIB on Windows r=glandium 2020-06-26 19:36:30 +00:00
mozconfig.comm-support
mozconfig.common
mozconfig.common.override
mozconfig.lld-link
mozconfig.nasm
mozconfig.no-compile Bug 1654994 - Stop setting up makecab for the build. r=firefox-build-system-reviewers,rstewart 2020-07-31 10:01:53 +00:00
mozconfig.node
mozconfig.rust
mozconfig.stylo
mozconfig.wasm-sandboxing Bug 1626174 - Enable use of wasm sandboxed libOgg in the OggDemuxer in linux, mac, try servers r=padenot,erahm,dmajor,firefox-build-system-reviewers 2020-04-22 11:16:10 +00:00
mozconfig.win-common Bug 1654994 - Stop setting up makecab for the build. r=firefox-build-system-reviewers,rstewart 2020-07-31 10:01:53 +00:00
qemu-wrap
submit_telemetry_data.py
templates.mozbuild Bug 1646936 - Generate a single metadata file in the objdir, and feed it to cbindgen. r=glandium 2020-06-26 10:41:26 +00:00
test_templates.mozbuild Bug 1621441 - Update Python scripts that depend on PyECC to run in Python 3 and to leverage the ecdsa library instead r=glandium,keeler 2020-04-17 20:56:09 +00:00
update-settings.ini
upload.py
upload_generated_sources.py Bug 985141 - [mozbuild] Remove leading underscore from MozbuildObject._activate_virtualenv, r=firefox-build-system-reviewers,perftest-reviewers,andi,AlexandruIonescu,rstewart 2020-07-28 16:06:10 +00:00
variables.py Bug 1620744 - Convert variables.py:source_repo_header() to py3; r=firefox-build-system-reviewers,rstewart 2020-03-10 20:19:24 +00:00
windows_toolchain.py