gecko-dev/build/moz.configure
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
..
android-ndk.configure Bug 1648552 - `mach bootstrap` checks if Android NDK version is the correct version r=nalexander 2020-07-03 13:59:01 +00:00
android-sdk.configure Bug 1642658 - Android SDK/NDK root should replace file separator with '/'. r=froydnj 2020-06-03 15:32:30 +00:00
arm.configure Bug 1627163 - Fix a few more python 3 incompatibilities in some .configure files. r=firefox-build-system-reviewers,rstewart 2020-04-07 15:44:06 +00:00
bindgen.configure 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
checks.configure Bug 1624535 - Make check_prog(allow_missing=depends(...)) work. r=froydnj 2020-03-26 00:19:31 +00:00
compile-checks.configure
compilers-util.configure
flags.configure Bug 1635933 - Temporarily disable new pass manager on ubsan clang-10 r=froydnj 2020-05-12 18:01:48 +00:00
headers.configure Bug 1157850 - Use portable add_dir_entries() implementation when fts.h is missing r=mhowell 2020-02-07 05:17:12 +00:00
init.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
java.configure
keyfiles.configure
lto-pgo.configure Bug 1644409 - Make --enable-lto=thin work with GCC. r=froydnj 2020-07-24 13:05:51 +00:00
memory.configure Bug 1604335 - Enable PHC on early beta. r=erahm 2019-12-27 04:34:33 +00:00
node.configure Bug 1627163 - Switch python configure to python 3. r=firefox-build-system-reviewers,rstewart 2020-04-07 18:31:56 +00:00
nspr.configure Bug 1655909 - Require NSPR 4.26 for --with-system-nspr. r=firefox-build-system-reviewers,rstewart 2020-07-29 15:02:22 +00:00
nss.configure Bug 1655105 - land NSS afa38fb2f0b5 UPGRADE_NSS_RELEASE, r=jcj 2020-08-04 19:54:56 +00:00
old.configure Bug 1657954 - Move various branding options from `old-configure` r=geckoview-reviewers,mhentges,nalexander,snorp 2020-08-11 15:58:52 +00:00
pkg.configure Bug 1641790 - Move --with-system-nss to python configure. r=firefox-build-system-reviewers,rstewart 2020-05-29 17:02:09 +00:00
rust.configure Bug 1654465 - Set -Cembed-bitcode=yes instead of CARGO_PROFILE_RELEASE_LTO. r=firefox-build-system-reviewers,rstewart 2020-07-27 21:23:57 +00:00
toolchain.configure Bug 1658483 - Remove references to the github repo that contains MacOSX-SDKs r=mhentges,dmajor 2020-08-11 17:24:34 +00:00
update-programs.configure Bug 1651130 - Part 1: Extract NSS and "update programs" configuration. r=froydnj 2020-07-08 23:01:36 +00:00
util.configure Bug 1641760 - Move --with-system-zlib to python configure. r=froydnj 2020-05-29 20:59:00 +00:00
warnings.configure Bug 1657502 - Disable new -Wpsabi warning in clang-11 r=firefox-build-system-reviewers,rstewart 2020-08-06 16:01:01 +00:00
windows.configure Bug 1656141 - Stop using MT to insert manifests in binaries. r=firefox-build-system-reviewers,rstewart 2020-08-07 00:55:16 +00:00