Commit Graph

61 Commits

Author SHA1 Message Date
nicklas boman
c3f1952ebe Bug 1798746 - Ensure checking for mercurial/git only if its a hg/git clone, not release source r=ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D162461
2023-05-09 16:33:36 +00:00
Cosmin Sabou
6f28253d4c Backed out changeset fab57c6553f4 (bug 1798746) for causing win aarch64 build bustages. CLOSED TREE 2023-05-09 08:25:18 +03:00
nicklas boman
641e4e6803 Bug 1798746 - Ensure checking for mercurial/git only if its a hg/git clone, not release source r=ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D162461
2023-05-09 02:15:30 +00:00
Iulian Moraru
5f08dc66c3 Backed out changeset 02cc74634f7d (bug 1798746) for causing build bustages. CLOSED TREE 2023-05-03 20:54:50 +03:00
nicklas boman
9871455d0d Bug 1798746 - Ensure checking for mercurial/git only if its a hg/git clone, not release source r=ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D162461
2023-05-03 15:45:36 +00:00
Marco Castelluccio
f69e697461 Bug 1801836 - Remove no longer necessary 'from __future__' imports. r=linter-reviewers,glandium,webdriver-reviewers,perftest-reviewers,geckoview-reviewers,jld,ahal,owlish,afinder DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D165395
2022-12-23 22:45:46 +00:00
Emilio Cobos Álvarez
de7acc6e32 Bug 1802405 - Prepend mozillabuild msys2 to path only for the build. r=glandium
This reverts bug 1801826 and instead prepends the msys2 path only for
the build, which is a bit more sensible.

This allows us to remove the existing warning from old_configure, since
that can't happen now.

Differential Revision: https://phabricator.services.mozilla.com/D163073
2022-11-26 23:23:34 +00:00
Marian-Vasile Laza
6b7ee54e9b Backed out changeset 738ee02dfc2a (bug 1802405) for causing build bustages. CLOSED TREE 2022-11-26 01:57:53 +02:00
Emilio Cobos Álvarez
fe8160e90a Bug 1802405 - Prepend mozillabuild msys2 to path only for the build. r=glandium
This reverts bug 1801826 and instead prepends the msys2 path only for
the build, which is a bit more sensible.

This allows us to remove the existing warning from old_configure, since
that can't happen now.

Differential Revision: https://phabricator.services.mozilla.com/D163073
2022-11-25 23:08:46 +00:00
Marco Castelluccio
ecb54845b0 Bug 1790816 - Reformat build/ with isort. r=linter-reviewers,ahal DONTBUILD
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D162668
2022-11-24 17:23:47 +00:00
Emilio Cobos Álvarez
26d1a61070 Bug 1801826 - Prepend rather than append mozillabuild path. r=ahochheiden
This makes sure that we find the right tools in the right msys2
environment in case we get called from another msys2 env.

Differential Revision: https://phabricator.services.mozilla.com/D162753
2022-11-23 18:17:28 +00:00
Mike Hommey
1c4a8ab901 Bug 1736762 - Stop waiting for user input before the creation of ~/.mozbuild . r=firefox-build-system-reviewers,ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D162638
2022-11-22 01:35:45 +00:00
Mark Striemer
02523cc40a Bug 1792237 - ./mach addwidget to scaffold a shared front-end component r=hjones
Depends on D161141

Differential Revision: https://phabricator.services.mozilla.com/D157937
2022-11-03 21:32:34 +00:00
Mark Striemer
e73bd9df47 Bug 1788797 - Move storybook commands to mach from npm scripts r=hjones,ahal
Differential Revision: https://phabricator.services.mozilla.com/D156241
2022-09-12 21:13:20 +00:00
Ben Dean-Kawamura
e965ed0056 Bug 1766045 - Adding mach command to generate UniFFI files r=glandium
Added `mach uniffi generate` which executes `uniffi-bindgen-gecko-js` to
generate UniFFI bindings. It's unfortunate that we need to check these
files in, but I couldn't figure out a way to auto-generate them as part
of the build process.

