Граф коммитов

7352 Коммитов

Автор SHA1 Сообщение Дата
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 ea49f4cf67 Bug 1730712: Remove `metadata_path` parameter from `MozSiteManager` r=ahal
IIRC, this was added prematurely for an upcoming test due to a faulty
VCS commit split.

Let's temporarily remove this parameter, then re-add it when needed for
whatever test consumes it.

Differential Revision: https://phabricator.services.mozilla.com/D129691
2021-11-17 20:54:26 +00:00
Mitchell Hentges b9ed7da4d5 Bug 1730712: Remove redundant `__PYVENV_LAUNCHER__` purge r=ahal
As of bug 1686168, `__PYVENV_LAUNCHER__` is purged when Mach starts
running. Since `MozSiteManager` is only used by Mach, its internal
purging of the environment variable is redundant.

Differential Revision: https://phabricator.services.mozilla.com/D129690
2021-11-17 20:54:26 +00:00
Mitchell Hentges 2a5538b2f1 Bug 1730712: Remove unused `exe_info_path` from `VirtualenvManager` r=ahal
The information about the Python executable is now stored with other
details in the JSON metadata file we put in each virtualenv.

Differential Revision: https://phabricator.services.mozilla.com/D129689
2021-11-17 20:54:25 +00:00
Mitchell Hentges 8f554a6da0 Bug 1730712: Ensure virtualenv up-to-date before activation r=ahal
Rather than requiring that consumers remember to `ensure()` before
calling `activate()`, we can do so automatically during activation.
There isn't a valid use case in which we want obsolete virtualenvs to be
activateable.

Usages of `MozSiteManager` have been updated accordingly.

Differential Revision: https://phabricator.services.mozilla.com/D129688
2021-11-17 20:54:25 +00:00
Mitchell Hentges 723984c77d Bug 1730712: Inline virtualenv `create()` function r=ahal
`create()` was only called from one place, and had more complex logic
than necessary.

Related to this change, `check=True` is used rather than asserting the
return code.

Differential Revision: https://phabricator.services.mozilla.com/D129687
2021-11-17 20:54:24 +00:00
Mitchell Hentges 22e2aed3ed Bug 1730712: Contain virtualenv metadata file management inside of class r=ahal
`MozVirtualenvMetadata` only needs to know the virtualenv it's operating
on - the knowledge of its internal metadata filename should not have to
be exposed.

Differential Revision: https://phabricator.services.mozilla.com/D129686
2021-11-17 20:54:24 +00:00
Mitchell Hentges eebabfffe5 Bug 1730712: Split on-disk venv logic from `MozSiteManager` r=ahal
The current inheritance-based separation between "general venv
details" (`VirtualenvHelper`) and moz site details
(`MozSiteManager`) has caused `MozSiteManager` to care
about too many details.

This patch splits things apart a little more:
* The term `VirtualenvHelper` isn't _super_ useful, rename it to
  `PythonVenv` to show that it represents a Python virtualenv.
* Move on-disk virtualenv logic (`activate_path` location,
  `site-packages` location, `pip install` behaviour) into a
  contained `MozVirtualenv` class.
* Port the inheritance to a "composition" model instead.

Differential Revision: https://phabricator.services.mozilla.com/D129685
2021-11-17 20:54:23 +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 b7b1442242 Bug 1730712: Remove external use of `_run_pip()` r=perftest-reviewers,ahal,sparky
As `_run_pip()` is being removed from `VirtualenvManager` in an upcoming
patch, its usages need to be removed. Besides, they're using an
"internal" function, which is a bit of a smell.

Note that this _could_ have been solved by exposing a public `run_pip()`
function. However, I felt like that was worse because:
* Friction here is good as we try to migrate the codebase to embrace the
  "requirements definition file" technique to install dependencies.
* There could be confusion about the relationship between
  `install_pip_package()` (only works if venv already activated)
  and `_run_pip()`, which works "in general".

Differential Revision: https://phabricator.services.mozilla.com/D130120
2021-11-16 21:14:41 +00:00
Mitchell Hentges ea484ce0b5 Bug 1730712: Simplify _run_pip() behaviour r=ahal
`**kwargs` always had the same contents, so it can be inlined.

