summaryrefslogtreecommitdiff
path: root/mesonbuild/msubprojects.py
AgeCommit message (Collapse)Author
2025-10-30mdist: fix failure to create tar files the user asked to createEli Schwartz
Python added a "feature" to assume tarfile extraction is meant solely for "data", i.e. it ignores many useful features of tar such as symlinks, ownership, or permission modes that are uncommon on Windows. Revert this entirely, as Meson is a "fully trusted" application. It can already execute arbitrary programs, tar files are not vulnerabilities. In theory "tar" mode exists and is not "data", but we are fully trusted so why split hairs? Fixes: https://github.com/mesonbuild/meson/issues/15142
2025-07-29subprojects: add --filter optionPaolo Bonzini
2025-07-29subprojects: allow passing a fnmatch patternPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-11-06Check for uppercase 'head' when updating subprojectsandy5995
2024-06-14wrap: Clarify PackageDefinition APIXavier Claessens
This will simplify creating PackageDefinition objects from Cargo.lock file. It contains basically the same information.
2024-02-22wrap: remove Resolver.packagenameDylan Baker
Instead of being instance state, it's passed around. This isn't a big deal internally since most of the users are protected, and the only time an external change is required is a couple of places in msubprojects, which is fine because the information is available. Fixes: #12869
2023-11-06msubprojects: Fix --sourcedir argument not workingXavier Claessens
This is a regression caused by https://github.com/mesonbuild/meson/pull/11951. Fixes: #12466
2023-11-01Add comments suggesting to keep shell completion scripts up-to-date near cmd ↵Luke Elliott
line argument code
2023-10-20Support -j as a shorthand for --num-processesTristan Partin
We already use -j to support parallelism in meson compile. So let's add the same for meson test and meson subprojects.
2023-10-17msubprojects: Fix typo 'any way' -> 'anyway'Nirbheek Chauhan
2023-10-17msubprojects: Fix crash if wrapdb_version is in bad formatXavier Claessens
Fixes: #12378
2023-10-11msubprojects: Checkout if the branch is tracking upstreamNirbheek Chauhan
A rebase of the current branch is the wrong thing to do if the revision (branch) specified in the wrap changed, which is the case in the majority of cases, such as when switching from one release branch to another.
2023-10-11msubprojects: Abort the rebase if there's conflictsNirbheek Chauhan
Don't leave the subproject tree in a broken / conflicting state. The user is most likely not a git expert who will know what magic command to run to fix their source tree.
2023-09-22Allow to fallback to cmake subprojectXavier Claessens
The method can be overridden by setting the `method` key in the wrap file and always defaults to 'meson'. cmake.subproject() is still needed in case specific cmake options need to be passed. This also makes it easier to extend to other methods in the future e.g. cargo.
2023-09-12msubprojects: Speedup subproject_dir extractionXavier Claessens
The interpreter takes significant amount of time to initialize everything in project() function. We only need to extract a string from AST, just like we do in handle_meson_version_from_ast().
2023-07-19move various bits of type-checking only code to TYPE_CHECKING blocksEli Schwartz
Mostly detected with flake8-type-checking. Also quote T.cast() first arguments, since those are not affected by future annotations.
2023-07-10parse meson.build for subproject_dir in msubprojectsRafael Silva
we parse project from source meson.build with IntrospectionInterpreter
2023-07-10rename msubprojects src_dir to source_dirRafael Silva
source_dir seems to be the most common name across the code base with 400+ hits
2023-05-25ProgressBar: Fix some rendering issuesXavier Claessens
- Do not hardcode terminal width of 100 chars, that breaks rendering on smaller terminal. It already uses current console width by default. - Disable progress bar when downloading from msubprojects because it fetches multiple wraps in parallel. - Scale unit when downloading e.g. MB/s. - Do not display rate when it's not a download. - Do not display time elapsed to simplify the rendering.
2023-03-30fix regression that broken git-based wraps with dirty contentsEli Schwartz
In commit 8da060706c2c34fbea91898509123cb190894f3e we fixed an issue where stashing would ignore untracked files, potentially conflicting with what we reset to. Unfortunately in the process it broke the functionality entirely, by producing an invalid git command... according to some versions of git. This is actually a git bug, fixed upstream in git 2.37.0 via commit b02fdbc80a41f73ceb6c99e8e27b22285243a335. It causes git itself to re-synthesize the command line for a negation pathspec with a "." rather than "", as that's what is needed to make it match all files other than the negation. For backwards compatibility to older versions of git, we manually pass the dot pathspec ourselves.
2023-03-17Fix "meson subprojects checkout -b" regressionXavier Claessens
The argument position is wrong since https://github.com/mesonbuild/meson/commit/1c631ec8abd34df9971ab03faf22d709f1c54348
2023-03-04msubprojects: fix potential error when resetting a git checkoutBenoit Pierre
Untracked files need to be stashed too, or resetting may fail when trying to (re-)apply a patch that adds one of those untracked files.
2023-01-04be more explicit about asyncio usageEli Schwartz
`get_event_loop()` would always implicitly create one on demand, but Python upstream has decided it's a bad/confusing API. Explicitly starting our own, then setting it, is exactly equivalent other than not being scheduled for deprecation.
2022-10-21msubprojects: Fix issues when updating all wrapsXavier Claessens
When updating all wraps, it is not an error if some have not been downloaded or some does not have a wrap file.
2022-10-11Make `meson wrap update` command update all wraps in parallelXavier Claessens
This moves the implementation into msubprojects because it has all the infrastructure to update wraps in parallel while keeping "meson wrap" UX.
2022-09-27Fix mypy lintTristan Partin
Unused "type:ignore"
2022-09-18Warn if wrap file changesDaniel Carson
Save off the hash of the wrap file when first configuring a subproject. When reconfiguring a subproject, check the hash of the wrap file against the stored hash. If they don't match then warn the user.
2022-06-10treewide: various cleanups to move imports for mypy into typechecking blocksEli Schwartz
Along the way, add __future__ annotations where lacking.
2022-06-07wrap: Add support for applying a list of patch filesPaweł Marczewski
Co-authored-by: Xavier Claessens <xavier.claessens@collabora.com>
2022-04-14pyupgrade --py37-plusEli Schwartz
Some more old style code crept in again. Additionally, pyupgrade learned to catch more if/elsed code based on the python version, and delete it.
2022-03-27wrap: implement allow-insecure for 'meson wrap'Eli Schwartz
2022-03-27wrap: add functionality to specify whether insecure downloads should be usedEli Schwartz
We have a fallback route in `meson subprojects download` and friends, which tries to retrieve wrapdb urls via http, if Python was not built with SSL support. Stop doing this. Replace it with a command line option to specify that insecure downloads are wanted, and reference it in the error message if downloading fails due to SSL issues.
2022-02-16flake8: remove some redundant separatorsEli Schwartz
2022-01-10first pass at migrating to dataclassesEli Schwartz
In some cases, init variables that accept None as a sentinel and immediately overwrite with [], are migrated to dataclass field factories. \o/ Note: dataclasses by default cannot provide eq methods, as they then become unhashable. In the future we may wish to opt into declaring them frozen, instead/additionally.
2021-11-28Add typing to msubprojects.pyTristan Partin
2021-10-10msubprojects: implement "packagefiles --save"Eli Schwartz
Copies packagefiles from the subproject back to the patch_directory for safe storage and to check into git etc.
2021-10-10msubprojects: add new subcommand "packagefiles"Eli Schwartz
This will re-apply the meson.build patch overlay, ensuring it is up to date. Also take the opportunity offered by this infrastructure to repatch when performing `update --reset` since internally this will run `git stash` and thus cause the (possibly locally modified) meson.build files to disappear.
2021-10-10Revert "msubprojects: if fetching the remote fails, gracefully fallback to ↵Eli Schwartz
local copy" This reverts commit 4568482316f63c48559b97c9a4771740ed61eca6. As it turns out, the rationale for this was completely bogus. This command doesn't re-apply the patch_directory etc. and in fact there is no command whatsoever that does this. So, this command does not have two purposes, and we are not making one of them more robust -- instead it has one purpose, and we are making it lie about whether it failed. Instead of trying to freeload off of this command, we will just add another command to properly apply patch overlays.
2021-09-19msubprojects: when revision is an available commit, do not fetch updatesEli Schwartz
It's not even worth bothering to contact the network because it can never be anything other than what we have already.
2021-09-19msubprojects: if fetching the remote fails, gracefully fallback to local copyEli Schwartz
This command is useful to e.g. update a cloned subproject which does not have its packagefiles merged, or which has updated packagefiles. This does not strictly require internet, so if we can satisfy the ref, simply log a warning and continue. This enables a workflow where for network-isolated builds, the subproject is cloned and moved into place and later on the build orchestrator runs `meson subprojects update` without a network interface to initialize the subproject.
2021-09-19indent code in preparation for refactoringEli Schwartz
Because figuring out what changed on a single line in the middle of a reindent is pain.
2021-09-14fix traceback while trying to print error messageEli Schwartz
2021-07-27msubprojects: make purge print full paths to comply with the testsAndrei Alexeyev
2021-07-27msubprojects: do not follow symlinks when purgingAndrei Alexeyev
Fixes #8891
2021-07-21msubprojects: catch exceptions and continue with othersXavier Claessens
If the command fails for one subproject we should still continue with others. Failed subprojects are reported at the end. This issue became more problematic when doing parallel tasks because the reason the command fails was completely hidden by other parallel tasks.
2021-07-03Delete redirected wrap files in subprojects purgeTristan Partin
We need to store the original filename as well as whether the wrap was redirected in order to properly purge the redirected wrap.
2021-06-25msubprojects: Display progress while tasks are runningXavier Claessens
Logs are printed only when the task is done to not interleave logs while running multiple tasks in parallel. That means that nothing is printed until the task is done and that could take time.
2021-06-25msubprojects: Add message at the end of purgeXavier Claessens
2021-06-25msubprojects: Run action on all subprojects in parallelXavier Claessens
This moves all the code into a class and call its run() method in a thread. The class queues all logs to print them at the end to avoid mixing output of multiple actions.
2021-06-04wrap: Port to v2 protocolXavier Claessens
Fixes: #8754.