Adding `#include "nsIContent.h"` to dom/base/nsINodeList.h.  I think
that should have been present before, but things built okay because of
the way things got combined in the uniffied .cpp files. Adding these new
webIDL files bumped `NodeListBinding.cpp` to a new uniffied .cpp file
which caused the build to fail.

Differential Revision: https://phabricator.services.mozilla.com/D144468
2022-08-03 18:59:36 +00:00
Butkovits Atila
a8ad39a288 Backed out 6 changesets (bug 1766045) for causing build bustages. CLOSED TREE
Backed out changeset 113593df6272 (bug 1766045)
Backed out changeset f137315bb6af (bug 1766045)
Backed out changeset d86ad195a9a0 (bug 1766045)
Backed out changeset e8bc2ec40cff (bug 1766045)
Backed out changeset 2d33e41ac507 (bug 1766045)
Backed out changeset 4d5874e16302 (bug 1766045)
2022-08-03 17:40:30 +03:00
Ben Dean-Kawamura
86a582c07a Bug 1766045 - Adding mach command to generate UniFFI files r=glandium
Added `mach uniffi generate` which executes `uniffi-bindgen-gecko-js` to
generate UniFFI bindings. It's unfortunate that we need to check these
files in, but I couldn't figure out a way to auto-generate them as part
of the build process.

Adding `#include "nsIContent.h"` to dom/base/nsINodeList.h.  I think
that should have been present before, but things built okay because of
the way things got combined in the uniffied .cpp files. Adding these new
webIDL files bumped `NodeListBinding.cpp` to a new uniffied .cpp file
which caused the build to fail.

Differential Revision: https://phabricator.services.mozilla.com/D144468
2022-08-03 13:48:28 +00:00
Jan-Erik Rediger
21fd159579 Bug 1779992 - mach subcommand to upgrade Glean across all files. r=chutten DONTBUILD
This only modifies the files and prints the steps to be done manually.

Differential Revision: https://phabricator.services.mozilla.com/D152627
2022-07-26 13:51:31 +00:00
Barret Rennie
1ded07651e Bug 1779937 - Add mach xpcshell r=ahal,nalexander
Differential Revision: https://phabricator.services.mozilla.com/D151984
2022-07-21 00:47:45 +00:00
Tooru Fujisawa
1079972361 Bug 1776870 - Integrate esmify script into mach. r=yulia,firefox-static-analysis-reviewers,andi
Differential Revision: https://phabricator.services.mozilla.com/D150494
2022-07-11 14:55:11 +00:00
Bas Schouten
740a43ba09 Bug 1772510: Add 'mach perf-data-review' command that generates a template data review for simple performance monitoring probes. r=chutten,ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D148255
2022-07-08 12:40:44 +00:00
Jan-Erik Rediger
e4e54ac9c2 Bug 1774144 - mach: Only report physical cores if they could be determined. r=firefox-build-system-reviewers,ahochheiden
As per the docs:

> Return the number of logical CPUs in the system (same as os.cpu_count in Python 3.4) or None if undetermined.
> [...] On OpenBSD and NetBSD psutil.cpu_count(logical=False) always return None

Glean tries to coerce values to the expected type. `None` cannot be
coerced to an integer, so this blows up.
We conditionally report that value now only if we can properly detect
one.

Differential Revision: https://phabricator.services.mozilla.com/D149201
2022-06-15 08:10:40 +00:00
Mitchell Hentges
2ff00d22be Bug 1759681: Conditionally add each MozillaBuild path r=ahochheiden
When using Mach outside of MozillaBuild, rather than avoiding adding
paths entirely if any part of MozillaBuild is already in the `PATH`,
instead conditionally add each one if it doesn't exist already.

This ensures no duplication of paths, while also correctly handling the
not-uncommon case of developers manually adding MozillaBuild's Python to
their Windows `PATH`.

Differential Revision: https://phabricator.services.mozilla.com/D141377
2022-03-23 14:48:57 +00:00
Mitchell Hentges
f04ccd7a53 Bug 1759256: Update all PATH-munging to use os.pathsep r=webdriver-reviewers,ahochheiden,jgraham
Windows uses `;` as the path separator, Unix-based systems use `:`.
`os.pathsep` conveniently represents the current system's separator.

