fetch2: Ensure cached url data is matched to a datastore
PATCH 1/1 fetch2: Ensure cached url data is matched to a datastore
There was a weird error in OE-Core where "devtool modify virtual/kernel" was showing basehash mismatch errors. This was due to SRCPV sometimes being:
AUTOINC+b867b78b50_47b80ef7bd and sometimes AUTOINC+b867b78b50_255a750d28.
The latter hash comes from KBRANCH and meant sometimes the correct branch was seen, sometimes it was not. The issue was complicated by the execution using a remote datastore over tinfoil.
The problem turns out to be a fetcher caching error. If the datastore changes, the cached url data may not be valid.
We therefore ensure we match cached url data against the datastore that generated it, which appears to fix this issue.
--- lib/bb/fetch2/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/bb/fetch2/__init__.py +2 -2
@@ -1593,7 +1593,7 @@ class Fetch(object): fn = d.getVar('FILE') mc = d.getVar('__BBMULTICONFIG') or "" if cache and fn and mc + fn in urldata_cache: - self.ud = urldata_cache[mc + fn] + self.ud = urldata_cache[mc + fn + str(id(d))] for url in urls: if url not in self.ud:
@@ -1605,7 +1605,7 @@ class Fetch(object): pass if fn and cache: - urldata_cache[mc + fn] = self.ud + urldata_cache[mc + fn + str(id(d))] = self.ud def localpath(self, url): if url not in self.urls:
Signature · 1 line
2.20.1
Just an FYI -- I did test this against the problem we found last week with devtool modify linux-yocto (and virtual/kernel). It DID resolved the problem.
--Mark
Quoted 42 lines · Richard Purdie
There was a weird error in OE-Core where "devtool modify virtual/kernel" was showing basehash mismatch errors. This was due to SRCPV sometimes being:
AUTOINC+b867b78b50_47b80ef7bd and sometimes AUTOINC+b867b78b50_255a750d28.The latter hash comes from KBRANCH and meant sometimes the correct branch was seen, sometimes it was not. The issue was complicated by the execution using a remote datastore over tinfoil.
The problem turns out to be a fetcher caching error. If the datastore changes, the cached url data may not be valid.
We therefore ensure we match cached url data against the datastore that generated it, which appears to fix this issue.
Signed-off-by Richard Purdie <[email protected]>--- lib/bb/fetch2/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)lib/bb/fetch2/__init__.py +2
-2@@ -1593,7 +1593,7 @@ class Fetch(object): fn = d.getVar('FILE') mc = d.getVar('__BBMULTICONFIG') or "" if cache and fn and mc + fn in urldata_cache: - self.ud = urldata_cache[mc + fn] + self.ud = urldata_cache[mc + fn + str(id(d))] for url in urls: if url not in self.ud:@@ -1605,7 +1605,7 @@ class Fetch(object): pass if fn and cache: - urldata_cache[mc + fn] = self.ud + urldata_cache[mc + fn + str(id(d))] = self.ud def localpath(self, url): if url not in self.urls:
Quoted 4 lines · Richard Purdie
There was a weird error in OE-Core where "devtool modify virtual/kernel" was showing basehash mismatch errors. This was due to SRCPV sometimes being:
AUTOINC+b867b78b50_47b80ef7bd and sometimes AUTOINC+b867b78b50_255a750d28.
Hello,
unfortunately, this breaks one of my classes with parses SRC_URI. E.g. a more or less minimal recipe like
-------
LICENSE = "CLOSED"
SRC_URI = "file://foo;name=bootsplash"
def _find_bootsplash(d):
fetch = bb.fetch2.Fetch([], d)
for url in fetch.urls:
urldata = fetch.ud[url]
parm = urldata.parm
if parm.get('name') == 'bootsplash':
return urldata
raise Exception("no bootsplash")
def get_bootsplash_convert(d):
uri = _find_bootsplash(d)
if not uri.localpath:
# happens in early parsing stage; skip further processing return None
## construct an image magick command to rotate/scale bootsplash ## ...
return "true"
LOGO_CONVERT_CMD = "${@get_bootsplash_convert(d)}"
do_unpack[postfuncs] += "do_logo_preprocess do_unpack_logo"
do_logo_preprocess() {
${LOGO_CONVERT_CMD}
false
}------
fails with
| + None
| .../temp/run.do_logo_preprocess.29898: line 104: None: command not found
after this patch (seen in thud branch; not tested with other ones). Before the patch, "true" (resp. "convert.im7") was called.
'uri.localpath' seems to be None in early build stages which is now cached and used in places where it was (re)calculated previously.
Enrico
Signature · 3 lines
SIGMA Chemnitz GmbH Registergericht: Amtsgericht Chemnitz HRB 1750 Am Erlenwald 13 Geschaeftsfuehrer: Grit Freitag, Frank Pyritz 09128 Chemnitz