Bug 13711 - Parsing fails on externalsrc recipe containing both git and file in SRC_URI
Summary: Parsing fails on externalsrc recipe containing both git and file in SRC_URI
Status: RESOLVED WORKSFORME
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: 3.0
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 3.4 M4
Assignee: Richard Purdie
QA Contact:
URL:
Whiteboard: with backport
Depends on:
Blocks:
 
Reported: 2019-12-16 22:47 UTC by Jonathan Richardson
Modified: 2021-09-14 13:28 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
example recipe (564 bytes, application/octet-stream)
2019-12-16 22:47 UTC, Jonathan Richardson
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Richardson 2019-12-16 22:47:24 UTC
Created attachment 4603 [details]
example recipe

When I devtool a recipe that has both git:// and file:// in SRC_URI, SRCREV=AUTOREV, then try to build it, I get a parse error on the recipe:

WARNING: /home/jon/work/yocto/nxs/poky/build/../meta-brcm/meta-datacenter/recipes-core/spdk/brcm-spdk.bb: Exception during build_dependencies for AUTOREV
WARNING: /home/jon/work/yocto/nxs/poky/build/../meta-brcm/meta-datacenter/recipes-core/spdk/brcm-spdk.bb: Error during finalise of /home/jon/work/yocto/nxs/poky/build/../meta-brcm/meta-datacenter/recipes-core/spdk/brcm-spdk.bb
ERROR: ExpansionError during parsing /home/jon/work/yocto/nxs/poky/build/../meta-brcm/meta-datacenter/recipes-core/spdk/brcm-spdk.bb:05:06
Traceback (most recent call last):
  File "Var <SRCPV>", line 1, in <module>
  File "/home/jon/work/yocto/nxs/poky/bitbake/lib/bb/fetch2/__init__.py", line 752, in get_srcrev(d=<bb.data_smart.DataSmart object at 0x7fb142e91dd8>, method_name='sortable_revision'):
         if len(scms) == 0:
    >        raise FetchError("SRCREV was used yet no valid SCM was found in SRC_URI")

bb.data_smart.ExpansionError: Failure expanding variable SRCPV, expression was ${@bb.fetch2.get_srcrev(d)} which triggered exception FetchError: Fetcher failure: SRCREV was used yet no valid SCM was found in SRC_URI

If I comment out the file:// then it works fine.

I bisected poky and came to:
commit d427f58977a46f2bda4b7f30cf83793373e401d3 (refs/bisect/bad)
Author: Richard Purdie <richard.purdie@linuxfoundation.org>
Date:   Sat Nov 2 17:57:10 2019 +0000

    bitbake: 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.
    

If I revert that I no longer see the issue. An example recipe is attached. I've simplified it as much as possible.
Comment 1 Richard Purdie 2021-09-14 13:28:48 UTC
I just tested this with a recipe:

SUMMARY = "Storage Plane Development Kit (SPDK)"
DESCRIPTION = "Storage Plane Development Kit (SPDK) provides a set of tools and libraries for writing high performance, scalable, user-mode storage applications."
HOMEPAGE = "http://www.spdk.io/"
LICENSE = "CLOSED"
S = "${WORKDIR}/git"

SRCREV = "${AUTOREV}"
SRC_URI = "git://git.yoctoproject.org/pseudo;protocol=git \
          file://somefile.service"

do_compile() {
}

do_install() {
}

which was tweaked to use urls I could access. I tried "devtool modify" with this and it seems to work fine. If you have more details and it still fails with master, please reopen but for now, this seems to work for me.

Sorry about the time it took to get to this btw. What would help a lot in future would be a test case that fails (see oe-selftest -r devtool as an example of our devtool testing).