All OS-specific path separators have been replaced with `os.pathsep`
except for some explicitly Windows-specific mozharness configs.

Differential Revision: https://phabricator.services.mozilla.com/D140981
2022-03-14 18:41:49 +00:00
Thomas Wisniewski
6e59fe82c1 Bug 1715900 - Add a mach test-interventions command for testing webcompat interventions; r=jgraham,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D138384
2022-02-15 15:07:18 +00:00
Butkovits Atila
298b987a56 Backed out 3 changesets (bug 1715900) for causing Python failures. CLOSED TREE
Backed out changeset c1bad2dbd960 (bug 1715900)
Backed out changeset 2355ea418b97 (bug 1715900)
Backed out changeset 11c95163a2f6 (bug 1715900)
2022-02-11 20:41:49 +02:00
Thomas Wisniewski
10326d782c Bug 1715900 - Add a mach test-interventions command for testing webcompat interventions; r=jgraham,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D138384
2022-02-11 17:27:44 +00:00
Alex Lopez
2da2365f75 Bug 1388894 - Replace list of mach modules to load with a dict of mach commands r=mhentges
This starts a centralized place to keep track of mach commands with some essential
metadata.

Differential Revision: https://phabricator.services.mozilla.com/D136790
2022-02-02 20:25:21 +00:00
Alex Lopez
e39b3c93d9 Bug 1388894 - Add function in Mach to load commands from files in bulk. r=mhentges
This reduces some code duplication and paves the way for modifying how
Mach loads modules.

The plan is to follow this up by making this function take a more fleshed out 'spec'
that maps command names to the files they're defined at and possibly more metadata.
Since this may affect how Mach works internally (e.g. with lazy loading in the roadmap),
it makes sense to move this logic inside the Mach class.

Differential Revision: https://phabricator.services.mozilla.com/D136789
2022-02-02 20:25:20 +00:00
Mitchell Hentges
92a19e0eb9 Bug 1740123: Allow invoking Mach outside of MozillaBuild r=glandium
Assuming that the `MOZILLABUILD` environment variable is set, allow
invoking Mach from non-MozillaBuild terminals.

Note that MozillaBuild still needs to be installed, and the
`MOZILLABUILD` environment variable will have to be set.

For future reference: when I tried setting this up with Windows
Store's Python 3.9, I encountered issues when running binaries installed
via `pip`: it would fail with `abort: failed to load Python DLL
python3x.dll`.

Differential Revision: https://phabricator.services.mozilla.com/D133936
2022-01-06 06:49:47 +00:00
Mitchell Hentges
0445e1ce71 Bug 1740123: Move Python version check earlier r=ahal
Move Python version check as early as possible so that more code can
safely depend on modern behaviour while out-of-date Python versions still
get graceful error messages.

Without this change, Python 2 usages fail on importing `importlib.util`
before the nice "out-of-date version" warning is printed.

Differential Revision: https://phabricator.services.mozilla.com/D134185
2022-01-06 00:32:49 +00:00
Marian-Vasile Laza
7262acfd88 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
Mitchell Hentges
8fff83d33d Bug 1740123: Move Python version check earlier r=ahal
Move Python version check as early as possible so that more code can
safely depend on modern behaviour while out-of-date Python versions still
get graceful error messages.

Without this change, Python 2 usages fail on importing `importlib.util`
before the nice "out-of-date version" warning is printed.

Differential Revision: https://phabricator.services.mozilla.com/D134185
2022-01-04 21:07:32 +00:00
Mitchell Hentges
0fb9e1cb04 Bug 1743592: Don't resolve/create scoped state_dir in CI r=ahal
We only need a workdir-scoped state_dir when an on-disk virtualenv will
be created for the Mach site.

This change defers the resolution of the state_dir until we know that a
VENV will be created.

Also modify "telemetry.py" so that it isn't creating a
scoped state-dir to compare "sys.executable" against.

Differential Revision: https://phabricator.services.mozilla.com/D132706
2021-12-03 16:26:45 +00:00
Mitchell Hentges
6571032077 Bug 1739067: Scope Mach virtualenv to be checkout-specific r=perftest-reviewers,ahal,sparky
Build and run the Mach virtualenv from a `state_dir` that is
"specific-to-topsrcdir".

