summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/git.py
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2015-09-15 13:56:06 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-18 09:05:36 +0100
commit3a5e46b6ed483e43251da7e328b9299189997722 (patch)
tree579532935bca4c0c6765a21e294f7c59fb7a1591 /bitbake/lib/bb/fetch2/git.py
parent441f04ce97d12fd6b5f6cad9e23afe7080939092 (diff)
downloadpoky-3a5e46b6ed483e43251da7e328b9299189997722.tar.gz
bitbake: bb.fetch2.{git, hg}: remove tarball if it needs updating
We were maintaining state in the form of ud.repochanged to determine whether we need to write the tarball in the case where the tarball already exists, but this state is maintained only in memory. If we need to update the git repo, set ud.repochanged to True, and then are interrupted or killed, the tarball will then be out of date. Rather than maintaining this state, simply remove the out of date tarball when we update the git repo, and it will be re-created with updated content in build_mirror_data. [YOCTO #6366] (Bitbake rev: eaaa81393f181432c8586b17ade623f42c9fed2e) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/git.py')
-rw-r--r--bitbake/lib/bb/fetch2/git.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 40658ff94c..4a32a31e40 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -181,8 +181,6 @@ class Git(FetchMethod):
181 def download(self, ud, d): 181 def download(self, ud, d):
182 """Fetch url""" 182 """Fetch url"""
183 183
184 ud.repochanged = not os.path.exists(ud.fullmirror)
185
186 # If the checkout doesn't exist and the mirror tarball does, extract it 184 # If the checkout doesn't exist and the mirror tarball does, extract it
187 if not os.path.exists(ud.clonedir) and os.path.exists(ud.fullmirror): 185 if not os.path.exists(ud.clonedir) and os.path.exists(ud.fullmirror):
188 bb.utils.mkdirhier(ud.clonedir) 186 bb.utils.mkdirhier(ud.clonedir)
@@ -220,7 +218,11 @@ class Git(FetchMethod):
220 runfetchcmd(fetch_cmd, d) 218 runfetchcmd(fetch_cmd, d)
221 runfetchcmd("%s prune-packed" % ud.basecmd, d) 219 runfetchcmd("%s prune-packed" % ud.basecmd, d)
222 runfetchcmd("%s pack-redundant --all | xargs -r rm" % ud.basecmd, d) 220 runfetchcmd("%s pack-redundant --all | xargs -r rm" % ud.basecmd, d)
223 ud.repochanged = True 221 try:
222 os.unlink(ud.fullmirror)
223 except OSError as exc:
224 if exc.errno != errno.ENOENT:
225 raise
224 os.chdir(ud.clonedir) 226 os.chdir(ud.clonedir)
225 for name in ud.names: 227 for name in ud.names:
226 if not self._contains_ref(ud, d, name): 228 if not self._contains_ref(ud, d, name):
@@ -228,7 +230,7 @@ class Git(FetchMethod):
228 230
229 def build_mirror_data(self, ud, d): 231 def build_mirror_data(self, ud, d):
230 # Generate a mirror tarball if needed 232 # Generate a mirror tarball if needed
231 if ud.write_tarballs and (ud.repochanged or not os.path.exists(ud.fullmirror)): 233 if ud.write_tarballs and not os.path.exists(ud.fullmirror):
232 # it's possible that this symlink points to read-only filesystem with PREMIRROR 234 # it's possible that this symlink points to read-only filesystem with PREMIRROR
233 if os.path.islink(ud.fullmirror): 235 if os.path.islink(ud.fullmirror):
234 os.unlink(ud.fullmirror) 236 os.unlink(ud.fullmirror)