Commit Graph

103 Commits

Author SHA1 Message Date
Xavier Claessens 2353d67c25 wrap: Raise MesonException when git command fails
This avoid printing long backtrace by default, the user already has the
output of the git command printed for debugging purpose since we don't
redirect stdout/stderr.
2020-07-14 20:49:47 +03:00
Xavier Claessens e1094df77e wrap: Add back filename member in PackageDefinition
It is still used by msubprojects.py and cause issues when updating
wrapdb.
2020-07-04 13:58:36 +03:00
Xavier Claessens 41aefd2145 wrap: Abort if multiple wraps provide the same dep or program 2020-07-01 09:51:57 -04:00
Xavier Claessens 13316f99fe wrap: Refactor to split wraps dictionary into 3 separate dicts
It makes the code cleaner to have 3 separate dictionaries for
packagename, dependency and programs.
2020-07-01 09:51:57 -04:00
Xavier Claessens fba796cf13 Fix typo: coma->comma 2020-07-01 09:51:57 -04:00
Xavier Claessens f08eed37cb find_program: Fallback if a wrap file provide the program name
We don't need the legacy variable name system as for dependency()
fallbacks because meson.override_find_program() is largely used already,
so we can just rely on it.
2020-07-01 09:51:57 -04:00
Xavier Claessens 71804e56eb wrap: Add special 'dependency_names' key in [provide] section
The value for that key must be a coma separated list of dependecy names
provided by that subproject, when no variable name is needed because the
subproject uses override_dependency().
2020-07-01 09:51:57 -04:00
Xavier Claessens 2a7f72885f wrap: Add 'provide' section 2020-07-01 09:51:44 -04:00
Xavier Claessens 4a371c97f4 wrap: Apply patch even in VCS cases 2020-06-30 19:42:43 +03:00
Eli Schwartz 33167d40a2 wrap: add user agent when downloading files
This lets servers know when they're being used by meson. It also avoids
issues where the Independent JPEG Group decided to ban the
"Python-urllib" default user agent.

Fixes https://github.com/mesonbuild/libjpeg/issues/9
2020-06-26 16:07:29 -04:00
Xavier Claessens e353b2e8d4 wrap: Add patch_directory support
Copy a tree instead of extracting an archive.

Closes: #7216
2020-06-21 23:39:12 +03:00
Daniel Mensinger ccdf7f6d34
wrap: Add support for local files via only `*_filename` 2020-04-25 11:43:42 +02:00
Xavier Claessens a6239d5100 wrap: Add fallback urls
It can happen that a server is temporaly down, tarballs often have
many mirrors available so we should be able to add at least one fallback
mirror in wrap files.
2020-04-13 13:29:33 +03:00
Xavier Claessens 5c8dbdcd38 wrap: Fix git clone with commit id in revision
Fixes: #6505.
2020-01-25 13:49:00 +05:30
Nirbheek Chauhan 712b2f08c7 Move git helper out into mesonlib for reuse
Reuse the git helper for `meson wrap` and `meson subprojects` so we
don't need to maintain the same git-colors-on-windows workarounds in
multiple places.
2020-01-22 17:29:38 -05:00
Nirbheek Chauhan 06dddf2ef0 wrap: Re-set the console mode after calling git
`git submodule update --recursive` calls git clone recursively, and on
Windows it will undo the console mode we set in mlog and cause ANSI
colors to stop working. We could set it again only when we call that,
but we will definitely miss other instances where this could happen
in the future and regress.
2020-01-22 17:29:38 -05:00
Nirbheek Chauhan e962147d8a wrap: Redirect stdin to DEVNULL when calling git
Without this git messes up the console and ANSI colors stop working on
Windows inside cmd.exe.

