From 8878ee89ba45dfe9b3852e21604c216795152159 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 16 Jan 2012 15:01:08 +0000 Subject: bitbake/fetch2: allow resuming interrupted fetch A lot of our checks in the fetcher code assume that if the downloaded file exists, the download finished successfully; this meant that if BitBake was interrupted in the middle of a fetch then it would not resume the fetch the next time, but instead attempt to use the half-fetched file and usually fail as a result. Since we're already writing a ".done" stamp file when a fetch completes, just check for its existence and assume the download didn't complete successfully if it isn't present. (Bitbake rev: 721e986624529aedef96dd06c9fe6243f2897b10) Signed-off-by: Paul Eggleton Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bitbake/lib') diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index fe4f4b1d60..07aac4c3a0 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py @@ -479,7 +479,7 @@ def try_mirrors(d, origud, mirrors, check = False): return found continue - if ud.method.need_update(newuri, ud, ld): + if not os.path.exists(ud.donestamp) or ud.method.need_update(newuri, ud, ld): ud.method.download(newuri, ud, ld) if hasattr(ud.method,"build_mirror_data"): ud.method.build_mirror_data(newuri, ud, ld) @@ -955,7 +955,7 @@ class Fetch(object): try: self.d.setVar("BB_NO_NETWORK", network) - if not m.need_update(u, ud, self.d): + if os.path.exists(ud.donestamp) and not m.need_update(u, ud, self.d): localpath = ud.localpath elif m.try_premirror(u, ud, self.d): logger.debug(1, "Trying PREMIRRORS") @@ -966,7 +966,7 @@ class Fetch(object): self.d.setVar("BB_NO_NETWORK", "1") firsterr = None - if not localpath and m.need_update(u, ud, self.d): + if not localpath and ((not os.path.exists(ud.donestamp)) or m.need_update(u, ud, self.d)): try: logger.debug(1, "Trying Upstream") m.download(u, ud, self.d) -- cgit v1.2.3-54-g00ecf