Differential Revision: https://phabricator.services.mozilla.com/D129878
2021-11-16 21:14:41 +00:00
Mitchell Hentges 7757071979 Bug 1730712: Inline `get_archflags()` r=ahal
It's only used in one location, so the separate function is
unncessary.

Differential Revision: https://phabricator.services.mozilla.com/D129684
2021-11-16 21:14:41 +00:00
Mitchell Hentges fc4d4c2f41 Bug 1730712: Python tests should use Python 3 automatically r=ahal
The virtualenv python is always Python 3, so inline the `version_info()`
function.

Differential Revision: https://phabricator.services.mozilla.com/D129324
2021-11-16 21:14:40 +00:00
Mitchell Hentges 6911c5b41d Bug 1730712: Remove customizeable `base_python` from VirtualenvManager r=ahal
The `base_python` parameter was used when we had both Python 2 and
Python 3 virtualenvs. Since that's no longer the case and it's now
unused, we can remove it.

Differential Revision: https://phabricator.services.mozilla.com/D129299
2021-11-16 21:14:40 +00:00
Mitchell Hentges 26d2818a4d Bug 1730712: Remove env var management before "pip install" r=andi
Now that the "build" virtualenv isn't created during configure, we can
remove the logic that tries to temporarily shelter pip from
configure's changes.

Differential Revision: https://phabricator.services.mozilla.com/D129868
2021-11-16 21:14:39 +00:00
Tom Ritter 12fdd98bd0 Bug 1740781: When we cannot add files in ./mach vendor, fail with a detectable error code r=jewilde
Differential Revision: https://phabricator.services.mozilla.com/D131008
2021-11-16 02:43:05 +00:00
Marian-Vasile Laza 25a09c0d08 Backed out changeset 561c776bea20 (bug 1740042) for causing build bustages on llvm-readelf. 2021-11-16 02:51:16 +02:00
Mike Hommey 5459f879e5 Bug 1740042 - Use llvm-readelf instead of readelf when available. r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D130949
2021-11-15 22:48:34 +00:00
Marian-Vasile Laza 51e3255d7c Backed out changeset bf55cb5e6b45 (bug 1740042) for causing build bustages. CLOSED TREE 2021-11-15 22:54:31 +02:00
Mike Hommey 2c9074abb8 Bug 1740042 - Use llvm-readelf instead of readelf when available. r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D130949
2021-11-15 20:41:41 +00:00
Mats Palmgren 89aa8c321b Bug 1721513 - Add devuan to DEBIAN_DISTROS. r=mhentges
Differential Revision: https://phabricator.services.mozilla.com/D131069
2021-11-15 16:09:13 +00:00
Andrew Halberstadt 5ef76d5211 Bug 1740620 - Fix regression to 'mach lint --outgoing' on Git, r=gerard-majax
Differential Revision: https://phabricator.services.mozilla.com/D130948
2021-11-13 16:16:34 +00:00
Iulian Moraru 897bb9d353 Backed out 2 changesets (bug 1707591) for causing python mozlint failures on test_yaml.py. CLOSED TREE
Backed out changeset a730ab2d0dbe (bug 1707591)
Backed out changeset 0269849fd7ef (bug 1707591)
2021-11-12 18:44:36 +02:00
Sylvestre Ledru c1b5edd8be Bug 1707591 - ride along - reformat the tree with black 21.10b0 r=webdriver-reviewers,whimboo,gerard-majax
This changed with this:
https://github.com/psf/black/pull/1740

Differential Revision: https://phabricator.services.mozilla.com/D130965
2021-11-12 15:06:56 +00:00
Tom Ritter ba401f9eb6 Bug 1740106: Implement a move-dir action for moz.yaml files r=jewilde
Differential Revision: https://phabricator.services.mozilla.com/D130677
2021-11-11 19:03:59 +00:00
James Teh 14b06e0792 Bug 1736742 part 1 fix: Correct COM UUIDs used for beta channel builds. r=nalexander
Previously, we always used the last UUID in configure.sh.
This is incorrect for beta because beta and release share the same "official" branding and the beta UUIDs are specified first.
We now decide whether to use the first or last UUID based on the channel.

Differential Revision: https://phabricator.services.mozilla.com/D130833
2021-11-11 02:18:38 +00:00
Geoff Lankow c40e648417 Bug 1740381 - Port bug 1736565 (Infer artifact build candidate tree based on version) for comm- trees. r=nalexander
This is the same configuration as for mozilla- trees as added in https://hg.mozilla.org/mozilla-central/rev/93e421a84361 except Thunderbird doesn't use comm-release.

