diff options
author | Paul Barker <pbarker@konsulko.com> | 2020-06-03 20:31:16 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-06-04 13:28:16 +0100 |
commit | 1251765fff1c12d943091a2981b347e721b93e4e (patch) | |
tree | cbef15da992e57589c5be19167f33c05fe339c8f /bitbake/lib/bb/fetch2/gitsm.py | |
parent | d64809679436e9338555ef4e75ea6def93fc09c3 (diff) | |
download | poky-1251765fff1c12d943091a2981b347e721b93e4e.tar.gz |
bitbake: fetch2: Add the ability to list expanded URL data
Some fetchers may download additional sources along with those
explicitly listed in SRC_URI. These "implicit URLs" will be needed by
the archiver to ensure that all sources can be archived.
We can't just return a list of URL strings since each URL may need its
own SRCREV data so we return a list of FetchData objects.
Each fetcher can override the implicit_urldata() function to provide the
additional FetchData objects. For now this is just needed in the gitsm
fetcher to walk git submodules recursively.
(Bitbake rev: 1350f241b7d991bd191ce9e44f6662e4376c6e24)
Signed-off-by: Paul Barker <pbarker@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/gitsm.py')
-rw-r--r-- | bitbake/lib/bb/fetch2/gitsm.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/bitbake/lib/bb/fetch2/gitsm.py b/bitbake/lib/bb/fetch2/gitsm.py index e7083001da..56bd5f0480 100644 --- a/bitbake/lib/bb/fetch2/gitsm.py +++ b/bitbake/lib/bb/fetch2/gitsm.py | |||
@@ -223,3 +223,24 @@ class GitSM(Git): | |||
223 | # up the configuration and checks out the files. The main project config should remain | 223 | # up the configuration and checks out the files. The main project config should remain |
224 | # unmodified, and no download from the internet should occur. | 224 | # unmodified, and no download from the internet should occur. |
225 | runfetchcmd("%s submodule update --recursive --no-fetch" % (ud.basecmd), d, quiet=True, workdir=ud.destdir) | 225 | runfetchcmd("%s submodule update --recursive --no-fetch" % (ud.basecmd), d, quiet=True, workdir=ud.destdir) |
226 | |||
227 | def implicit_urldata(self, ud, d): | ||
228 | import shutil, subprocess, tempfile | ||
229 | |||
230 | urldata = [] | ||
231 | def add_submodule(ud, url, module, modpath, workdir, d): | ||
232 | url += ";bareclone=1;nobranch=1" | ||
233 | newfetch = Fetch([url], d, cache=False) | ||
234 | urldata.extend(newfetch.expanded_urldata()) | ||
235 | |||
236 | # If we're using a shallow mirror tarball it needs to be unpacked | ||
237 | # temporarily so that we can examine the .gitmodules file | ||
238 | if ud.shallow and os.path.exists(ud.fullshallow) and ud.method.need_update(ud, d): | ||
239 | tmpdir = tempfile.mkdtemp(dir=d.getVar("DL_DIR")) | ||
240 | subprocess.check_call("tar -xzf %s" % ud.fullshallow, cwd=tmpdir, shell=True) | ||
241 | self.process_submodules(ud, tmpdir, add_submodule, d) | ||
242 | shutil.rmtree(tmpdir) | ||
243 | else: | ||
244 | self.process_submodules(ud, ud.clonedir, add_submodule, d) | ||
245 | |||
246 | return urldata | ||