<?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>13404</bug_id>
          
          <creation_ts>2019-06-18 11:07:35 +0000</creation_ts>
          <short_desc>&apos;devtool upgrade&apos; tracebacks when a recipe includes another recipe with PV in the name</short_desc>
          <delta_ts>2019-07-03 20:27:48 +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>Scripts and Tools</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.8 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alexander Kanavin">alex.kanavin</reporter>
          <assigned_to name="Paul Eggleton">bluelightning</assigned_to>
          <cc>ross.burton</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>84232</commentid>
    <comment_count>0</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2019-06-18 11:07:35 +0000</bug_when>
    <thetext>Devtool is not able to handle a situation when a recipe to be upgraded includes another recipe with $PV in its filename (in this case the included recipe filename should be renamed but isn&apos;t).


How to reproduce:

With poky at http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=111b7173fee69fe8b01ec2fa6999713841326537

issue

&apos;devtool upgrade libnewt-python&apos;

This will result in

Traceback (most recent call last):
  File &quot;/home/alexander/development/poky/scripts/devtool&quot;, line 334, in &lt;module&gt;
    ret = main()
  File &quot;/home/alexander/development/poky/scripts/devtool&quot;, line 321, in main
    ret = args.func(args, config, basepath, workspace)
  File &quot;/home/alexander/development/poky/scripts/lib/devtool/upgrade.py&quot;, line 551, in upgrade
    rf, copied = _create_new_recipe(args.version, md5, sha256, args.srcrev, srcbranch, srcsubdir1, srcsubdir2, config.workspace_path, tinfoil, rd, license_diff, new_licenses)
  File &quot;/home/alexander/development/poky/scripts/lib/devtool/upgrade.py&quot;, line 419, in _create_new_recipe
    rd = tinfoil.parse_recipe_file(fullpath, False)
  File &quot;/home/alexander/development/poky/bitbake/lib/bb/tinfoil.py&quot;, line 641, in parse_recipe_file
    dscon = self.run_command(&apos;parseRecipeFile&apos;, fn, appends, appendlist)
  File &quot;/home/alexander/development/poky/bitbake/lib/bb/tinfoil.py&quot;, line 466, in run_command
    raise TinfoilCommandFailed(result[1])
bb.tinfoil.TinfoilCommandFailed: Traceback (most recent call last):
  File &quot;/home/alexander/development/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py&quot;, line 94, in include_single_file
    bb.parse.handle(fn, data, True)
  File &quot;/home/alexander/development/poky/bitbake/lib/bb/parse/__init__.py&quot;, line 107, in handle
    return h[&apos;handle&apos;](fn, data, include)
  File &quot;/home/alexander/development/poky/bitbake/lib/bb/parse/parse_py/BBHandler.py&quot;, line 120, in handle
    abs_fn = resolve_file(fn, d)
  File &quot;/home/alexander/development/poky/bitbake/lib/bb/parse/__init__.py&quot;, line 125, in resolve_file
    raise IOError(errno.ENOENT, &quot;file %s not found in %s&quot; % (fn, bbpath))
FileNotFoundError: [Errno 2] file recipes-extended/newt/libnewt_0.52.21.bb not found in /home/alexander/development/poky/build/workspace:/home/alexander/development/poky/meta-poky:/home/alexander/development/poky/build:/home/alexander/development/poky/meta:/home/alexander/development/poky/meta-yocto-bsp:/home/alexander/development/meta-mingw

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File &quot;/home/alexander/development/poky/bitbake/lib/bb/command.py&quot;, line 74, in runCommand
    result = command_method(self, commandline)
  File &quot;/home/alexander/development/poky/bitbake/lib/bb/command.py&quot;, line 562, in parseRecipeFile
    envdata = parser.loadDataFull(fn, appendfiles)
  File &quot;/home/alexander/development/poky/bitbake/lib/bb/cache.py&quot;, line 327, in loadDataFull
    bb_data = self.load_bbfile(virtualfn, appends, virtonly=True)
  File &quot;/home/alexander/development/poky/bitbake/lib/bb/cache.py&quot;, line 340, in load_bbfile
    datastores = parse_recipe(bb_data, bbfile, appends, mc)
  File &quot;/home/alexander/development/poky/bitbake/lib/bb/cache.py&quot;, line 303, in parse_recipe
    bb_data = bb.parse.handle(bbfile, bb_data)
  File &quot;/home/alexander/development/poky/bitbake/lib/bb/parse/__init__.py&quot;, line 107, in handle
    return h[&apos;handle&apos;](fn, data, include)
  File &quot;/home/alexander/development/poky/bitbake/lib/bb/parse/parse_py/BBHandler.py&quot;, line 130, in handle
    statements.eval(d)
  File &quot;/home/alexander/development/poky/bitbake/lib/bb/parse/ast.py&quot;, line 23, in eval
    statement.eval(data)
  File &quot;/home/alexander/development/poky/bitbake/lib/bb/parse/ast.py&quot;, line 45, in eval
    bb.parse.ConfHandler.include(self.filename, s, self.lineno, data, &quot;include required&quot;)
  File &quot;/home/alexander/development/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py&quot;, line 71, in include
    include_single_file(parentfn, fn, lineno, data, error_out)
  File &quot;/home/alexander/development/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py&quot;, line 98, in include_single_file
    raise ParseError(&quot;Could not %s file %s&quot; % (error_out, fn), parentfn, lineno)
bb.parse.ParseError: ParseError at /home/alexander/development/poky/build/workspace/recipes/libnewt-python/libnewt-python_0.52.21.bb:1: Could not include required file recipes-extended/newt/libnewt_0.52.21.bb

and the workspace will be left in an inconsistent state:

workspace/recipes will have the half-updated recipe that bitbake is unable to parse (due to missing include)

but workspace/appends will be empty.

Because of that, &apos;devtool reset&apos; will not be able to remove the offending recipe from the workspace, and it has to be deleted by hand.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84243</commentid>
    <comment_count>1</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2019-06-19 10:06:37 +0000</bug_when>
    <thetext>A related improvement would be to have a &apos;devtool reset --force-all&apos; command, which would basically re-initialize the workspace to a completely blank state. 

This wouls allow recovery from similar tracebacks - even if this specific one is fixed, there may be more.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84356</commentid>
    <comment_count>2</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2019-07-02 04:27:19 +0000</bug_when>
    <thetext>I&apos;ve sent a patch to fix this so it doesn&apos;t leave files around after the error by default (as well as generally fixing error handling). I think automatically handling this scenario completely (i.e. upgrading the other recipe) would be overkill, since this is rather unusual.

With regard to changing devtool reset, I&apos;d prefer instead that we fix these kinds of situations as they come up rather than providing a tool to work around them.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84363</commentid>
    <comment_count>3</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2019-07-03 20:27:48 +0000</bug_when>
    <thetext>Fix merged to master:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=b52d58b8bb81f5053b9fa8b79a137c37d6ef6fb3

(Note that the recipe originally triggering this was already changed to avoid the issue under http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=0d8357f9f38f529cc03ce2602d5209c9f8dfe878 ).</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>