Bug 13697 - Regression due to "fetch2: Ensure cached url data is matched to a datastore" patch
Summary: Regression due to "fetch2: Ensure cached url data is matched to a datastore" ...
Status: RESOLVED NOTABUG
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 3.1 M4
Assignee: Richard Purdie
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2019-12-10 14:54 UTC by Enrico Scholz
Modified: 2020-03-27 14:38 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Enrico Scholz 2019-12-10 14:54:52 UTC
The "fetch2: Ensure cached url data is matched to a datastore" patch (e.g. 4ce50bbd34eefeabfeca89a6a66c71598d3c58f6 in 1.42 branch) causes regressions in recipes which call `bb.fetch2.Fetch()` in early stages.

E.g.

------
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 after this patch but worked before.
Comment 1 Richard Purdie 2020-03-27 14:38:38 UTC
Sorry about the delay in getting to this. The issue is actually an API one.

The API is that for localpath to be valid, you need to call:

        urldata = fetch.ud[url]
        urldata.setup_localpath(d)

and your example doesn't.

In previous code you got a cached object that had this called already, with the patch applied, you no longer get the cached object and therefore need the call.