<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>14040</bug_id>
          
          <creation_ts>2020-09-03 08:00:07 +0000</creation_ts>
          <short_desc>recipetool: creating binary recipe from upstream git repo without explicit PV causes circular reference in SRC_URI</short_desc>
          <delta_ts>2023-03-29 15:51:19 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>devtools / tool chain</component>
          <version>3.0.5</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugzilla.yoctoproject.org/show_bug.cgi?id=15085</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>4.3 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Chris Laplante">mostthingsweb</reporter>
          <assigned_to name="Yoann Congal">yoann.congal</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>yoann.congal</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>88096</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Laplante">mostthingsweb</who>
    <bug_when>2020-09-03 08:00:07 +0000</bug_when>
    <thetext>Found while attempting this:
devtool add -b abi-dumper-native https://github.com/lvc/abi-dumper

The &apos;-b&apos; flag causes &apos;;workdir=${BP}&apos; to be tacked onto the SRC_URI. 

Since we didn&apos;t specify a PV, it takes the default:
PV = &quot;1.0+git${SRCPV}&quot;

But SRCPV is defined in terms of the SRC_URI, which leads to infinite recursion (traceback below). Here are the pertinent variables which cause the recursion:

SRC_URI = &quot;git://github.com/lvc/abi-dumper;protocol=https;subdir=${BP}&quot;
BP = &quot;${BPN}-${PV}&quot;
PV = &quot;1.0+git${SRCPV}&quot;
SRCPV = &quot;${@bb.fetch2.get_srcrev(d)}&quot;

def get_srcrev(d, method_name=&apos;sortable_revision&apos;):
    # ... trimmed
    scms = []
    fetcher = Fetch(d.getVar(&apos;SRC_URI&apos;).split(), d)
    # ... trimmed


Suggested fix: when setting PV in terms of &apos;SRCPV&apos;, ensure that &apos;subdir=${BPN}&apos; is used instead of &apos;subdir=${BP}&apos;. Thoughts?



Traceback:

ERROR: Traceback (most recent call last):
  File &quot;/home/laplante/yocto/sources/poky/bitbake/lib/bb/data_smart.py&quot;, line 411, in expandWithRefs
    s = __expand_python_regexp__.sub(varparse.python_sub, s)
  File &quot;/home/laplante/yocto/sources/poky/bitbake/lib/bb/data_smart.py&quot;, line 110, in python_sub
    if &quot;_remote_data&quot; in self.d:
  File &quot;/usr/lib/python3.6/_collections_abc.py&quot;, line 666, in __contains__
    self[key]
  File &quot;/home/laplante/yocto/sources/poky/bitbake/lib/bb/data_smart.py&quot;, line 1021, in __getitem__
    value = self.getVar(item, False)
  File &quot;/home/laplante/yocto/sources/poky/bitbake/lib/bb/data_smart.py&quot;, line 604, in getVar
    return self.getVarFlag(var, &quot;_content&quot;, expand, noweakdefault, parsing)