Differential Revision: https://phabricator.services.mozilla.com/D130817
2021-11-09 23:33:55 +00:00
Mitchell Hentges 8f1fac4258 Bug 1739594: Don't hit network to resolve VCS-changed files r=ahal
Unless an upstream is specified, we should be able to detect which files
are changed on our local branch without hitting the network.

Differential Revision: https://phabricator.services.mozilla.com/D130684
2021-11-09 21:52:07 +00:00
Agi Sferro 9c6be8a1c5 Bug 1739701 - Add support for the arm64 Android emulator. r=gbrown,calu
My understanding is that this is the only version of the emulator that is
supported on Apple silicon.

Differential Revision: https://phabricator.services.mozilla.com/D130510
2021-11-09 21:47:25 +00:00
Csoregi Natalia dfae430e9c Backed out changeset fe34cb6515eb (bug 1739652) as per request. CLOSED TREE 2021-11-09 23:08:11 +02:00
Mike Hommey 4b9b98fb0f Bug 1739557 - Avoid warning about glean not loading when telemetry is disabled. r=mhentges
Differential Revision: https://phabricator.services.mozilla.com/D130438
2021-11-08 22:53:53 +00:00
Mike Hommey d907da5770 Bug 1739556 - Don't ignore the argument given to Mach::load_settings. r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D130437
2021-11-08 22:53:52 +00:00
Agi Sferro a6866ed06e Bug 1739652 - Upgrade cmdline-tools to 5.0. r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D130507
2021-11-08 22:07:54 +00:00
Mitchell Hentges 40a580dd41 Bug 1740114: Virtualenv.py changes shouldn't require venv rebuilds r=ahal
We now have more intelligent ways of checking if a venv is out-of-date:
* Are the `pth` files correct?
* Were any requirements files changed?

Differential Revision: https://phabricator.services.mozilla.com/D130678
2021-11-08 21:20:45 +00:00
Eemeli Aro abe62fefe1 Bug 1521792 - Migrate unknownContentType dialog DTD strings to fluent. r=Gijs,flod,fluent-reviewers
https://phabricator.services.mozilla.com/D21799

Differential Revision: https://phabricator.services.mozilla.com/D21799
2021-11-08 18:22:07 +00:00
Emilio Cobos Álvarez 4963e6b250 Bug 1739486 - Hack around https://github.com/pypa/virtualenv/issues/2208. r=mhentges
The virutalenv hack is in the fedora-distributed version of
virtualenv... Presumably eventually will become unnecessary once they
provide a proper "venv" distutils?

This patch applies both before and after the bump in comment 5, so your
call.

Differential Revision: https://phabricator.services.mozilla.com/D130410
2021-11-05 15:41:55 +00:00
James Teh 76ad0164ca Bug 1736742 part 1: Add missing a11y COM interfaces to Appx Manifest. r=nalexander
Differential Revision: https://phabricator.services.mozilla.com/D129949
2021-11-05 06:25:44 +00:00
Mitchell Hentges 4d5f166b49 Bug 1730712: Use consistent Python version throughout configure r=andi
It's possible for the `PYTHON3` config to point to a different Python
than that that is executing the configure scripts themselves.

This flexibility was needed for the Python 2->3 migration, but now that
it's complete, we can remove the extra configuration and just lean on
the Python interpreter used to run configure.

Differential Revision: https://phabricator.services.mozilla.com/D129863
2021-11-04 21:41:33 +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 cdfd8d15eb Bug 1739124: Add new requirements to mozperftest r=perftest-reviewers,sparky
The logic to handle virtualenv requirements definitions now need to be
able to import `packaging` and `pyparsing` in order to parse the pip
requirement specifier notation.

Differential Revision: https://phabricator.services.mozilla.com/D130288
2021-11-03 19:50:24 +00:00
Alex Hochheiden 1089cc39bc Bug 1686137 - Replace 'wget' with 'requests' in install_mobile_android_sdk_or_ndk to remove the external dependency on 'wget' r=mhentges,firefox-build-system-reviewers g=firefox-build-system-reviewers
Downloading, as well as resuming a partial download, of an SDK/NDK was
implemented. The progress bar was implemented via tqdm.