As part of this, move `get_state_dir()` to `mach` so that it's usable
before `sys.path` entries are fully set up.

Differential Revision: https://phabricator.services.mozilla.com/D130383
2021-11-29 22:33:54 +00:00
Mitchell Hentges
abeedf3bbd Bug 1717051: Automatically create and activate Mach virtualenv r=ahal
Consolidate Mach virtualenv management to the front of the
Mach process. This obsoletes `./mach create-mach-environment`
and simplifies the `sh` portion of the top-level `./mach` script.

This helps ensure that the Mach virtualenv doesn't become
out-of-sync and simplifies the mental model of the Mach
virtualenv situation.

Differential Revision: https://phabricator.services.mozilla.com/D120401
2021-11-24 20:06:33 +00:00
Mitchell Hentges
cea54423c4 Bug 1738848: Handle virtualenv case where metadata file is missing r=ahal
At Mach initialization time, it needs to know if it's not running from
the Mach virtualenv so it can decide to insulate itself from the
external sys.path.

However, the current mechanism of detecting the Mach virtualenv
struggles if the venv is old, and therefore missing its metadata file.
In such a case, it's recognized as "not the Mach venv" rather than "an
out-of-date Mach venv".

As part of this, I'm realizing that simply using the metadata file as a
"virtualenv has finished building" marker is insufficient, because it
will cause similar confusion here. This is solved with a "finalization"
key in in the metadata.

Differential Revision: https://phabricator.services.mozilla.com/D130794
2021-11-24 20:06:31 +00:00
Mitchell Hentges
84e16b0d9c Bug 1730712: Split site manager into command and mach managers r=ahal
The command site manager needs to be able to do ad-hoc pip
installations, while the Mach site manager needs to manage
the system `sys.path` and conditionally create an on-disk
virtualenv.

By splitting the class into two, we can now give each use case the
attention it deserves.

Differential Revision: https://phabricator.services.mozilla.com/D129529
2021-11-17 20:54:27 +00:00
Mitchell Hentges
876c31175a Bug 1730712: Remove pip package check in site.up_to_date() r=ahal
Sorry for the flip-flop on technique here :S

`validate_environment_packages()` was originally run when checking if a
site is up-to-date to ensure that ad-hoc pip installs didn't replace
needed packages with those of different versions.

However, since it was added, a few notes have come up:
1. The case where requirements change isn't caught by this - that is
  caught earlier by the cheap "a requirements file has changed on-disk"
  check.