This broke in https://github.com/mesonbuild/meson/pull/6139. Also add
the same to all git calls. Missed this when I opened
https://github.com/mesonbuild/meson/pull/6255
2020-01-22 17:29:38 -05:00
Nirbheek Chauhan f09056f903 wrap: Always use a wrapper for running git
We need this for the next commit.
2020-01-22 17:29:38 -05:00
Nirbheek Chauhan 7065cef62f wrap: Look for git only once at startup
No need to repeatedly call `shutil.which`.
2020-01-22 17:29:38 -05:00
Nirbheek Chauhan 2661b1bfb5 wrap: Use uppercase for global constants
This makes things much clearer and follows PEP8.
2020-01-22 17:29:38 -05:00
Xavier Claessens 711969c3b5 wrap: Fix support of file:// URLs
Fixes: #6445
2020-01-17 11:36:37 -05:00
Daniel Mensinger 09b53c534f types: import typing as T (fixes #6333) 2020-01-08 15:28:17 +01:00
Xavier Claessens 5031f4981d dist: Fix --include-subprojects when .wrap file has directory value 2019-12-10 22:19:00 +02:00
Michael Brockus 4b69aea85d Update Python2 syntax to Python3 syntax in Wrap 2019-12-06 15:23:26 +02:00
Michael Hirsch, Ph.D d9b8dce975
wrap: check whitelist subdomain
wrap: add imposter URL test

this test shows that meson wrap subsystem historically allows
imposter URLs like https://wrapdb.mesonwrap.com.evil/v1/foo.zip
while the new code does no.
2019-12-05 23:14:13 -05:00
Michael Hirsch, Ph.D dc19768175
wrap: raise WrapException instead of Python exception when program not available 2019-12-05 23:07:18 -05:00
Michael Hirsch, Ph.D ccefc00a59
use WrapDB domain whitelist, don't fallback to non-SSL when SSL available
In my opinion, we should not fall back to http:// from the SSL HSTS WrapDB URL,
**for systems that have Python SSL** as that is controverting the point
of HSTS + SSL.

For systems that do not have Python SSL, they continue to work with a
colored mlog.warning instead of only a stderr console print.

 attempt to stop masquerade URLS containing wrapdb.mesonbuild.com.evil.stuff.com
2019-12-05 23:07:16 -05:00
Michael Hirsch, Ph.D 298299d711
doc: py35 deprecation comments 2019-12-05 22:19:28 -05:00
Daniel Mensinger e21f5959a5 lgtm: Fix insecure SSL/TLS version by removing dead code 2019-12-05 11:08:12 -05:00
Daniel Mensinger ef19e1ff2d lgtm: fix Incomplete URL substring sanitization 2019-12-05 00:22:10 +02:00
Martin Hostettler bb03cf0dbc wrap: Resolver.get_git: Factor out --depth argument generation and make sure not to pass None as parameter
507cf47507cf47 broke the combination of clone-recursive without depth.
Because it passed depth (as None) to git.

To fix this the depth option is now generated once as a list when depth is set
and else set to an empty list and unpacked into the argument this when
needed. This reduces duplication and allows code to work the same for
both cases.
2019-11-28 13:01:33 +02:00
Michael Hirsch, Ph.D d080917561 wrap.py: catch connection error with WrapException
fixes #6130

wrap: more error verbosity
2019-11-07 22:14:59 +02:00
Michael Hirsch, Ph.D a47c1374b9 wrap.py: apply type annotation, modernize syntax
correct syntax issues, missing imports revealed by type annotation checking
2019-11-07 22:14:59 +02:00
Martin Hostettler 507cf47941 wrap: Rework `depth` support for git.
Don't manually emulate a partial `git clone` when `depth` option is not
used. This keeps `git describe` working as before and generally supports
workflows that depend on tags and branches to exist in a wrap downloaded
subproject.

This also fixes downloading via git not working at all on CentOS 7
(git version 1.8.3.1).

For the `depth` case use `git clone --branch=... --depth=...` when
possible and only fall back to manual emulation wraps that specify a
full commit id, because for some reason that does not work with the
clone based workflow.

Fixes: #5991 (Regression in wrap support with git)
2019-10-06 14:29:32 +03:00
Christoph Weiss 0008b326ff Add support for `depth` option in wrap-git
This allows cloning subprojects shallowly.  It works recursively for a
subproject's submodules in case `clone-recursive` is set to `true`.
2019-09-29 20:47:59 +03:00
Nirbheek Chauhan 9c2724bce5 Add optional progress bar when generating build.ninja 2019-07-20 17:02:15 +03:00
Daniel Mensinger e02c101575
cmake: moved subprojects into the CMake module 2019-06-06 18:27:05 +02:00
Daniel Mensinger a9a3b3ffe6
Added method kwarg to subproject 2019-06-06 18:22:26 +02:00
Daniel Mensinger 3581839f4c
Fix unused variables warnings 2019-04-29 12:22:50 +02:00
Daniel Mensinger bf98ffca9e
Fix blind exceptions 2019-04-29 12:16:06 +02:00
Andrei Alexeyev faf3581df6 Fix git wraps with submodules
* If clone-recursive is specified, populate submodules only after
    the specified revision/branch has been checked out. Fixes #4996

    * Update submodules recursively on `meson subprojects update`
2019-03-11 20:31:52 +02:00
Michael Hirsch, Ph.D da34bea893 pep8 py37 2019-01-29 22:06:11 +02:00
Xavier Claessens 60b58e056f Add 'meson subprojects update' command
This is inspired by gst-build's git-update script.
2018-12-02 08:37:32 -05:00
Elliott Sales de Andrade e58f186121 Fix subproject initialization without git installed. 2018-11-22 22:31:54 +02:00
Xavier Claessens be09acbf56 wrap: Check the directory key is a name and not a path
Closes #1413.
2018-10-27 16:36:01 +03:00
Xavier Claessens adb9fdef3a wrap: Fix crash with file based wraps
Add unit test to avoid regressions in the future.
2018-10-21 23:21:36 +03:00
Xavier Claessens 76ac4f5689 wrap: Make 'directory' key optional
wrap files can now omit the 'directory' key, in that case it will
default to the packagename.
2018-10-18 18:36:32 -04:00
Xavier Claessens d9ea7b16a8 wrap: Rename p to self.wrap 2018-10-18 18:29:35 -04:00
Xavier Claessens b26eb3d384 wrap: Disable interpolation 2018-10-18 18:25:05 -04:00
Xavier Claessens 3f98ad8eed wrap: Improve error handling and logging 2018-10-18 11:42:17 -04:00