Commit Graph

7485 Commits

Author SHA1 Message Date
Mitchell Hentges
fdc33dac57 Bug 1725895: Port --profile-command to pure-Python r=nalexander,glandium
As part of this, the shell-script part of `./mach` can be removed,
making it pure Python.

There's a change in `--profile-command` behaviour, though: it now only
profiles the specific command, rather than all of Mach.
This is because _so much of Mach_ has already been run before
CLI arguments are parsed in the Python process.

If a developer wants to profile Mach itself, they can manually run
`python3 -m cProfile -o <file> ./mach ...`

Differential Revision: https://phabricator.services.mozilla.com/D133928
2022-01-06 00:32:48 +00:00
Tom Ritter
a8c6d48300 Bug 1740062: Add some qualifiers for mach vendor revision for Angle r=jewilde
Depends on D132592

Differential Revision: https://phabricator.services.mozilla.com/D132593
2022-01-05 19:52:46 +00:00
Mike Hommey
8ec18236ea Bug 1748383 - In configure, make e.g. os.path.join mean the same thing whether importing os or not. r=firefox-build-system-reviewers,mhentges
Currently, using any of the functions defined in
`ConfigureSandbox.OS.path` in a `@depends` function will have a different
behavior if the function has an `@imports("os")` or not. In the former
case, we get plain `os.path.$function`, while in the latter we get the
function from `ConfigureSandbox.OS.path`, which handles path separators
differently, which makes a significant difference on Windows.

With this change, we now consistently use the versions from
`ConfigureSandbox.OS.path`.

Differential Revision: https://phabricator.services.mozilla.com/D135003
2022-01-05 01:34:35 +00:00
Marian-Vasile Laza
5e6f31856a Backed out 2 changesets (bug 1725895, bug 1740123) for causing build bustages.
Backed out changeset a6eabd95e31d (bug 1740123)
Backed out changeset bfd5211060b4 (bug 1725895)
2022-01-05 03:46:17 +02:00
Marian-Vasile Laza
d65ec9e6ce Backed out changeset c2aa8dae914d (bug 1748383) for causing python test failures. CLOSED TREE 2022-01-05 03:12:29 +02:00
Mike Hommey
d37d82c1b8 Bug 1748391 - Remove advertisement for the Visual Studio backend. r=firefox-build-system-reviewers,mhentges
The VS backend is always built when building on Windows for Windows, so
in practice, the message isn't printed... except when cross-compiling on
Windows, in which case the VS backend doesn't work.

Differential Revision: https://phabricator.services.mozilla.com/D135015
2022-01-05 00:55:53 +00:00
Mike Hommey
c8b3725838 Bug 1647542 - Handle host libraries properly when cross-compiling on Windows. r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D135013
2022-01-05 00:47:55 +00:00
Mike Hommey
2e3512fec0 Bug 1748383 - In configure, make e.g. os.path.join mean the same thing whether importing os or not. r=firefox-build-system-reviewers,mhentges
Currently, using any of the functions defined in
`ConfigureSandbox.OS.path` in a `@depends` function will have a different
behavior if the function has an `@imports("os")` or not. In the former
case, we get plain `os.path.$function`, while in the latter we get the
function from `ConfigureSandbox.OS.path`, which handles path separators
differently, which makes a significant difference on Windows.

With this change, we now consistently use the versions from
`ConfigureSandbox.OS.path`.

Differential Revision: https://phabricator.services.mozilla.com/D135003
2022-01-05 00:47:54 +00:00
Mike Hommey
175a906701 Bug 1748385 - Use the --dont-define-prefix flag of pkg-config when supported. r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D135012
2022-01-05 00:02:43 +00:00
Mike Hommey
712bc21cc3 Bug 1748385 - Add --shared flag when using pkgconf >= 1.7.4. r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D135011
2022-01-05 00:02:42 +00:00
Mike Hommey
984c10a4da Bug 1748385 - Add a pkgconf toolchain and use it. r=firefox-build-system-reviewers,mhentges
pkgconf is an alternative implementation of pkg-config that is more
cross-platform. It has also become the default on Fedora, so it's not
some random project.

