aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/msubprojects.py
AgeCommit message (Collapse)AuthorFilesLines
2022-09-18Warn if wrap file changesDaniel Carson1-5/+8
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 Schwartz1-1/+5
Along the way, add __future__ annotations where lacking.
2022-06-07wrap: Add support for applying a list of patch filesPaweł Marczewski1-0/+1
Co-authored-by: Xavier Claessens <xavier.claessens@collabora.com>
2022-04-14pyupgrade --py37-plusEli Schwartz1-2/+2
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 Schwartz1-2/+2
2022-03-27wrap: add functionality to specify whether insecure downloads should be usedEli Schwartz1-1/+4
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 Schwartz1-1/+1
2022-01-10first pass at migrating to dataclassesEli Schwartz1-7/+12
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 Partin1-62/+103
2021-10-10msubprojects: implement "packagefiles --save"Eli Schwartz1-2/+36
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 Schwartz1-1/+28
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 Schwartz1-8/+3
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 Schwartz1-1/+7
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 Schwartz1-3/+8
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 Schwartz1-15/+16
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 Schwartz1-1/+1
2021-07-27msubprojects: make purge print full paths to comply with the testsAndrei Alexeyev1-0/+2
2021-07-27msubprojects: do not follow symlinks when purgingAndrei Alexeyev1-1/+2
Fixes #8891
2021-07-21msubprojects: catch exceptions and continue with othersXavier Claessens1-1/+5
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 Partin1-1/+7
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 Claessens1-9/+49
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 Claessens1-0/+12
2021-06-25msubprojects: Run action on all subprojects in parallelXavier Claessens1-336/+377
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 Claessens1-6/+7
Fixes: #8754.
2021-04-26Add subprojects purge wrap-git coverageTristan Partin1-6/+8
2021-04-26Add 'subprojects purge' commandTristan Partin1-1/+63
This will help facilitate cache busting in certain situations, and replaces hand-rolled solutions of writing a length command to remove various files/folders within the subprojects directory.
2021-03-28msubprojects: wrap-file should be re-extracted with --resetXavier Claessens1-19/+25
When using --reset we should guarantee that next reconfigure will pick the latest code. For wrap-file we have no way to know if the revision changed, so we have to delete the source tree and extract again. It is unlikely that user has local changes in non-git subprojects, and --reset is known to be dangerous.
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz1-7/+7
performed by running "pyupgrade --py36-plus" and committing the results
2020-12-07msubprojects: Ignore worktrees when checking outNirbheek Chauhan1-1/+1
Otherwise it's not possible to share git subprojects via worktrees when creating a worktree of a git repository that uses meson subprojects. The downside is that the user needs to be careful while adding commits to each tree's index.
2020-11-20use real pathlib moduleDylan Baker1-1/+1
We added the _pathlib module to work around defeciencies in python 3.5's implementation, since we now rely on 3.6 lets drop this
2020-10-13Merge wraps from subprojects into wraps from main projectXavier Claessens1-1/+1
wraps from subprojects are now merged into the list of wraps from main project, so they can be used to download dependencies of dependencies instead of having to promote wraps manually. If multiple projects provides the same wrap file, the first one to be configured wins. This also fix usage of sub-subproject that don't have wrap files. We can now configure B when its source tree is at `subprojects/A/subprojects/B/`. This has the implication that we cannot assume that subproject "foo" is at `self.subproject_dir / 'foo'` any more.
2020-10-13msubprojects: Handle wrap-file to wrap-git caseXavier Claessens1-18/+34
2020-10-13msubprojects: Handle change of URL in wrap-gitXavier Claessens1-3/+25
2020-10-04pathlib: Fix resolve() by overriding it in Python 3.5Daniel Mensinger1-1/+1
2020-09-18msubprojects: Fix unit tests on WindowsXavier Claessens1-1/+2
2020-09-18msubprojects: Revert back to rev-parse instead of --show-currentXavier Claessens1-1/+3
It is undocumented in manpage, but --show-current is new in git 2.22 which is too recent for distros we want to support like Ubuntu 18.04.
2020-09-18msubprojects: Stop trying to guess subproject typeXavier Claessens1-3/+3
It was done to include them in `meson subprojects foreach` without --types argument, but it's better to special case missing --types and include wraps that have type=None too. It was a bad idea because that was messing them in `meson subprojects update`, now they are ignored by that command.
2020-09-18msubprojects: Avoid useless "no local changes to save" messageXavier Claessens1-3/+7
2020-09-18msubprojects: Fix checkout of new tag/branchXavier Claessens1-4/+9
If revision is a tag that does not exist locally, `git fetch origin <revision>` won't create it and checkout will fail. Using --refmap ensures that references exists locally.
2020-09-18msubprojects: Fix --types default valueXavier Claessens1-3/+5
2020-09-10msubprojects: Allow comma separated list of typesXavier Claessens1-6/+9
2020-09-10msubprojects: Fix review commentsXavier Claessens1-2/+8
2020-09-10git: Use Popen_safe to avoid encoding issuesXavier Claessens1-22/+23
2020-09-10msubprojects: Rework update commandXavier Claessens1-52/+96
Besides refactoring code into smaller functions: - Makes the --rebase behaviour the default for consistency: it was already rebasing when current branch and revision are the same, it is less confusing to rebase when they are different too. - Add --reset mode that checkout the new branch and hard reset that branch to remote commit. This new mode guarantees that every subproject are exactly at the wrap's revision. - Local changes are always stashed first to avoid any data loss. In the worst case scenario the user can always check reflog and stash list to rollback. Fixes: #7526
2020-09-10msubprojects: Return failure if some commands failedXavier Claessens1-23/+39
If the command fails on some subprojects continue with the rest but return non-0 code. This is useful for CI scripts to ensure it tests latest code instead of old cached code in case of network error or something.
2020-09-10msubprojects: Stash changes before checkoutXavier Claessens1-0/+3
2020-09-10msubprojects: Support git subprojects with no wrap fileXavier Claessens1-0/+7
User could have cloned manually a subproject.
2020-09-10msubprojects: Use less cryptic "git branch --show-current" commandXavier Claessens1-3/+3
It describes well what it does, compared to obscure "rev-parse".
2020-09-10msubprojects: Add --type argumentXavier Claessens1-0/+5
It is often desired to only update git repositories and not pull files from wrapdb.
2020-09-10msubprojects: Use wrap.Resolver() to load all PackageDefinitionXavier Claessens1-21/+16
Besides being simpler, it has the advantage of picking directories that don't have a .wrap file assotiated.