diff options
author | Ross Burton <ross@burtonini.com> | 2021-10-05 15:50:01 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-08 16:45:05 +0100 |
commit | c3b3d7c14f92814112ec3e193d376f1e206ce0db (patch) | |
tree | 91f27b03bd5126210e79f92b55ace2c2546a168a | |
parent | 07996f492b1f77a94f855b17c7846496350b258a (diff) | |
download | poky-c3b3d7c14f92814112ec3e193d376f1e206ce0db.tar.gz |
bitbake: fetch2/gitsm: remove the 'nugget' SRCREV caching
The cached revisions which are used to decide if a repository doesn't
need to be updated are misleading when used in conjunction with mirror
tarballs and can cause partial fetches to happen, resulting in unpack
errors as repositories were not fetched.
A concrete example: edk2-firmware in meta-arm is at version 202102
(ef91b0). This is built on the autobuilder so the source mirror contains
the repository as a mirror tarball. If I build edk2-firmware 202102 the
gitsm fetcher will initially download the top-level repository and then
iterate into the submodules to also fetch those repositories, including
cmocka from cryptomilk.org. edk2-firmware will then unpack and build
successfully.
I then update edk2-firmware to 202105 (e1999b) and build it.
Gitsm.needs_update() starts by calling Git.needs_update() which returns
False, as the mirror tarball contains this revision. It then looks at
the "nuggets" which are SRCREVs it has fetched before. The mirror
tarball itself contains the nugget for e1999b as this has been built on
the autobuilder, so needs_update return False, no more fetching is done,
and the build proceeds to unpack.
However, as part of the 202105 upgrade the URL of the cmocka submodule
changed, and this new repository was never fetched. This means that
unpack fails as one of the required git repositories isn't available.
The nugget codepaths appear to be an attempt at optimising the fetch
process, but have demonstratable failure cases. Just removing them
entirely solves the edk2-firmware example, and all of the fetcher test
cases still pass.
(Bitbake rev: 51212507ce3f670ace9efb691c92887d66f7aaf8)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/fetch2/gitsm.py | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/bitbake/lib/bb/fetch2/gitsm.py b/bitbake/lib/bb/fetch2/gitsm.py index a4527bf364..a7110a988d 100644 --- a/bitbake/lib/bb/fetch2/gitsm.py +++ b/bitbake/lib/bb/fetch2/gitsm.py | |||
@@ -140,16 +140,6 @@ class GitSM(Git): | |||
140 | if Git.need_update(self, ud, d): | 140 | if Git.need_update(self, ud, d): |
141 | return True | 141 | return True |
142 | 142 | ||
143 | try: | ||
144 | # Check for the nugget dropped by the download operation | ||
145 | known_srcrevs = runfetchcmd("%s config --get-all bitbake.srcrev" % \ | ||
146 | (ud.basecmd), d, workdir=ud.clonedir) | ||
147 | |||
148 | if ud.revisions[ud.names[0]] in known_srcrevs.split(): | ||
149 | return False | ||
150 | except bb.fetch2.FetchError: | ||
151 | pass | ||
152 | |||
153 | need_update_list = [] | 143 | need_update_list = [] |
154 | def need_update_submodule(ud, url, module, modpath, workdir, d): | 144 | def need_update_submodule(ud, url, module, modpath, workdir, d): |
155 | url += ";bareclone=1;nobranch=1" | 145 | url += ";bareclone=1;nobranch=1" |
@@ -172,11 +162,6 @@ class GitSM(Git): | |||
172 | shutil.rmtree(tmpdir) | 162 | shutil.rmtree(tmpdir) |
173 | else: | 163 | else: |
174 | self.process_submodules(ud, ud.clonedir, need_update_submodule, d) | 164 | self.process_submodules(ud, ud.clonedir, need_update_submodule, d) |
175 | if len(need_update_list) == 0: | ||
176 | # We already have the required commits of all submodules. Drop | ||
177 | # a nugget so we don't need to check again. | ||
178 | runfetchcmd("%s config --add bitbake.srcrev %s" % \ | ||
179 | (ud.basecmd, ud.revisions[ud.names[0]]), d, workdir=ud.clonedir) | ||
180 | 165 | ||
181 | if len(need_update_list) > 0: | 166 | if len(need_update_list) > 0: |
182 | logger.debug('gitsm: Submodules requiring update: %s' % (' '.join(need_update_list))) | 167 | logger.debug('gitsm: Submodules requiring update: %s' % (' '.join(need_update_list))) |
@@ -209,9 +194,6 @@ class GitSM(Git): | |||
209 | shutil.rmtree(tmpdir) | 194 | shutil.rmtree(tmpdir) |
210 | else: | 195 | else: |
211 | self.process_submodules(ud, ud.clonedir, download_submodule, d) | 196 | self.process_submodules(ud, ud.clonedir, download_submodule, d) |
212 | # Drop a nugget for the srcrev we've fetched (used by need_update) | ||
213 | runfetchcmd("%s config --add bitbake.srcrev %s" % \ | ||
214 | (ud.basecmd, ud.revisions[ud.names[0]]), d, workdir=ud.clonedir) | ||
215 | 197 | ||
216 | def unpack(self, ud, destdir, d): | 198 | def unpack(self, ud, destdir, d): |
217 | def unpack_submodules(ud, url, module, modpath, workdir, d): | 199 | def unpack_submodules(ud, url, module, modpath, workdir, d): |