Differential Revision: https://phabricator.services.mozilla.com/D135009
2022-01-05 00:02:41 +00:00
Narcis Beleuzu
f2f81f1805 Backed out 5 changesets (bug 1748385, bug 513617) for bustages on pkg.configure . CLOSED TREE
Backed out changeset bc23b3cfb583 (bug 1748385)
Backed out changeset 53f3c4e3e600 (bug 1748385)
Backed out changeset 5c744edba720 (bug 1748385)
Backed out changeset ad23d3af4df6 (bug 1748385)
Backed out changeset 54e3431d9152 (bug 513617)
2022-01-05 01:23:29 +02:00
Mike Hommey
fa708cd321 Bug 1748385 - Use the --dont-define-prefix flag of pkg-config when supported. r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D135012
2022-01-04 22:57:02 +00:00
Mike Hommey
bcb3a8ffa8 Bug 1748385 - Add --shared flag when using pkgconf >= 1.7.4. r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D135011
2022-01-04 22:57:02 +00:00
Mike Hommey
5b8a881fcd Bug 1748385 - Add a pkgconf toolchain and use it. r=firefox-build-system-reviewers,mhentges
pkgconf is an alternative implementation of pkg-config that is more
cross-platform. It has also become the default on Fedora, so it's not
some random project.

Differential Revision: https://phabricator.services.mozilla.com/D135009
2022-01-04 22:57:01 +00:00
Mitchell Hentges
6d1070bc8e Bug 1725895: Port --profile-command to pure-Python r=nalexander,glandium
As part of this, the shell-script part of `./mach` can be removed,
making it pure Python.

There's a change in `--profile-command` behaviour, though: it now only
profiles the specific command, rather than all of Mach.
This is because _so much of Mach_ has already been run before
CLI arguments are parsed in the Python process.

If a developer wants to profile Mach itself, they can manually run
`python3 -m cProfile -o <file> ./mach ...`

Differential Revision: https://phabricator.services.mozilla.com/D133928
2022-01-04 21:07:32 +00:00
Tom Ritter
97b381cf46 Bug 1743688: Allow specifying and passing arguments to the script run during vendoring r=jewilde
Depends on D129534

Differential Revision: https://phabricator.services.mozilla.com/D129535
2022-01-04 20:53:29 +00:00
Tom Ritter
1088f3b6d8 Bug 1743688: Add a new type of source hosting for angle to look for the upstream branch on chrome beta r=jgilbert,jewilde
Depends on D129533

Differential Revision: https://phabricator.services.mozilla.com/D129534
2022-01-04 20:53:28 +00:00
Tom Ritter
c85956929c Bug 1743688: Moving tracking from updatebot to vendoring r=jewilde
It occurs to me that because tracking is a general vendoring need
(not just for updatebot) that it should live under vendoring.

Depends on D129437

Differential Revision: https://phabricator.services.mozilla.com/D129533
2022-01-04 20:53:28 +00:00
Tom Ritter
24c3108868 Bug 1743688: Fix a bit in rewrite_mozbuild r=jewilde
Depends on D129436

Differential Revision: https://phabricator.services.mozilla.com/D129437
2022-01-04 20:53:28 +00:00
Tom Ritter
70d295b5b5 Bug 1743688: Fix some nuances of run-script r=jewilde
Depends on D129434

Differential Revision: https://phabricator.services.mozilla.com/D129436
2022-01-04 20:53:27 +00:00
Tom Ritter
669062b380 Bug 1743688: Allow a moz.yaml to skip certain vendoring steps r=jewilde
Differential Revision: https://phabricator.services.mozilla.com/D129434
2022-01-04 20:53:27 +00:00
Alex Ionescu
bdef3dab91 Bug 1741896 Accept/prevent first load prompts for CNN during automated recording r=perftest-reviewers,kimberlythegeek
Differential Revision: https://phabricator.services.mozilla.com/D131508
2022-01-03 07:12:51 +00:00
Mike Hommey
7d23cf8bc3 Bug 1747533 - Update clang pass manager flags handling. r=firefox-build-system-reviewers,andi
- Avoid the flag selection silently not enabling the new pass manager
  when --enable-new-pass-manager is passed explicitly.
- Avoid adding the -fexperimental-new-pass-manager to clang >= 13, which
  has it enabled by default. Likewise for the linker flags.