RecursionError: maximum recursion depth exceeded

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File &quot;/home/laplante/yocto/sources/poky/bitbake/lib/bb/command.py&quot;, line 74, in runCommand
    result = command_method(self, commandline)
  File &quot;/home/laplante/yocto/sources/poky/bitbake/lib/bb/command.py&quot;, line 562, in parseRecipeFile
    envdata = parser.loadDataFull(fn, appendfiles)
  File &quot;/home/laplante/yocto/sources/poky/bitbake/lib/bb/cache.py&quot;, line 324, in loadDataFull
    bb_data = self.load_bbfile(virtualfn, appends, virtonly=True)
  File &quot;/home/laplante/yocto/sources/poky/bitbake/lib/bb/cache.py&quot;, line 337, in load_bbfile
    datastores = parse_recipe(bb_data, bbfile, appends, mc)
  File &quot;/home/laplante/yocto/sources/poky/bitbake/lib/bb/cache.py&quot;, line 300, in parse_recipe
    bb_data = bb.parse.handle(bbfile, bb_data)
  File &quot;/home/laplante/yocto/sources/poky/bitbake/lib/bb/parse/__init__.py&quot;, line 107, in handle
    return h[&apos;handle&apos;](fn, data, include)
  File &quot;/home/laplante/yocto/sources/poky/bitbake/lib/bb/parse/parse_py/BBHandler.py&quot;, line 141, in handle
    return ast.multi_finalize(fn, d)
  File &quot;/home/laplante/yocto/sources/poky/bitbake/lib/bb/parse/ast.py&quot;, line 386, in multi_finalize
    finalize(fn, d)
  File &quot;/home/laplante/yocto/sources/poky/bitbake/lib/bb/parse/ast.py&quot;, line 345, in finalize
    runAnonFuncs(d)
  File &quot;/home/laplante/yocto/sources/poky/bitbake/lib/bb/parse/ast.py&quot;, line 329, in runAnonFuncs
    bb.utils.better_exec(&quot;\n&quot;.join(code), {&quot;d&quot;: d})
  File &quot;/home/laplante/yocto/sources/poky/bitbake/lib/bb/utils.py&quot;, line 396, in better_exec
    exec(code, get_context(), context)
  File &quot;&lt;code&gt;&quot;, line 3, in &lt;module&gt;
  File &quot;/home/laplante/yocto/sources/poky/meta/classes/base.bbclass&quot;, line 678, in __anon_706__home_laplante_yocto_sources_poky_meta_classes_base_bbclass
    fpaths = (d.getVar(&apos;FILESPATH&apos;) or &apos;&apos;).split(&apos;:&apos;)
  File &quot;/home/laplante/yocto/sources/poky/bitbake/lib/bb/data_smart.py&quot;, line 604, in getVar
    return self.getVarFlag(var, &quot;_content&quot;, expand, noweakdefault, parsing)
  File &quot;/home/laplante/yocto/sources/poky/bitbake/lib/bb/data_smart.py&quot;, line 802, in getVarFlag
    parser = self.expandWithRefs(value, cachename)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88124</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2020-09-10 07:34:49 +0000</bug_when>
    <thetext>11593 is related.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88125</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2020-09-10 07:35:06 +0000</bug_when>
    <thetext>Also 14040.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88126</commentid>
    <comment_count>3</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2020-09-10 07:36:31 +0000</bug_when>
    <thetext>Oops, this is 14040 but it&apos;s a circular reference so this error is amusing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88133</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Laplante">mostthingsweb</who>
    <bug_when>2020-09-10 09:25:03 +0000</bug_when>
    <thetext>Classic. I&apos;ll be sure to fix 14040 before I fix 14040 ;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95204</commentid>
    <comment_count>5</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-03-28 22:46:22 +0000</bug_when>
    <thetext>This was fixed by Saul Wold in https://git.yoctoproject.org/poky/commit/?id=254fbcf614cd57d5a5d4ca36b9765b463eaaf10f in february 2022

Just tested it :

 $ devtool add -b abi-dumper-native https://github.com/lvc/abi-dumper 
INFO: Fetching git://github.com/lvc/abi-dumper;protocol=https;subdir=${BPN};branch=master...

This produce a recipe and the generated SRC_URI does indeed implement the proposed fix &quot;subdir=${BPN}&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95207</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2023-03-29 12:42:20 +0000</bug_when>
    <thetext>Great to hear it is fixed. Are we missing a test case for this to ensure it doesn&apos;t regress again?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95209</commentid>
    <comment_count>7</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-03-29 13:03:17 +0000</bug_when>
    <thetext>(In reply to Richard Purdie from comment #6)
&gt; Great to hear it is fixed. Are we missing a test case for this to ensure it
&gt; doesn&apos;t regress again?

I&apos;ve looked around a bit and I did not find a testcase for the &apos;-b&apos; flag.
https://git.yoctoproject.org/poky/tree/meta/lib/oeqa/selftest/cases/devtool.py
https://git.yoctoproject.org/poky/tree/meta/lib/oeqa/selftest/cases/recipetool.py
(And no testcase merged with the fix)

I&apos;ll create a separate ticket for this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95211</commentid>
    <comment_count>8</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2023-03-29 13:10:24 +0000</bug_when>
    <thetext>=&gt; Bug 15085 - Add a testcase for the devtool add &quot;-b&quot; flag</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95214</commentid>
    <comment_count>9</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2023-03-29 15:51:19 +0000</bug_when>
    <thetext>Great, thanks!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>