diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-02-19 17:22:52 +0530 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-02-20 00:16:38 +0200 |
commit | 0ec18a0531ba9fc64f3149be3f967a7b5beb2169 (patch) | |
tree | 86650415a1f6b6814cf3e07cd303f282f638b356 /mesonbuild/wrap/wrap.py | |
parent | 15358ecc9ff751981e1e13abbce8941bc99d5135 (diff) | |
download | meson-0ec18a0531ba9fc64f3149be3f967a7b5beb2169.zip meson-0ec18a0531ba9fc64f3149be3f967a7b5beb2169.tar.gz meson-0ec18a0531ba9fc64f3149be3f967a7b5beb2169.tar.bz2 |
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
Diffstat (limited to 'mesonbuild/wrap/wrap.py')
-rw-r--r-- | mesonbuild/wrap/wrap.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index bd440a1..54a928e 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -165,17 +165,21 @@ class Resolver: return False # Submodule has not been added, add it if out.startswith(b'+'): - mlog.warning('submodule {} might be out of date'.format(dirname)) + mlog.warning('git submodule {} might be out of date'.format(dirname)) return True elif out.startswith(b'U'): raise RuntimeError('submodule {} has merge conflicts'.format(dirname)) + # Submodule exists, but is deinitialized or wasn't initialized elif out.startswith(b'-'): - if subprocess.call(['git', '-C', self.subdir_root, 'submodule', 'update', '--init', dirname]) != 0: - return False - # Submodule was added already, but it wasn't populated. Do a checkout. - elif out.startswith(b' '): - if subprocess.call(['git', 'checkout', '.'], cwd=dirname): + if subprocess.call(['git', '-C', self.subdir_root, 'submodule', 'update', '--init', dirname]) == 0: return True + raise RuntimeError('Failed to git submodule init {!r}'.format(dirname)) + # Submodule looks fine, but maybe it wasn't populated properly. Do a checkout. + elif out.startswith(b' '): + subprocess.call(['git', 'checkout', '.'], cwd=dirname) + # Even if checkout failed, try building it anyway and let the user + # handle any problems manually. + return True m = 'Unknown git submodule output: {!r}' raise RuntimeError(m.format(out)) |