summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-02-19 17:22:52 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-02-19 17:22:52 +0530
commit0de94742ff0f3ae0a26cc62ff4161cd1ff3c78da (patch)
treeb03d058ae0da25f81951f004339765872fa9952b
parent55a7c265c11e0f3e8a94cf9f4fd0b5f036a717d2 (diff)
downloadmeson-nirbheek/fix-wrap-submodule-logic.tar.gz
wrap: Fix broken logic when initializing submodulesnirbheek/fix-wrap-submodule-logic
Also be more lenient when doing git checkout, and continue even if it failed. Closes https://github.com/mesonbuild/meson/issues/3088
-rw-r--r--mesonbuild/wrap/wrap.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py
index bd440a135..54a928e25 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))