Bug 12986 - Failed to expand SRCPV on updateding SRC_URI using pn overrides and BBCLASSEXTEND
Summary: Failed to expand SRCPV on updateding SRC_URI using pn overrides and BBCLASSEX...
Status: RESOLVED WORKSFORME
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: unspecified
Hardware: All Multiple
: Medium+ normal
Target Milestone: 3.4 M3
Assignee: Richard Purdie
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2018-11-07 11:01 UTC by Frederik Noe-Sdun
Modified: 2021-08-04 13:26 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

Note You need to log in before you can comment on or make changes to this bug.
Description Frederik Noe-Sdun 2018-11-07 11:01:35 UTC
If I try to modify SRC_URI using pn overrides for recipes using BBCLASSEXTEND modified entries are duplicated. If the recipe uses SRCPV bitbake expects  SRCREV_FORMAT to be set:


ERROR: ExpansionError during parsing /home/frederik/src/git/poky/meta/recipes-devtools/mmc/mmc-utils_git.bb
Traceback (most recent call last):
  File "/home/frederik/src/git/poky/bitbake/lib/bb/data_smart.py", line 808, in DataSmart.getVarFlag(var='PV', flag='_content', expand=True, noweakdefault=False, parsing=False, retparser=False):
             if expand or retparser:
    >            parser = self.expandWithRefs(value, cachename)
             if expand:
  File "/home/frederik/src/git/poky/bitbake/lib/bb/data_smart.py", line 416, in DataSmart.expandWithRefs(s='0.1${SRCPV}', varname='PV'):
                 try:
    >                s = __expand_var_regexp__.sub(varparse.var_sub, s)
                     try:
  File "/home/frederik/src/git/poky/bitbake/lib/bb/data_smart.py", line 108, in VariableParse.var_sub(match=<_sre.SRE_Match object; span=(3, 11), match='${SRCPV}'>):
                         raise Exception("variable %s references itself!" % self.varname)
    >            var = self.d.getVarFlag(key, "_content")
                 self.references.add(key)
  File "/home/frederik/src/git/poky/bitbake/lib/bb/data_smart.py", line 808, in DataSmart.getVarFlag(var='SRCPV', flag='_content', expand=True, noweakdefault=False, parsing=False, retparser=False):
             if expand or retparser:
    >            parser = self.expandWithRefs(value, cachename)
             if expand:
  File "/home/frederik/src/git/poky/bitbake/lib/bb/data_smart.py", line 430, in DataSmart.expandWithRefs(s='${@bb.fetch2.get_srcrev(d)}', varname='SRCPV'):
                 except Exception as exc:
    >                raise ExpansionError(varname, s, exc) from exc
     
bb.data_smart.ExpansionError: Failure expanding variable SRCPV, expression was ${@bb.fetch2.get_srcrev(d)} which triggered exception FetchError: Fetcher failure: The SRCREV_FORMAT variable must be set when multiple SCMs are used.


Steps to reproduce:

echo 'BBCLASSEXTEND += "native"                                                                                                                               
PV_append = "${SRCPV}"' >> meta/recipes-devtools/mmc/mmc-utils_git.bb
. ./oe-init-build-env
echo 'SRCBRANCH_pn-mmc-utils = "foobar"' >> conf/local.conf
bitbake -c fetch mmc-utils
Comment 1 Richard Purdie 2021-08-04 13:26:38 UTC
I tried to reproduce this using the steps you detail and couldn't. You mentioned changing SRC_URI but your steps don't include that. The SRCREV_FORMAT error suggests there were two git:// urls in SRC_URI which this bug doesn't show.

I'm going to close this as unable to reproduce, if you can provide reproduction steps please reopen.

For reference these issues are normally due to referencing S/WORKDIR in SRC_URI. If we need to know SRCREV to know PV to determine S/WORKDIR then that would cause a circular error.