summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/__init__.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2024-02-28 11:27:12 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-03-03 16:26:17 +0000
commit2689d8cf22d3809923aad5bd87e5e3e1821ffc82 (patch)
tree955e066591a3e865f9d2166d49a95f4928ccdf5e /bitbake/lib/bb/fetch2/__init__.py
parent9f60a166460c7c864e969ec4290693c62d6f4484 (diff)
downloadpoky-2689d8cf22d3809923aad5bd87e5e3e1821ffc82.tar.gz
bitbake: fetch/git: Avoid clean upon failure
Currently when git fetches fail, it destroys all the existing local clone data. For large repositories this can introduce long build delays when for example, you just typo'd the git revision hash. The git fetcher should be able to recover most directories so when the fetch is for a git repo, avoid removing things unless clean is explicitly called (e.g. a -c cleanall task). (Bitbake rev: 1b3cd039fe19b24bd4be9a0202a98cdcbb0e9443) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/__init__.py')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index ac0f4dfa1d..3529531ca1 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -1115,7 +1115,8 @@ def try_mirror_url(fetch, origud, ud, ld, check = False):
1115 logger.debug("Mirror fetch failure for url %s (original url: %s)" % (ud.url, origud.url)) 1115 logger.debug("Mirror fetch failure for url %s (original url: %s)" % (ud.url, origud.url))
1116 logger.debug(str(e)) 1116 logger.debug(str(e))
1117 try: 1117 try:
1118 ud.method.clean(ud, ld) 1118 if ud.method.cleanup_upon_failure():
1119 ud.method.clean(ud, ld)
1119 except UnboundLocalError: 1120 except UnboundLocalError:
1120 pass 1121 pass
1121 return False 1122 return False
@@ -1440,6 +1441,12 @@ class FetchMethod(object):
1440 """ 1441 """
1441 return False 1442 return False
1442 1443
1444 def cleanup_upon_failure(self):
1445 """
1446 When a fetch fails, should clean() be called?
1447 """
1448 return True
1449
1443 def verify_donestamp(self, ud, d): 1450 def verify_donestamp(self, ud, d):
1444 """ 1451 """
1445 Verify the donestamp file 1452 Verify the donestamp file
@@ -1885,7 +1892,7 @@ class Fetch(object):
1885 logger.debug(str(e)) 1892 logger.debug(str(e))
1886 firsterr = e 1893 firsterr = e
1887 # Remove any incomplete fetch 1894 # Remove any incomplete fetch
1888 if not verified_stamp: 1895 if not verified_stamp and m.cleanup_upon_failure():
1889 m.clean(ud, self.d) 1896 m.clean(ud, self.d)
1890 logger.debug("Trying MIRRORS") 1897 logger.debug("Trying MIRRORS")
1891 mirrors = mirror_from_string(self.d.getVar('MIRRORS')) 1898 mirrors = mirror_from_string(self.d.getVar('MIRRORS'))