- Remove the force-enable of the new pass manager with clang < 12 on
  automation, since we're using version 13 anyways.
- Account for the fact that both lld and ld64 can pass the
  -import-hot-multiplier flag to the LTO plugin on mac builds, which
  effectively will set it for the first time on mac, and might improve
  performance.

Differential Revision: https://phabricator.services.mozilla.com/D134860
2021-12-31 08:41:16 +00:00
Mitchell Hentges
6defd7872e Bug 1732946: Guard against "pip install" venv conflicts r=ahal
`pip install`'s standard behaviour is to satisfy the new requirement,
even if it conflicts with existing packages. If a conflict _does_
occur, `pip` will simply warn about it after the installation has
already damaged the environment.

By using the `--constraint` feature, we force `pip` to consider
already-installed packages before installing new ones. If a conflict
is detected, an error is raised and `pip` stops without damaging
the environment.

Since we're capturing system packages (when needed) with this feature,
we can now allow virtualenvs that do pip-installations to safely work
with system-using Mach environments.

Differential Revision: https://phabricator.services.mozilla.com/D126925
2021-12-30 01:08:06 +00:00
Mitchell Hentges
16daa54462 Bug 1730712: Avoid redundant venv rebuilds in nested Mach calls r=perftest-reviewers,ahal,AlexandruIonescu
Port some `sys.path` modifications to the centralized system.
Not only is this cleaner (ad-hoc global modifications are spicy), but
this also avoids "reordering" issues that can creep in during nested
calls, causing virtualenvs to be unnecessarily recreated.

Differential Revision: https://phabricator.services.mozilla.com/D134481
2021-12-30 01:05:07 +00:00
Mike Hommey
789534e4b7 Bug 1747757 - Remove -l from OS_LIBS set from gyp. r=firefox-build-system-reviewers,mhentges
NSS gyp files use -l$lib, and while OS_LIBS accepts this form and passes
it through, it's not actually a recognized way to link libraries on
clang-cl builds. So, re-normalize the values to not include -l, which
will add it back in the backend when appropriate, or switch to $lib.lib
on platforms that use this form.

Differential Revision: https://phabricator.services.mozilla.com/D134736
2021-12-29 22:18:51 +00:00
Mitchell Hentges
bd24f5ae31 Bug 1730712: Maintain sys.path consistency in nested Mach calls r=ahal
This patch resolves cases like the following:
1. The system Python has `zstandard`.
2. `MOZ_AUTOMATION=1 ./mach python --virtualenv psutil <script>`
   is run, adding `psutil` to the import scope.
