summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/wget.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-09-01 10:06:34 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-09-05 12:54:25 +0100
commit58c42911d452e57505b08915618723961df5ef89 (patch)
tree9dcf92f76035e745bc3af153df49b405e083a0d2 /bitbake/lib/bb/fetch2/wget.py
parentd2420daacfefba20d26500e0b053855caff62238 (diff)
downloadpoky-58c42911d452e57505b08915618723961df5ef89.tar.gz
bitbake: wget: Avoid bad checksum race issues
If two recipes have conflicting checksums for a file, the code will currently remove the existing file when a mismatch is downloaded, even if another task successfully fetched it. This changes the code to verify the checksum (if possible) before replacing the file. This removes a potential race window and stops builds failing everywhere from one incorrect checksum. To make this work, we need to be able to override localpath and avoid NoChecksum errors being logged. (Bitbake rev: 4b8de2e7d12667d69d86ffe6e9f85a7932c4c9a5) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/wget.py')
-rw-r--r--bitbake/lib/bb/fetch2/wget.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index b2b542e1dc..821afa5b58 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -132,6 +132,11 @@ class Wget(FetchMethod):
132 132
133 self._runwget(ud, d, fetchcmd, False) 133 self._runwget(ud, d, fetchcmd, False)
134 134
135 # Try and verify any checksum now, meaning if it isn't correct, we don't remove the
136 # original file, which might be a race (imagine two recipes referencing the same
137 # source, one with an incorrect checksum)
138 bb.fetch2.verify_checksum(ud, d, localpath=localpath, fatal_nochecksum=False)
139
135 # Remove the ".tmp" and move the file into position atomically 140 # Remove the ".tmp" and move the file into position atomically
136 # Our lock prevents multiple writers but mirroring code may grab incomplete files 141 # Our lock prevents multiple writers but mirroring code may grab incomplete files
137 os.rename(localpath, localpath[:-4]) 142 os.rename(localpath, localpath[:-4])