2. This is really slow, and doing it for most Mach commands is not worth
  it (as evident by how the `skip_pip_package_check` was already added
  for the Mach site's use case).
3. Since the tree as-is doesn't have (common) cases where ad-hoc
  installations break an environment, then this check, though helpful,
  isn't adding a significant amount of value considering its performance
  cost.

However, these aren't to say that this won't be valuable in the future:
I'd like to reach a point where sites are considered "sealed" by
default: no ad-hoc pip installations are allowed.
However, add the ability to mark sites as unsealed/"allowing
ad-hoc pip installations". Then, re-add the pip package check, but only
for such flexible, unsealed virtualenvs.

Differential Revision: https://phabricator.services.mozilla.com/D129692
2021-11-17 20:54:26 +00:00
Mitchell Hentges
725792bd05 Bug 1730712: Update "Moz site" terminology r=ahal
The existing terminology had two issues:
* `VirtualenvManager` wasn't always associated with an on-disk
  `virtualenv`: for example, when running in automation, Mach
  "activates" a `VirtualenvManager`, updating its import scope,
  but without ever creating an on-disk `virtualenv`.
* An upcoming patch splits the `VirtualenvManager` class, pulling
  "on-disk virtualenv-handling functions" from the project-wide
  interface for managing Python's import scope.

After some good discussion with Ahal, I think we've struck
the terminology that handles this distinction well: we'll call
the "import scope"-handling part the "site", and we'll continue
to call on-disk virtualenvs (and their representative classes)
as, well, virtualenvs.

Differential Revision: https://phabricator.services.mozilla.com/D130391
2021-11-17 20:54:23 +00:00
Mitchell Hentges
67be954a8c Bug 1739177: Add requirements.pths_as_absolute() r=ahal
There were a bunch of locations where we were doing path shenanigans
with `requirements.pth/.vendored` items.

There was a bit of complexity because we were specifically making each
`pthfile` line be a relative path to support moving the Firefox
topsrcdir without causing issues.

However, now that we're more intelligent about checking if `pthfile`
lines are up-to-date (and since moving your topsrcdir will still require
re-generating the Mach virtualenv), this behaviour became less useful.

So, generalize `MachEnvRequirements` -> "sys.path lines" logic and
reuse it everywhere.

Differential Revision: https://phabricator.services.mozilla.com/D129693
2021-11-04 14:35:08 +00:00
Mitchell Hentges
a9f396324f Bug 1717051: Always populate Mach pths r=firefox-build-system-reviewers,glandium
The previous behaviour was to:
* Never add a `pthfile` to the Mach virtualenv, and
* Always add Mach's paths to the `sys.path` when Mach initializes

However, this meant that `pip` would needlessly install packages
that already exist in the vendored environment.

Tweak `pth` behaviour so that `pip` behaves more efficiently.

Differential Revision: https://phabricator.services.mozilla.com/D120402
2021-11-01 21:34:03 +00:00
Mitchell Hentges
537d201bcc Bug 1732948: Assert that the Mach venv isn't out-of-date during init r=ahal
As we leverage the Mach environment more, it becomes increasingly
important that it isn't out-of-date on developer machines.

Add an `up_to_date()` check during Mach initialization.
To minimize the cost to startup, I'm skipping the "pip list" check.

This change required moving `virtualenv` from `mozbuild` to `mach` to
make it available during the early stage of Mach init.

Differential Revision: https://phabricator.services.mozilla.com/D127144
2021-11-01 21:34:02 +00:00
Mitchell Hentges
f8a3e6458a Bug 1723031: In CI, assert Mach pypi package deps using system Python r=ahal
There's an existing algorithm to check if a virtualenv's installed
packages are up-to-date with its requirements. This patch
extracts that logic so that, in cases where we can't automatically
download needed pip packages, we can at least assert that the ones
installed to the system Python are sufficient to meet our requirements.

The current only case in which this system-checking logic is applied
is when starting the Mach virtualenv and the `MOZ_AUTOMATION` or
`MACH_USE_SYSTEM_PYTHON` environment variable is set.

Differential Revision: https://phabricator.services.mozilla.com/D122890
2021-10-13 15:57:40 +00:00
Mike Hommey
c1bd50d07c Bug 1734754 - Remove the use of MozbuildObject.mozconfig in mach_initialize. r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D127767
2021-10-12 04:05:32 +00:00
Alexandru Michis
820696d4a1 Backed out 2 changesets (bug 1734523) for causing python failures.
CLOSED TREE

Backed out changeset dcd0fedade7e (bug 1734523)
Backed out changeset cab1ceba09dd (bug 1734523)
2021-10-08 01:19:24 +03:00
Mike Hommey
f2e2f3db8a Bug 1734523 - Remove the use of MozbuildObject.mozconfig in mach_initialize. r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D127767
2021-10-07 21:22:19 +00:00
Narcis Beleuzu
7f08e7385e Backed out changeset 68940497078c (bug 1723031) for causing pip setup issues (bug 1733142) 2021-10-04 13:01:21 +03:00
criss
16f898657c Backed out changeset 894fc83e19a0 (bug 1717051) for causing busting macth commands. a=backout 2021-09-30 10:36:36 +03:00
Mitchell Hentges
ab439e4045 Bug 1717051: Always populate Mach pths r=firefox-build-system-reviewers,glandium
The previous behaviour was to:
* Never add a `pthfile` to the Mach virtualenv, and
* Always add Mach's paths to the `sys.path` when Mach initializes

However, this meant that `pip` would needlessly install packages
that already exist in the vendored environment.

Tweak `pth` behaviour so that `pip` behaves more efficiently.

Differential Revision: https://phabricator.services.mozilla.com/D120402
2021-09-29 15:09:36 +00:00