3. `<script>` runs Mach a _second_ time, and this time Mach needs to
   be able to import `zstandard` (in this case, it should be able
   to fetch it from the system Python's site-packages).

The previous behaviour would add the "site-packages" of the //invoking//
Python interpreter, but ancestor packages would get dropped.

To rectify this issue, this patch changes "import inheritance" to keep
more of the `sys.path`, rather than just
`<external-python>.all_site_packages_dirs()`.

Note: the original implementation of this patch passed forward *all*
of the `sys.path` when creating virtualenvs. However, this caused issues
when Mach ran `pip`, because `pip` was no longer able to discover the
"standard library" (it was failing because it assumed all paths defined
in a virtualenv's site were non-standard-library paths, and the original
implementation broke that assumption).

As part of this, a distinction was defined between the "current" Python
interpreter (external_python) and the top-level Python interpreter
(original_python). This was needed to enable discovering which paths
are "standard library paths".

Differential Revision: https://phabricator.services.mozilla.com/D134201
2021-12-29 21:10:22 +00:00
Kelsey Gilbert
611b954b8b Bug 1747745 - Fix git worktree support in ./mach bootstrap. r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D134719
2021-12-29 20:20:53 +00:00
Aki Sasaki
7fd49c7c6c Bug 1747280 - nuke comm/ after cross-channel. r=mhentges,releng-reviewers,jmaher DONTBUILD
We clean up our Gecko clone between tasks via `hg robustcheckout --purge`, which runs `hg purge`. This is very effective, *but* it doesn't detect or clean up any nested clones.

Because we run cross-channel on Gecko workers, and because we clone `comm/` in cross-channel and haven't cleaned it up, and because `hg purge` doesn't detect or clean up nested clones, and because our current virtualenv setup code traverses the tree and can error out on `comm/` clones, let's clean up `comm/` after running cross-channel.

We'll be moving TB cross-channel to different tasks/workers in bug 1742711, and ideally we can update robustcheckout and/or `hg purge` to be able to detect and/or clean up nested clones.

Differential Revision: https://phabricator.services.mozilla.com/D134582
2021-12-28 18:56:47 +00:00
Iulian Moraru
807cb3eabc Backed out changeset 68098f573c46 (bug 1747280) for causing Bug 1747545. CLOSED TREE 2021-12-24 20:28:14 +02:00
Mike Hommey
5b0a825138 Bug 1747347 - Use configure autobootstrap code to install toolchains in mach bootstrap. r=firefox-build-system-reviewers,andi
This uses the same trick as bug 1743832 under the hood. We could go the
other way around, extracting the configure code to a separate module,
but the longer term goal here is to have configure figure out which
things to bootstrap for the selected build type.

As a side effect, mach bootstrap will stop re-bootstrapping things that
are already up-to-date, at least for things using
install_toolchain_artifact, excluding those that don't follow the
convention wrt the extracted directory path.

Differential Revision: https://phabricator.services.mozilla.com/D134595
2021-12-23 20:55:36 +00:00
Emilio Cobos Álvarez
c4feb0cacb Bug 1747387 - Fix MozillaBuildBootstrapper after bug 1747216. r=firefox-build-system-reviewers,glandium
Differential Revision: https://phabricator.services.mozilla.com/D134608
2021-12-23 20:42:18 +00:00
Mike Hommey
a71fe510de Bug 1747165 - Replace TK_FLAGS/TK_LIBS with MOZ_GTK3_FLAGS/MOZ_GTK3_LIBS. r=firefox-build-system-reviewers,andi
Differential Revision: https://phabricator.services.mozilla.com/D134464
2021-12-23 20:29:07 +00:00
Aki Sasaki
c02c699f01 Bug 1747280 - nuke comm/ after cross-channel. r=releng-reviewers,jmaher DONTBUILD
We clean up our Gecko clone between tasks via `hg robustcheckout --purge`, which runs `hg purge`. This is very effective, *but* it doesn't detect or clean up any nested clones.

Because we run cross-channel on Gecko workers, and because we clone `comm/` in cross-channel and haven't cleaned it up, and because `hg purge` doesn't detect or clean up nested clones, and because our current virtualenv setup code traverses the tree and can error out on `comm/` clones, let's clean up `comm/` after running cross-channel.

We'll be moving TB cross-channel to different tasks/workers in bug 1742711, and ideally we can update robustcheckout and/or `hg purge` to be able to detect and/or clean up nested clones.

Differential Revision: https://phabricator.services.mozilla.com/D134582
2021-12-23 19:25:02 +00:00
Cristian Tuns
2a2628c8e6 Backed out 2 changesets (bug 1747165) for causing nightly blockers(bustages) a=backout
Backed out changeset 4b1ab0915c94 (bug 1747165)
Backed out changeset 96043d814772 (bug 1747165)
2021-12-23 08:00:54 -05:00
Sandor Molnar
d64333870b Backed out changeset 9cef54c30d49 (bug 1648114) for causing python unit test failures in test_mach_commands. CLOSED TREE 2021-12-23 02:50:20 +02:00
Gijs Kruitbosch
160848c70b Bug 1648114 - make clang-tidy easier to find, r=andi
Differential Revision: https://phabricator.services.mozilla.com/D133191
2021-12-23 00:29:10 +00:00
Mike Hommey
e91afd2299 Bug 1747165 - Replace TK_FLAGS/TK_LIBS with MOZ_GTK3_FLAGS/MOZ_GTK3_LIBS. r=firefox-build-system-reviewers,andi
Differential Revision: https://phabricator.services.mozilla.com/D134464
2021-12-22 23:56:24 +00:00
Mike Hommey
6e4c67c9c5 Bug 1747216 - Avoid passing state and source directory to all Bootstrapper methods. r=firefox-build-system-reviewers,nalexander
Differential Revision: https://phabricator.services.mozilla.com/D134489
2021-12-22 21:09:51 +00:00
Mike Hommey
54c1ee11e6 Bug 1747215 - Stop bootstrapping node/npm from Linux distro packages. r=firefox-build-system-reviewers,andi
We install it via a toolchain artifact anyways, if not via mach
bootstrap, via configure's autobootstrap.

Differential Revision: https://phabricator.services.mozilla.com/D134488
2021-12-22 21:09:51 +00:00
Mike Hommey
fd396b046f Bug 1747211 - Stop bootstrapping nasm from Linux distro packages r=firefox-build-system-reviewers,andi
We install it via a toolchain artifact anyways, if not via mach
bootstrap, via configure's autobootstrap.

Differential Revision: https://phabricator.services.mozilla.com/D134487
2021-12-22 21:09:50 +00:00
Mitchell Hentges
872dd953b4 Bug 1730712: Abstract site behaviour from requirements.py r=ahal
There are two sites that are allowed to define their dependencies
in a flexible way: the `mach` and `build` sites.

This is because these are the only two sites that _may_ have
to operate without `pip install`-ing any packages, and instead having
to be compatible with the packages installed to the system.

Due to this required compatibility, allowing flexibility to these sites
allows flexibility downstream.

Anyways, this patch isn't about that - that behaviour has already
landed. This patch is about tweaking `requirements.py` so that
*it* doesn't care about specific sites, but rather only cares about
if it should assert `only_strict_requirements` or not. Accordingly,
the helpful "not all packages are pinned" error message is moved
to `site.py`, where it belongs.

Differential Revision: https://phabricator.services.mozilla.com/D132082
2021-12-22 00:46:25 +00:00
Mitchell Hentges
d4d6a4069f Bug 1730712: Perform command-site "pip check" if Mach using system scope r=ahal
Even if a command site has its own comfy virtualenv, if Mach is using
the system packages then they'll still be in-scope for commands.

So, we still need to `_assert_pip_check()` in case the command's
vendored packages conflict.

Differential Revision: https://phabricator.services.mozilla.com/D132168
2021-12-22 00:46:25 +00:00
Mitchell Hentges
8c4b1541c3 Bug 1732946: Adjust "use 'vendored:'?" warn to be more aligned with pip r=ahal
Pip is able to detect unpacked sdists because they have a `.egg-info`
directory, *not* because they have a top-level `PKG-INFO` file.

This is confirmed by the `MarkupSafe` case, where pip can see the
package in `third_party/python/MarkupSafe/src`, even though there's no
`PKG-INFO` at that depth.

Make two other changes as part of this:
* Only submit the warning if the package is under a "third_party"
  directory to avoid a false positive when the developer has performed
  a "pip install -e" on a first-party module
* Move the check to `test_site_compatibility` to avoid unnecessary
  validation at runtime.

Differential Revision: https://phabricator.services.mozilla.com/D126924
2021-12-22 00:46:24 +00:00
Makoto Kato
8ccd98e2dc Bug 1746770 - "mach vendor rust" fails when crate has the directory name that uses space character. r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D134241
2021-12-21 01:26:21 +00:00
Mitchell Hentges
39486be7bb Bug 1746325: Defer/avoid creation of scoped state dir for command sites r=ahal
In CI, we sometimes don't have permissions to create a scoped state dir.
Additionally, the current behaviour for resolving the path to a scoped
state dir will also attempt to create it if it doesn't exist.

There's likely a more eloquent solution, but the short-term fix is to
have sites defer the resolution of the state dir until they _know_ they
need it.

Differential Revision: https://phabricator.services.mozilla.com/D134066
2021-12-20 17:26:17 +00:00
Iulian Moraru
7a700934ee Merge autoland to mozilla-central. a=merge 2021-12-19 23:48:35 +02:00
Csoregi Natalia
37363533d1 Backed out changeset de9e103ffea4 (bug 1732946) for causing mach issues. a=backout 2021-12-19 23:02:13 +02:00
Geoff Brown
1741fd22b2 Bug 1744091 - [mach run] Run with fission enabled by default on desktop; r=releng-reviewers,jmaher
Differential Revision: https://phabricator.services.mozilla.com/D134215
2021-12-18 22:33:51 +00:00