<?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>10913</bug_id>
          
          <creation_ts>2017-01-11 14:27:17 +0000</creation_ts>
          <short_desc>bitbake-layers: check layer dependencies before adding</short_desc>
          <delta_ts>2017-11-08 05:45:55 +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>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>2.4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Patrick Ohly">patrick.ohly</reporter>
          <assigned_to name="Rebecca Chang">rebecca.swee.fun.chang</assigned_to>
          <cc>ashwinx.soman</cc>
    
    <cc>bluelightning</cc>
    
    <cc>ee.peng.yeoh</cc>
    
    <cc>humberto.ibarra.lopez</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>rebecca.swee.fun.chang</cc>
    
    <cc>sgw</cc>
          
          <qa_contact name="Ashwin Soman">ashwinx.soman</qa_contact>
          <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>69711</commentid>
    <comment_count>0</comment_count>
    <who name="Patrick Ohly">patrick.ohly</who>
    <bug_when>2017-01-11 14:27:17 +0000</bug_when>
    <thetext>* check out Poky, set up a build
$ bitbake-layers add-layer /work/meta-security (= git://git.yoctoproject.org/meta-security)
$ bitbake libtpm-native
ERROR: Layer &apos;security&apos; depends on layer &apos;filesystems-layer&apos;, but this layer is not enabled in your configuration
ERROR: Layer &apos;security&apos; depends on layer &apos;perl-layer&apos;, but this layer is not enabled in your configuration

Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
$ bitbake-layers add-layer /work/meta-openembedded/meta-filesystems/
Traceback (most recent call last):
  File &quot;/work/iot-ref-kit/bitbake/bin/bitbake-layers&quot;, line 122, in &lt;module&gt;
    ret = main()
  File &quot;/work/iot-ref-kit/bitbake/bin/bitbake-layers&quot;, line 89, in main
    tinfoil = tinfoil_init(False)
  File &quot;/work/iot-ref-kit/bitbake/bin/bitbake-layers&quot;, line 38, in tinfoil_init
    tinfoil.prepare(not parserecipes)
  File &quot;/work/iot-ref-kit/bitbake/lib/bb/tinfoil.py&quot;, line 218, in prepare
    self.run_command(&apos;parseConfiguration&apos;)
  File &quot;/work/iot-ref-kit/bitbake/lib/bb/tinfoil.py&quot;, line 268, in run_command
    raise TinfoilCommandFailed(result[1])
bb.tinfoil.TinfoilCommandFailed: Traceback (most recent call last):
  File &quot;/work/iot-ref-kit/bitbake/lib/bb/command.py&quot;, line 81, in runCommand
    result = command_method(self, commandline)
  File &quot;/work/iot-ref-kit/bitbake/lib/bb/command.py&quot;, line 315, in parseConfiguration
    command.cooker.parseConfiguration()
  File &quot;/work/iot-ref-kit/bitbake/lib/bb/cooker.py&quot;, line 541, in parseConfiguration
    self.handleCollections(self.data.getVar(&quot;BBFILE_COLLECTIONS&quot;))
  File &quot;/work/iot-ref-kit/bitbake/lib/bb/cooker.py&quot;, line 1284, in handleCollections
    raise CollectionError(&quot;Errors during parsing layer configuration&quot;)
bb.cooker.CollectionError: Errors during parsing layer configuration

^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
  File &quot;/usr/lib/python3.4/multiprocessing/popen_fork.py&quot;, line 30, in poll
    pid, sts = os.waitpid(self.pid, flag)
KeyboardInterrupt

In other words, adding the meta-security layer without the layers it depends on succeeded, but then rendered the build configuration unusable. In particular, further bitbake-layers invocations to add the missing layers fail and have to be aborted manually.

Adding the missing layers manually of course still works.

IMHO the best solution would be to check for layer dependencies before adding a layer and then abort with a suitable error message.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69903</commentid>
    <comment_count>1</comment_count>
    <who name="Humberto Ibarra">humberto.ibarra.lopez</who>
    <bug_when>2017-01-18 21:26:23 +0000</bug_when>
    <thetext>I found this issue also, but in my case in was with show-layers

[humberto@localhost build]$ bitbake-layers show-layers
Traceback (most recent call last):
  File &quot;/home/humberto/poky2/bitbake/bin/bitbake-layers&quot;, line 122, in &lt;module&gt;
    ret = main()
  File &quot;/home/humberto/poky2/bitbake/bin/bitbake-layers&quot;, line 89, in main
    tinfoil = tinfoil_init(False)
  File &quot;/home/humberto/poky2/bitbake/bin/bitbake-layers&quot;, line 38, in tinfoil_init
    tinfoil.prepare(not parserecipes)
  File &quot;/home/humberto/poky2/bitbake/lib/bb/tinfoil.py&quot;, line 218, in prepare
    self.run_command(&apos;parseConfiguration&apos;)
  File &quot;/home/humberto/poky2/bitbake/lib/bb/tinfoil.py&quot;, line 268, in run_command
    raise TinfoilCommandFailed(result[1])
bb.tinfoil.TinfoilCommandFailed: Traceback (most recent call last):
  File &quot;/home/humberto/poky2/bitbake/lib/bb/command.py&quot;, line 81, in runCommand
    result = command_method(self, commandline)
  File &quot;/home/humberto/poky2/bitbake/lib/bb/command.py&quot;, line 315, in parseConfiguration
    command.cooker.parseConfiguration()
  File &quot;/home/humberto/poky2/bitbake/lib/bb/cooker.py&quot;, line 541, in parseConfiguration
    self.handleCollections(self.data.getVar(&quot;BBFILE_COLLECTIONS&quot;))
  File &quot;/home/humberto/poky2/bitbake/lib/bb/cooker.py&quot;, line 1284, in handleCollections
    raise CollectionError(&quot;Errors during parsing layer configuration&quot;)
bb.cooker.CollectionError: Errors during parsing layer configuration


Setting the LAYERDEPENDS variable in conf/layer.conf to LAYERDEPENDS_&lt;layer-name&gt; was what caused this issue for me. Using just LAYERDEPENDS as the name of the variable or actually any string other than the layer&apos;s name after LAYERDEPENDS causes bitbake-layers to behave normally again.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71561</commentid>
    <comment_count>2</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2017-03-22 03:10:43 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; Setting the LAYERDEPENDS variable in conf/layer.conf to
&gt; LAYERDEPENDS_&lt;layer-name&gt; was what caused this issue for me. Using just
&gt; LAYERDEPENDS as the name of the variable or actually any string other than
&gt; the layer&apos;s name after LAYERDEPENDS causes bitbake-layers to behave normally
&gt; again.

I think that&apos;s just incidental - you&apos;re hiding the dependency and thus the check doesn&apos;t think there are any missing dependencies; the dependencies are still missing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73779</commentid>
    <comment_count>3</comment_count>
    <who name="Rebecca Chang">rebecca.swee.fun.chang</who>
    <bug_when>2017-06-07 00:46:03 +0000</bug_when>
    <thetext>Fixed implemented and merged.

Bitbake rev: 705ab252e631903e6d2e46202b419a9e8adcd861</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77677</commentid>
    <comment_count>4</comment_count>
    <who name="Ashwin Soman">ashwinx.soman</who>
    <bug_when>2017-10-19 03:04:12 +0000</bug_when>
    <thetext>Bug is resolved , Layer is not added if dependent Layers are not present/enabled 

Logs:

pokyuser@ecf3a74f7f20:/workdir/build$ bitbake-layers add-layer /workdir/poky/meta-security
NOTE: Starting bitbake server...
ERROR: Layer &apos;security&apos; depends on layer &apos;meta-python&apos;, but this layer is not enabled in your configuration
ERROR: Layer &apos;security&apos; depends on layer &apos;networking-layer&apos;, but this layer is not enabled in your configuration
ERROR: Layer &apos;security&apos; depends on layer &apos;openembedded-layer&apos;, but this layer is not enabled in your configuration
ERROR: Layer &apos;security&apos; depends on layer &apos;perl-layer&apos;, but this layer is not enabled in your configuration

Summary: There were 4 ERROR messages shown, returning a non-zero exit code.
ERROR: Parse failure with the specified layer added
pokyuser@ecf3a74f7f20:/workdir/build$</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78052</commentid>
    <comment_count>5</comment_count>
    <who name="Ashwin Soman">ashwinx.soman</who>
    <bug_when>2017-11-08 05:45:55 +0000</bug_when>
    <thetext>Bug have been resolved and verified</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>