summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/checksum.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-10-15 14:41:57 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-08 22:01:19 +0000
commit267eca35c1ac1e59a780ff433ad32018e294cc0f (patch)
tree2003f5d106602d04dc4fb8e6548b719405cc8d76 /bitbake/lib/bb/checksum.py
parentbf411441f5368284ae6a6ac9707c689f48973083 (diff)
downloadpoky-267eca35c1ac1e59a780ff433ad32018e294cc0f.tar.gz
bitbake: fetch2/checksum/siggen: Fix taskhashes not tracking file directories
Currently if you have something like: SRC_URI = "file://foobar;subdir=${S}" and a file like: foobar/1/somefile and then move it to: foobar/2/somefile the task checksums don't reflect/notice this. The file-checksum fields encode two pieces of data, the file path and whether or not the file exists. Changing the code which uses these fields is problematic. We can however add a "/./" path element which means "include the bit after the marker in the checksum" which the path walking code can use to mark which bits of the path are visible to the fetcher. I'm not convinced this is great design but it does appear to work. (Bitbake rev: b4975d2ecf615ac4c240808fbc5a3f879a93846b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/checksum.py')
-rw-r--r--bitbake/lib/bb/checksum.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/bitbake/lib/bb/checksum.py b/bitbake/lib/bb/checksum.py
index 1d50a26426..fb8a77f6ab 100644
--- a/bitbake/lib/bb/checksum.py
+++ b/bitbake/lib/bb/checksum.py
@@ -50,6 +50,7 @@ class FileChecksumCache(MultiProcessCache):
50 MultiProcessCache.__init__(self) 50 MultiProcessCache.__init__(self)
51 51
52 def get_checksum(self, f): 52 def get_checksum(self, f):
53 f = os.path.normpath(f)
53 entry = self.cachedata[0].get(f) 54 entry = self.cachedata[0].get(f)
54 cmtime = self.mtime_cache.cached_mtime(f) 55 cmtime = self.mtime_cache.cached_mtime(f)
55 if entry: 56 if entry:
@@ -84,15 +85,24 @@ class FileChecksumCache(MultiProcessCache):
84 return None 85 return None
85 return checksum 86 return checksum
86 87
88 #
89 # Changing the format of file-checksums is problematic as both OE and Bitbake have
90 # knowledge of them. We need to encode a new piece of data, the portion of the path
91 # we care about from a checksum perspective. This means that files that change subdirectory
92 # are tracked by the task hashes. To do this, we do something horrible and put a "/./" into
93 # the path. The filesystem handles it but it gives us a marker to know which subsection
94 # of the path to cache.
95 #
87 def checksum_dir(pth): 96 def checksum_dir(pth):
88 # Handle directories recursively 97 # Handle directories recursively
89 if pth == "/": 98 if pth == "/":
90 bb.fatal("Refusing to checksum /") 99 bb.fatal("Refusing to checksum /")
100 pth = pth.rstrip("/")
91 dirchecksums = [] 101 dirchecksums = []
92 for root, dirs, files in os.walk(pth, topdown=True): 102 for root, dirs, files in os.walk(pth, topdown=True):
93 [dirs.remove(d) for d in list(dirs) if d in localdirsexclude] 103 [dirs.remove(d) for d in list(dirs) if d in localdirsexclude]
94 for name in files: 104 for name in files:
95 fullpth = os.path.join(root, name) 105 fullpth = os.path.join(root, name).replace(pth, os.path.join(pth, "."))
96 checksum = checksum_file(fullpth) 106 checksum = checksum_file(fullpth)
97 if checksum: 107 if checksum:
98 dirchecksums.append((fullpth, checksum)) 108 dirchecksums.append((fullpth, checksum))