summaryrefslogtreecommitdiff
path: root/mesonbuild/wrap
AgeCommit message (Collapse)Author
2025-11-28Wrap `tarfile.fully_trusted_filter` in `staticmethod` for wrap file handling tooSebastian Dröge
That's how it is done in the other two places and without that one argument too many is passed to the filter function: ``` [...] File "/usr/lib/python3.14/site-packages/mesonbuild/wrap/wrap.py", line 607, in _get_file shutil.unpack_archive(path, extract_dir) ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.14/shutil.py", line 1432, in unpack_archive func(filename, extract_dir, **kwargs) ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.14/shutil.py", line 1349, in _unpack_tarfile tarobj.extractall(extract_dir, filter=filter) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.14/tarfile.py", line 2409, in extractall tarinfo, unfiltered = self._get_extract_tarinfo( ~~~~~~~~~~~~~~~~~~~~~~~~~^ member, filter_function, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.14/tarfile.py", line 2496, in _get_extract_tarinfo filtered = filter_function(unfiltered, path) TypeError: fully_trusted_filter() takes 2 positional arguments but 3 were given ```
2025-10-31wrap: automatically utilize truststore, if it is installedEli Schwartz
https://truststore.readthedocs.io/ This library allows patching the stdlib ssl module to respect system certificates, which is a common source of "broken internet" for Windows users especially. Fixes: https://github.com/mesonbuild/meson/issues/15121
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-10-26wrap: fix deps name access with lower directory nameStéphane Cerveau
2025-10-17make wrap search custom subprojects dirsCharlie Hutcheson
Changes from Dylan: - Don't use Path - merge the lint fixes - Fix some typing issues - Handle non-meson projects - Remove some code duplication by putting `get_subproject_dir` in utils
2025-10-14cargo: load a single Cargo.lock for a whole chain of subprojectsPaolo Bonzini
When processing cargo subprojects, each Resolver was independently loading Cargo.lock files, leading to duplicate wraps and errors like 'Multiple wrap files provide dependency'. Instead, build the cargo.Interpreter as soon as a Cargo.lock file is found, and merge that Cargo.lock into the wrap resolver. There is no need anymore to build a separate resolver for the dependent packages, because their indirect dependencies are all listed in the parent lockfile.
2025-10-14cargo: When loading wraps multiple packages can have the same URLXavier Claessens
This avoids cloning the same repo multiple times, instead a single wrap can provide multiple cargo dependencies.
2025-08-29utils: make .wraplock optionalPaolo Bonzini
.wraplock is nice to have, but prevents Meson from operating on a read-only source directory. If the source directory is read-only, there is no possible conflict so in that case it is acceptable to return without any actual locking. Fixes: #14948 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-08-01wrap: wraps from subprojects can replace directories found with no wrapXavier Claessens
If main project finds a directory subprojects/foo with no corresponding foo.wrap, it creates a dummy PackageDefinition for it. If we later find a subproject that has foo.wrap, replace the dummy wrap with it. This happens for example when wrap-redirect have been deleted. It also happens for subprojects downloaded from some Cargo.lock which does not create a wrap-redirect. Avoid loading the same location twice, which can happen when preparing cargo subprojects.
2025-08-01wrap: Add basic sftp support to wrap.get_data()Amp Tell
This requires any credentials to be supplied in the url, or some other means of authentication (such as an identity file configured for the user) to be used. Supplying a password in the URL is not supported.
2025-08-01wrap: Break out hash_file() functionAmp Tell
2025-08-01wrap: Slightly improve error message on wrap get failureAmp Tell
2025-07-19wrap: Don't use old patch.exe from Strawberry PerlNirbheek Chauhan
It is too old and barfs on patches from git-format-patch: ``` Applying diff file "orc-0.4.38\0001-meson-fix-symbols-leaking-from-static-library-on-Win.patch" patching file meson.build Assertation failed! Program: C:\Strawberry\c\bin\patch.EXE File: .\src\patch\2.5.9\patch-2.5.9-src\patch.c, Line 354 Expression: hunk ``` 2.6.1 is the oldest known version that works correctly.
2025-07-18wrap: Print deprecation warnings when using wrapdb v1Xavier Claessens
2025-06-03wrap: Lock subproject directory when downloading wrapsFlorian "sp1rit"​
To avoid raceconditions, where one instance of meson currently downloads a subproject defined in a wrapfile, while another either a. starts the download itself too b. attemts to evaluate the partially downloaded subproject wraplock introduces a lockfile, which should prevent simultaneous access of subprojects by wrap between different instances of meson.
2025-05-21wrap: Support gzip Content-Encoding when fetching WrapDB metadataBenjamin Gilbert
When fetching wrap files and releases.json, ask for gzipped data and decompress it if the server obliges. Wrap files come from GitHub releases, thus from Azure blob storage, and Azure currently doesn't compress these responses. releases.json comes from Git master, and GitHub does support compression there, reducing the response body from ~64 KiB to ~10 KiB. That's a small change in absolute terms, but straightforward to support.
2025-01-06Fix wrap.py to avoid following symlinksKaruroChori
2024-10-24cargo: Load Cargo.lock and subprojects/*.wrap while recursingXavier Claessens
In the case the main project has a .wrap file for a cargo subproject, that subproject's Cargo.lock must be loaded before we can recursively fetch all its dependencies.
2024-09-23Add Accept-Language and Accept-Encoding headers to wrap requestsWill Ayd
This makes wrap requests look more like browser requests, which is helpful in rare cases to prevent the request from being rejected
2024-07-25wrap: Use OSError instead of URLError for exception handlingNirbheek Chauhan
URLError is a subclass of OSError and intermittent server errors can manifest as OSError while reading instead of a URLError while establishing a connection, which will cause the fallback url to be ignored: ``` Looking for a fallback subproject for the dependency gudev-1.0 Downloading libgudev source from https://gitlab.gnome.org/GNOME/libgudev/-/archive/238/libgudev-238.tar.bz2 HTTP Error 404: Not Found WARNING: failed to download with error: could not get https://gitlab.gnome.org/GNOME/libgudev/-/archive/238/libgudev-238.tar.bz2 is the internet available?. Trying after a delay... HTTP Error 404: Not Found WARNING: failed to download with error: could not get https://gitlab.gnome.org/GNOME/libgudev/-/archive/238/libgudev-238.tar.bz2 is the internet available?. Trying after a delay... HTTP Error 404: Not Found WARNING: failed to download with error: could not get https://gitlab.gnome.org/GNOME/libgudev/-/archive/238/libgudev-238.tar.bz2 is the internet available?. Trying after a delay... WARNING: failed to download with error: The read operation timed out. Trying after a delay... WARNING: failed to download with error: The read operation timed out. Trying after a delay... ERROR: Unhandled python OSError. This is probably not a Meson bug, but an issue with your build environment. ```
2024-06-14cargo: Load Cargo.lockXavier Claessens
Cargo.lock is essentially identical to subprojects/*.wrap files. When a (sub)project has a Cargo.lock file this allows automatic fallback for its cargo dependencies.
2024-06-14wrap: Clarify PackageDefinition APIXavier Claessens
This will simplify creating PackageDefinition objects from Cargo.lock file. It contains basically the same information.
2024-06-07wrap: default values for netrc are empty string from python 3.11Ruben Gonzalez
From python 3.11 [1]: > The entry in the netrc file no longer needs to contain all tokens. The missing > tokens' value default to an empty string. All the tokens and their values now > can contain arbitrary characters, like whitespace and non-ASCII characters. > If the login name is anonymous, it won't trigger the security check. [1] https://github.com/python/cpython/commit/15409c720be0503131713e3d3abc1acd0da07378
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
2024-02-22wrap: remove useless set of `Resolver.directory`Dylan Baker
It's overwritten before it's ever read
2024-02-22wrap: correct return annotation of `Resolver.get_from_wrapdb()`Dylan Baker
It returns `None | PackageDefinition`, not `PackageDefinition`
2024-02-22wrap: Mark some methods of Resolver as protectedDylan Baker
These aren't meant to be called externally. Additionally, they expect some statefulness from the `resolve()` method, and by making them protected we can more easily remove this statefulness.
2024-02-12defer setting values until after we know it cannot be NoneEli Schwartz
2024-02-09wraps: Ignore whitespace when applying diff_fileNirbheek Chauhan
Fixes https://github.com/mesonbuild/meson/issues/12092
2024-02-09Revert "Wrap: Use git instead of patch by default"Nirbheek Chauhan
This reverts commit 718c86a7d577e6474ff325957248724d9b786174. We can't always use git to apply patches because they might actually apply to a git submodule inside a git subproject, and git will not be able to apply the patch in that case.
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2023-11-22wrap: Cache get_releases()Xavier Claessens
"meson wrap status" was calling it for each .wrap file. Better use lru_cache to ensure we don't make the same mistake elsewhere.
2023-11-22wraptool: Remove dead codeXavier Claessens
Update command is implemented in msubprojects.py, because it can update all wraps in parallel.
2023-11-01Add comments suggesting to keep shell completion scripts up-to-date near cmd ↵Luke Elliott
line argument code
2023-10-09interpreter: Add support for cargo subprojectXavier Claessens
2023-10-08wrap: catch failure to extract tarball and raise WrapExceptionEli Schwartz
This most likely happens when the source archive has files which take advantage of case sensitivity, and someone is unfortunate enough to have to work with broken operating systems that do not have the capacity to use modern technology, like the 1970s invention of case sensitive filesystems. For example, Windows and macOS both have retrocomputing environments, where case sensitive abilities were carefully removed from modern filesystems in order to share the delights of classical computing with the masses. On such systems, innocent tarballs fail to extract with: ``` OSError: [Errno 22] Invalid argument: 'C:\path\to\file' ``` thereby demonstrating Microsoft's unbounded and enthusiastic love for users (who are, universally, retrocomputing fans). n.b. there is, begrudgingly, a secret option for crazy people who hate retrocomputing to enable modern 1970s computing on Windows systems. Naturally, no one with any sense would ever use this, and it is rightly left in its sensible default in for example Github Actions. Fixes #12344
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-14Wrap: Use git instead of patch by defaultXavier Claessens
This solves problems with Strawberry Perl providing patch.exe on Windows with an unconsistent line ending support. Fixes: #12092
2023-09-05wrap: Use MESON_PACKAGE_CACHE_DIR as default packagecache pathXavier Claessens
Allow packagecache to contain already extracted directory to match what some distro does with Cargo source packages in /usr/share/cargo/registry. Note that there is no need to lock the cache directory because we download into a temporary name and atomically rename afterward. It means we could be downloading the same file twice, but at least integrity is guaranteed. Fixes: #12211
2023-09-05wrap: Remove duplicated codeXavier Claessens
2023-08-11treewide: automatic rewriting of all comment-style type annotationsEli Schwartz
Performed using https://github.com/ilevkivskyi/com2ann This has no actual effect on the codebase as type checkers (still) support both and negligible effect on runtime performance since __future__ annotations ameliorates that. Technically, the bytecode would be bigger for non function-local annotations, of which we have many either way. So if it doesn't really matter, why do a large-scale refactor? Simple: because people keep wanting to, but it's getting nickle-and-dimed. If we're going to do this we might as well do it consistently in one shot, using tooling that guarantees repeatability and correctness. Repeat with: ``` com2ann mesonbuild/ ```
2023-07-10wrap: detect network timeouts 20x fasterEli Schwartz
When downloading wrap content, we need to know at some point if the server is going to respond with "hello, yes, I'm here and I have data for you". The alternative is to sometimes infinitely hang. In commit 8f7781f1d6bf36c064b39e7d0794c686f1b78665 we added such a timeout, but using an extremely generously high number -- ten minutes. We don't need to wait this long just to find out if the other end exists, so decrease that time to 30 seconds, whch is still ludicrously generous but not quite as much so.
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-05-20wrap: Check for common "provides" typoXavier Claessens
It is a common mistake that is hard to find because Meson silently ignore unknown sections. Better have an explicit error message.
2023-04-29wrap: Always pass posix paths to patchNirbheek Chauhan
patch on Windows is provided by MSYS, which only understands POSIX paths, with `/`. Using Windows paths with `\` results in a "file not found" error. We got a little lucky here because the path is relative, so the drive letter difference doesn't affect us.
2023-03-27Write wrap-redirect filename as posix pathDenis Fortin
2023-02-13wrap: ensure the tempfile used for downloading is closedEli Schwartz
This is generally a good idea, and the tempfile is already instructed to not auto-delete on close. It also fixes a bug on PyPy, where the file isn't valid because it's not explicitly closed. This is probably due to the garbage collection modes -- in CPython, the object goes out of scope and gets automatically closed before we actually attempt to unpack it. Fixes #11246
2023-02-01treewide: add future annotations importEli Schwartz
2023-01-03wrap: use log once instead of hand rollingDylan Baker
2022-12-07wrap: Don't use --branch with shallow clones against HEADL. E. Segovia
Fixes #10931