diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2019-03-12 18:46:25 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-03-24 16:42:22 +0000 |
commit | 5de832c54f8f7eda0706cc6f51c8a6d7804856a2 (patch) | |
tree | ef785fe02f4d143d51bb17d402aa656015f2ece4 | |
parent | e97607a51e74f96d06fdf6de4a1af55ac475d274 (diff) | |
download | poky-5de832c54f8f7eda0706cc6f51c8a6d7804856a2.tar.gz |
bitbake: gitsm.py: Fix relative URLs
Prior code happened to work with relative URLs, when the code was recently
restructured it caused all relative urls to no longer work. Restore the prior
code flow for relative support and better comment why that code is there.
(Bitbake rev: 39afa6ead1d72813b2a294f065d759bad08fb53d)
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 14bb383af0ca98e0e04ec217e537b6a899f3658e)
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Signed-off-by: Armin Kuster <akuster@mvista.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/fetch2/gitsm.py | 11 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 4 |
2 files changed, 8 insertions, 7 deletions
diff --git a/bitbake/lib/bb/fetch2/gitsm.py b/bitbake/lib/bb/fetch2/gitsm.py index 86198ee6cd..faffb4c77e 100644 --- a/bitbake/lib/bb/fetch2/gitsm.py +++ b/bitbake/lib/bb/fetch2/gitsm.py | |||
@@ -98,6 +98,12 @@ class GitSM(Git): | |||
98 | uris[m] = md['url'] | 98 | uris[m] = md['url'] |
99 | subrevision[m] = module_hash.split()[2] | 99 | subrevision[m] = module_hash.split()[2] |
100 | 100 | ||
101 | # Convert relative to absolute uri based on parent uri | ||
102 | if uris[m].startswith('..'): | ||
103 | newud = copy.copy(ud) | ||
104 | newud.path = os.path.realpath(os.path.join(newud.path, uris[m])) | ||
105 | uris[m] = Git._get_repo_url(self, newud) | ||
106 | |||
101 | for module in submodules: | 107 | for module in submodules: |
102 | # Translate the module url into a SRC_URI | 108 | # Translate the module url into a SRC_URI |
103 | 109 | ||
@@ -120,11 +126,6 @@ class GitSM(Git): | |||
120 | # This has to be a file reference | 126 | # This has to be a file reference |
121 | proto = "file" | 127 | proto = "file" |
122 | url = "gitsm://" + uris[module] | 128 | url = "gitsm://" + uris[module] |
123 | if uris[module].startswith('..'): | ||
124 | # Local on disk relative reference | ||
125 | newud = copy.copy(ud) | ||
126 | newud.path = os.path.realpath(os.path.join(newud.path, md['url'])) | ||
127 | url = "gitsm://" + Git._get_repo_url(self, newud) | ||
128 | 129 | ||
129 | url += ';protocol=%s' % proto | 130 | url += ';protocol=%s' % proto |
130 | url += ";name=%s" % module | 131 | url += ";name=%s" % module |
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 1497a3cff7..de3b0ce7bb 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -894,9 +894,9 @@ class FetcherNetworkTest(FetcherTest): | |||
894 | @skipIfNoNetwork() | 894 | @skipIfNoNetwork() |
895 | def test_git_submodule(self): | 895 | def test_git_submodule(self): |
896 | # URL with ssh submodules | 896 | # URL with ssh submodules |
897 | url = "gitsm://git.yoctoproject.org/git-submodule-test;branch=ssh-gitsm-tests;rev=f53765f515e0eeca569ed385bb1c89ce008bb058" | 897 | url = "gitsm://git.yoctoproject.org/git-submodule-test;branch=ssh-gitsm-tests;rev=049da4a6cb198d7c0302e9e8b243a1443cb809a7" |
898 | # Original URL (comment this if you have ssh access to git.yoctoproject.org) | 898 | # Original URL (comment this if you have ssh access to git.yoctoproject.org) |
899 | url = "gitsm://git.yoctoproject.org/git-submodule-test;branch=master;rev=132fea6e4dee56b61bcf5721c94e8b2445c6a017" | 899 | url = "gitsm://git.yoctoproject.org/git-submodule-test;branch=master;rev=a2885dd7d25380d23627e7544b7bbb55014b16ee" |
900 | fetcher = bb.fetch.Fetch([url], self.d) | 900 | fetcher = bb.fetch.Fetch([url], self.d) |
901 | fetcher.download() | 901 | fetcher.download() |
902 | # Previous cwd has been deleted | 902 | # Previous cwd has been deleted |