This is an automated email from the ASF dual-hosted git repository. tvb pushed a commit to branch jonathan/mirror-client in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 277cae92c0a84fa64fc1b01022f1a8e34ace5890 Author: Jonathan Maw <[email protected]> AuthorDate: Thu Apr 12 16:28:12 2018 +0100 git.py: Improve mirror support When implementing fetching from mirrors, I encountered some problems with the git source: 1. The mirror URL was using translate_url()'s output, so if a different alias was used, then fetching from the mirror would go to a different directory, and be inaccessible. 2. After fixing that, fetching was unable to pull from a URL other than the one used at repository creation, meaning it wouldn't actually pull from the mirror. --- buildstream/plugins/sources/git.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildstream/plugins/sources/git.py b/buildstream/plugins/sources/git.py index f178656..20393d3 100644 --- a/buildstream/plugins/sources/git.py +++ b/buildstream/plugins/sources/git.py @@ -91,7 +91,7 @@ class GitMirror(): self.path = path self.url = source.translate_url(url) self.ref = ref - self.mirror = os.path.join(source.get_mirror_directory(), utils.url_directory_name(self.url)) + self.mirror = os.path.join(source.get_mirror_directory(), utils.url_directory_name(url)) # Ensures that the mirror exists def ensure(self): @@ -117,7 +117,7 @@ class GitMirror(): .format(self.source, self.url, tmpdir, self.mirror)) from e def fetch(self): - self.source.call([self.source.host_git, 'fetch', 'origin', '--prune'], + self.source.call([self.source.host_git, 'fetch', self.url, '--prune'], fail="Failed to fetch from remote git repository: {}".format(self.url), cwd=self.mirror)
