<?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>9506</bug_id>
          
          <creation_ts>2016-04-21 20:44:06 +0000</creation_ts>
          <short_desc>bitbake-layers: show-layers throws exception when can&apos;t find layer in bblayers.conf</short_desc>
          <delta_ts>2016-06-20 15:03:42 +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>BitBake</product>
          <component>bitbake</component>
          <version>2.1</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.2 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Humberto Ibarra">humberto.ibarra.lopez</reporter>
          <assigned_to name="Humberto Ibarra">humberto.ibarra.lopez</assigned_to>
          <cc>jose.perez.carranza</cc>
    
    <cc>leonardo.sandoval.gonzalez</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>richard.purdie</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>61536</commentid>
    <comment_count>0</comment_count>
    <who name="Humberto Ibarra">humberto.ibarra.lopez</who>
    <bug_when>2016-04-21 20:44:06 +0000</bug_when>
    <thetext>When a wrong path to a layers is found in bblayers.conf, the command bitbake-layers show-layers throws an exception. This should either ignore the failing layer or show a more graceful error message to the user.


humberto@yctb03:~/poky/build-test&gt; echo &quot;BBLAYERS += \&quot;/foo/path\&quot;&quot; &gt;&gt; conf/bblayers.conf;  bitbake-layers show-layers
ERROR: Traceback (most recent call last):
  File &quot;/home/humberto/poky/bitbake/lib/bb/cookerdata.py&quot;, line 179, in wrapped
    return func(fn, *args)
  File &quot;/home/humberto/poky/bitbake/lib/bb/cookerdata.py&quot;, line 203, in parse_config_file
    return bb.parse.handle(fn, data, include)
  File &quot;/home/humberto/poky/bitbake/lib/bb/parse/__init__.py&quot;, line 113, in handle
    return h[&apos;handle&apos;](fn, data, include)
  File &quot;/home/humberto/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py&quot;, line 124, in handle
    abs_fn = resolve_file(fn, data)
  File &quot;/home/humberto/poky/bitbake/lib/bb/parse/__init__.py&quot;, line 136, in resolve_file
    raise IOError(errno.ENOENT, &quot;file %s not found&quot; % fn)
IOError: [Errno 2] file /foo/path/conf/layer.conf not found

ERROR: Unable to parse /foo/path/conf/layer.conf: [Errno 2] file /foo/path/conf/layer.conf not found</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>61954</commentid>
    <comment_count>1</comment_count>
    <who name="Humberto Ibarra">humberto.ibarra.lopez</who>
    <bug_when>2016-05-04 19:49:50 +0000</bug_when>
    <thetext>Have been checking this and have a few comments to make:

-About the problem

To me it does look like something we need to solve. Stack traces can be confusing and I believe that those should only be shown when we do not know what is the exact failure.

Here, we know that the layer conf file can&apos;t be found, we should be failing gracefully. This situation is not much different from issuing &quot;bitbake-layers add-layer &lt;name&gt;&quot; when trying to add a layer that does not exist, and that command fails gracefully with no stack trace.

This error message shouldn&apos;t behave differently from that one.

-About Implementation:

The solution to this is not as easy as handling the error in the bitbake-layers script though. Unlike the add-layer subcommand, show-layers relies on cookerdata to handle the parsing of config files, so the fix must be inside a script used by many parts of the code.

Still wondering about the best way to proceed here. Adding a sys.exit under a conditional solves the problem, but the abrupt exit does not look like the ideal solution. Throwing a specific exception could work but I see no advantage in dealing with separate exceptions for each simple case like this one.

I will continue looking into this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62073</commentid>
    <comment_count>2</comment_count>
    <who name="Humberto Ibarra">humberto.ibarra.lopez</who>
    <bug_when>2016-05-10 17:55:00 +0000</bug_when>
    <thetext>Sent patch.

http://lists.openembedded.org/pipermail/bitbake-devel/2016-May/007431.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62126</commentid>
    <comment_count>3</comment_count>
    <who name="Humberto Ibarra">humberto.ibarra.lopez</who>
    <bug_when>2016-05-11 20:02:49 +0000</bug_when>
    <thetext>Sent patch v2

http://lists.openembedded.org/pipermail/bitbake-devel/2016-May/007433.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62166</commentid>
    <comment_count>4</comment_count>
    <who name="Humberto Ibarra">humberto.ibarra.lopez</who>
    <bug_when>2016-05-12 19:19:15 +0000</bug_when>
    <thetext>Sent patch v3

http://lists.openembedded.org/pipermail/bitbake-devel/2016-May/007456.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62184</commentid>
    <comment_count>5</comment_count>
    <who name="Humberto Ibarra">humberto.ibarra.lopez</who>
    <bug_when>2016-05-13 15:31:17 +0000</bug_when>
    <thetext>It has been noted that this will be solved at a higher level with the current migration to python3.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>62190</commentid>
    <comment_count>6</comment_count>
    <who name="Leonardo Sandoval Gonzalez">leonardo.sandoval.gonzalez</who>
    <bug_when>2016-05-13 16:30:54 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; It has been noted that this will be solved at a higher level with the
&gt; current migration to python3.

I do not get it. The patch that you sent is valid either on python2 or 3. So, in my opinion, it should be merged on bitbake master.

Leo</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63154</commentid>
    <comment_count>7</comment_count>
    <who name="Jose Perez C">jose.perez.carranza</who>
    <bug_when>2016-06-20 15:03:42 +0000</bug_when>
    <thetext>Working as expected 

Validated on : commit 7b9e1f5ad8a427356f2ec516b1718138a7d3c64e


**********************
ERROR: Layer directory &apos;/foo/path&apos; does not exist! Please check BBLAYERS in /home/jgperezc/work/YoctoProject/poky_test/build/conf/bblayers.conf</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>