Commit Graph

79 Commits

Author SHA1 Message Date
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
Xavier Claessens 1889e33389 wrap: Remove dead code trying to update git/hg/svn repositories
If the directory exists we early return or raise exception in resolve()
method. It was already like that even before the recent refactoring of
the code.

It is safer like that anyway, we don't want a project reconfigure to
silently pull new code. Updating subprojects should be an explicit
action of the user. For example gst-build has a 'git-update' script that
does that. In the future we could add a 'meson subprojects update'
command.
2018-10-18 11:42:17 -04:00
Xavier Claessens d6fba7f01c wrap: Allow source and patch to be local files
It is sometimes important to be able to build projects offline, in that
case subproject tarballs and patches could be shipped directly within
the project's repository.
2018-10-17 21:56:49 -04:00
Xavier Claessens a3db9f6ae3 wrap: Some cleanups and fixes in resolver
- Use CongifParser instead of parsing ourself, this will give more
  flexibility in the future.

- Always read the .wrap file first, because if it contains the
  'directory' key we should use that value instead of packagename for
  the path where do download/lookup for the subproject.

- If we download the subproject (git/submodule/tarball/etc) we should
  still check it contains a meson.build file.
2018-10-17 21:56:49 -04:00
Andrei Alexeyev 67cc636e53 Add 'clone-recursive' option for git wraps
This causes Meson to clone the repo with the --recursive flag, pulling
all of the submodules automatically.
2018-09-16 14:57:56 +03:00
Nirbheek Chauhan e7b25018c4 wrap: Redirect git's stdin to DEVNULL
Otherwise, git fiddles with the cmd.exe console's color behaviour and
disables it, which causes it to stop interpreting ANSI color codes
outputted by meson for colored output.

Effectively, as soon as any subproject is initialized, cmd.exe goes
nice coloured output to ugly raw ANSI codes.
2018-09-03 21:12:09 +03:00
Andrei Antonov 8f7781f1d6 using urlopen() with explicit timeout 2018-08-27 00:55:45 +03:00
Mohammed Amer Khalidi 376cdd7054 Adding support to checkout from reviews in git/gerrit using commit ids. 2018-08-07 18:55:46 +03:00
Nirbheek Chauhan 0ec18a0531 wrap: Fix broken logic when initializing submodules
Also be more lenient when doing git checkout, and continue even if it
failed.

Closes https://github.com/mesonbuild/meson/issues/3088
2018-02-20 00:16:38 +02:00
Nirbheek Chauhan 15a1a317f4 wrap: Handle more submodule status cases
The '+' and 'U' cases should not happen normally because we don't run
any git commands if the subproject directory exists and contains
a meson build file. However, if the user accidentally messed up the
subproject checkout to a version that had no build files, we would
error out with an assertion.
2018-02-11 13:41:06 +02:00
Jussi Pakkanen 7d49d1d2d7 Merge pull request #2373 from leiflm/svn-wraps
introduce svn wrap support
2017-10-01 01:21:12 +03:00
Leif Middelschulte a90e47bd4f adds missing import of `Popen_safe` 2017-09-30 19:49:14 +02:00
Leif Middelschulte 078527a744 As per jpakkane's suggestion use `Popen_safe` instead of `subprocess.getoutput`
Jussi suggested to use `Popen_safe` from meson's library for portability reasons.
2017-09-30 19:45:24 +02:00
liugang c93bce7839 Don't download patch archive if already download
the behavior of download patch should
keep same as download package.
2017-09-29 21:43:28 +03:00
Leif Middelschulte 50376cca37 fixup 993a12c5: use right variable 2017-09-26 14:03:07 +02:00
Leif Middelschulte 993a12c543 avoid errornous type conversion. Compare strings instead 2017-09-26 14:01:29 +02:00
Leif Middelschulte fab15d433a fixes offline working (if desired revision is already present). 2017-09-26 13:56:58 +02:00
Leif Middelschulte aa28675ebc fixes initial checkout command independend of provided revision 2017-09-26 13:13:46 +02:00
Leif Middelschulte 667d5d2d9f introduce svn wrap support 2017-09-25 22:26:42 +02:00
liugang a93ac1a6a8 Improve download package
Using wrap mechanism in enterprise environment,
Some package is very large, example, sdk package from
BSP vendor.

so:
- open file in the output directory with a temporary name
- download a chunk, update hash calculation, write chunk to file
- when finished close file and check the hash
- if hash is incorrect, delete temp file and raise error
- if hash is correct, atomically rename temp file to final file

fix issue: #2358
2017-09-23 16:01:11 +08:00
liugang de259b6690 Fix unpack patch archive fail
fix shutil.unpack_archive() failure when the
destination files already exists and is read-only.

Example: all files in opensource package live555
is `-r--r--r--`, if some file in patch archive try to
patch original files of live555, shutil.unpack_archive
will raise `[Errno 13] Permission denied`
2017-09-23 15:59:43 +08:00
liugang 7060b15773 fix patch archive never download on some case
Fix issue #2359
2017-09-23 13:53:27 +08:00
Luke Shumaker 4dbbb4884c flake8: Clean up complained-about unused imports
This also adds a "# noqa: F401" comment on an unused "import lzma",
which we are using it in a try/except block that is being used to
check if the lzma module is importable; of course it is unused.

v2: This turned out to be a little tricky.

    mesonbuild/modules/__init__.py had the "unused" import:

        from ..interpreterbase import permittedKwargs, noKwargs

    However, that meant that the various modules could do things like:

        from . import noKwargs # "." is "mesonbuild.modules"

    Which breaks when you remove __init__.py's "unused" import.  I
    could have tagged that import with "# noqa: F401", but instead I
    chose to have each of the module import directly from
    "..interpreterbase" instead of ".".
2017-09-21 13:41:03 -04:00
Alistair Thomas a195b78c8d Whitespace tweaks to reduce Flake8 warnings 2017-05-29 19:32:47 +03:00
Goncalo Carvalho c9c3070f53 fix typo 2017-05-26 23:21:48 +03:00