diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2022-10-12 20:02:42 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2022-10-21 17:35:26 +0300 |
commit | 7737398cd3b51e03afc8523ec6f0c8459ea6bf04 (patch) | |
tree | fb33fd51ece94c3d665feec13a14db430a8247e2 | |
parent | 2761131ff94489842da3988792c4c2b0d25a850c (diff) | |
download | meson-7737398cd3b51e03afc8523ec6f0c8459ea6bf04.zip meson-7737398cd3b51e03afc8523ec6f0c8459ea6bf04.tar.gz meson-7737398cd3b51e03afc8523ec6f0c8459ea6bf04.tar.bz2 |
msubprojects: Fix issues when updating all wraps
When updating all wraps, it is not an error if some have not been
downloaded or some does not have a wrap file.
-rwxr-xr-x | mesonbuild/msubprojects.py | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/mesonbuild/msubprojects.py b/mesonbuild/msubprojects.py index 247690a..d6c182a 100755 --- a/mesonbuild/msubprojects.py +++ b/mesonbuild/msubprojects.py @@ -180,15 +180,7 @@ class Runner: def update_file(self) -> bool: options = T.cast('UpdateArguments', self.options) - - if not os.path.isdir(self.repo_dir): - # The subproject is not needed, or it is a tarball extracted in - # 'libfoo-1.0' directory and the version has been bumped and the new - # directory is 'libfoo-2.0'. In that case forcing a meson - # reconfigure will download and use the new tarball. - self.log(' -> Not used.') - return True - elif options.reset: + if options.reset: # Delete existing directory and redownload. It is possible that nothing # changed but we have no way to know. Hopefully tarballs are still # cached. @@ -287,10 +279,6 @@ class Runner: def update_git(self) -> bool: options = T.cast('UpdateArguments', self.options) - - if not os.path.isdir(self.repo_dir): - self.log(' -> Not used.') - return True if not os.path.exists(os.path.join(self.repo_dir, '.git')): if options.reset: # Delete existing directory and redownload @@ -395,9 +383,6 @@ class Runner: self.git_show() def update_hg(self) -> bool: - if not os.path.isdir(self.repo_dir): - self.log(' -> Not used.') - return True revno = self.wrap.get('revision') if revno.lower() == 'tip': # Failure to do pull is not a fatal error, @@ -411,9 +396,6 @@ class Runner: return True def update_svn(self) -> bool: - if not os.path.isdir(self.repo_dir): - self.log(' -> Not used.') - return True revno = self.wrap.get('revision') _, out, _ = Popen_safe(['svn', 'info', '--show-item', 'revision', self.repo_dir]) current_revno = out @@ -431,7 +413,11 @@ class Runner: def update(self) -> bool: self.log(f'Updating {self.wrap.name}...') success = False - if self.wrap.type == 'file': + if not os.path.isdir(self.repo_dir): + self.log(' -> Not used.') + # It is not an error if we are updating all subprojects. + success = not self.options.subprojects + elif self.wrap.type == 'file': success = self.update_file() elif self.wrap.type == 'git': success = self.update_git() @@ -441,10 +427,12 @@ class Runner: success = self.update_svn() elif self.wrap.type is None: self.log(' -> Cannot update subproject with no wrap file') + # It is not an error if we are updating all subprojects. + success = not self.options.subprojects else: self.log(' -> Cannot update', self.wrap.type, 'subproject') - if success: - self.wrap.update_hash_cache(self.wrap_resolver.dirname) + if success and os.path.isdir(self.repo_dir): + self.wrap.update_hash_cache(self.repo_dir) return success def checkout(self) -> bool: |