aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-02-10 01:08:06 +0530
committerJussi Pakkanen <jpakkane@gmail.com>2018-02-11 13:41:06 +0200
commit15a1a317f4d8150dd9a1598f4f2f8bac6d092f66 (patch)
tree175f80eaf31ef55707824fbe51c7ce8a8c094bd4
parent70a7cf30a13a8e9f0066d72b53e7a467e2815f83 (diff)
downloadmeson-15a1a317f4d8150dd9a1598f4f2f8bac6d092f66.zip
meson-15a1a317f4d8150dd9a1598f4f2f8bac6d092f66.tar.gz
meson-15a1a317f4d8150dd9a1598f4f2f8bac6d092f66.tar.bz2
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.
-rw-r--r--mesonbuild/wrap/wrap.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py
index 26a3489..bd440a1 100644
--- a/mesonbuild/wrap/wrap.py
+++ b/mesonbuild/wrap/wrap.py
@@ -164,17 +164,20 @@ class Resolver:
if not ret:
return False
# Submodule has not been added, add it
- if out.startswith(b'-'):
+ if out.startswith(b'+'):
+ mlog.warning('submodule {} might be out of date'.format(dirname))
+ return True
+ elif out.startswith(b'U'):
+ raise RuntimeError('submodule {} has merge conflicts'.format(dirname))
+ 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):
return True
- else:
- m = 'Unknown git submodule output: {!r}'
- raise AssertionError(m.format(out))
- return True
+ m = 'Unknown git submodule output: {!r}'
+ raise RuntimeError(m.format(out))
def get_git(self, p):
checkoutdir = os.path.join(self.subdir_root, p.get('directory'))