This is not a generic solution, but the same ideas could be used and improved
to replace 'dlmanager' in the future.

Differential Revision: https://phabricator.services.mozilla.com/D129063
2021-11-03 15:41:14 +00:00
Agi Sferro d4e0174d2c Bug 1529082 - Use bundletool to install apps as aab packages. r=ahal,owlish
This patch adds a new command line argument --aab which allows users to install
GVE as an AAB.

This will also be used in a future patch to install the test runner as AAB.

Differential Revision: https://phabricator.services.mozilla.com/D127323
2021-11-02 18:56:28 +00:00
Agi Sferro dccddb81bc Bug 1529082 - Move TestRunnerActivity to test_runner. r=ahal,owlish
The fact that the test runner app is defined inside the geckoview test package
has always felt like a hack to me. I've mistakenly thought that
TestRunnerActivity was used in GeckoView's junit tests many times (even though
that's not the case).

From what I can see, there's no way to generate an AAB package for androidTest,
so to be able to run Gecko tests as AAB we finally need to define the
TestRunner as an ordinary package instead.

Differential Revision: https://phabricator.services.mozilla.com/D127320
2021-11-02 18:56:26 +00:00
Agi Sferro 9e1b1f9456 Bug 1529082 - Add bundletool to Android's bootstrap r=jmaher
This tool is used to install AAB packages to devices.

AAB is the new package format for Android Apps and will supersede APK.

Differential Revision: https://phabricator.services.mozilla.com/D127318
2021-11-02 18:56:25 +00:00
Glowreeyah ce77d16f97 Bug 1738301 - Update the link to mercurial bundle documentation. r=mhentges
Differential Revision: https://phabricator.services.mozilla.com/D130169
2021-11-02 14:49:46 +00:00
Sebastian Hengst 22d3b81141 Merge mozilla-central to autoland. CLOSED TREE 2021-11-01 23:06:15 +01:00
Mitchell Hentges 973f0aa262 Bug 1730712: Remove customizeable log handle from VirtualenvManager r=ahal
The optional `log_handle` argument was only used by:

* Configure, but the output was always dumped to stdout and *not*
  `config.log`. The manual logging _was_ used to handle encoding issues,
  but those are likely invalidated by the Python 3 migration.
* `./mach doc`, where we were putting virtualenv setup into stderr,
  which seems incorrect. The commit adding it doesn't explain why it's
  the case, but I'm guessing it shouldn't be too risky to remove.

Additionally, `log_handle` was used very inconsistently: for example,
running `install_pip_package()` would _not_ use `log_handle`.
So, removing `log_handle` removes a bit of abstraction leakage.

Differential Revision: https://phabricator.services.mozilla.com/D129298
2021-11-01 21:34:05 +00:00
Mitchell Hentges 8d7a1cbad4 Bug 1730712: Remove redundant Python version check in configure r=glandium
Mach already verifies the Python version during initialization.

Maintaining a second version check can be tough to keep up-to-date, as
we're already seeing due to the obsolete Python 2 check.

Differential Revision: https://phabricator.services.mozilla.com/D129297
2021-11-01 21:34:05 +00:00
Mitchell Hentges 162c7ab422 Bug 1732946: Vendor pip/setuptools/wheel instead of installing into venv r=ahal
Now that are prioritizing system over virtualenv site-packages, the
system `pip` is sometimes being used instead.
This is causing issues when the system pip is set up in a
distro-specific way, such as when "debundled":
https://github.com/pypa/pip/blob/9.0.1/pip/_vendor/__init__.py#L53-L61

However, if we vendor `pip`, `setuptools` and `wheel`, and ensure that
they're prioritized in the `sys.path` before anything is imported from
the system, then we can ensure that we're using a modern `pip` _and_
sidestep system-specific pip weirdness.

Note that `pip-compile`'s `--allow-unsafe` flag is not as dangerous as
it sounds.
There's confusion among maintainers about its origin:
https://github.com/jazzband/pip-tools/issues/522
Additionally, it's going to be enabled by default in a future
`pip-tools` release. So, it's not scary for us to embrace here.

Also, heads up that the "pip outdated warning" no longer needs
to be manually silenced, since pip avoids that code path when
not running from an "installed" context.

Differential Revision: https://phabricator.services.mozilla.com/D127182
2021-11-01 21:34:03 +00:00