<?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>15417</bug_id>
          
          <creation_ts>2024-03-03 23:00:54 +0000</creation_ts>
          <short_desc>&quot;bitbake-layers remove-layer&quot; does not work when there is a missing layer dependencies</short_desc>
          <delta_ts>2024-04-21 20:02:35 +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>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>5.0</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Yoann Congal">yoann.congal</reporter>
          <assigned_to name="Simone Weiß">simone.p.weiss</assigned_to>
          <cc>pavel</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>simone.p.weiss</cc>
    
    <cc>tim.orling</cc>
    
    <cc>yoann.congal</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>98372</commentid>
    <comment_count>0</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2024-03-03 23:00:54 +0000</bug_when>
    <thetext>For example, you added meta-networking before it depended on meta-python[0]: When you try to remove meta-networking, &quot;bitbake-layers remove-layer&quot; displays an error and does not remove the layer from bblayer.conf:

   $ bitbake-layers remove-layer ../meta-openembedded/meta-networking
  NOTE: Starting bitbake server...
  ERROR: Layer &apos;networking-layer&apos; depends on layer &apos;meta-python&apos;, but this layer is not enabled in your configuration

Maybe an option -f/--force is missing to ignore such dependency error and forcibly remove the layer from bblayer.conf ?

NB: This was triggered on the AB[1] which add/remove layers for each layers of meta-openembedded.

[0]: https://git.openembedded.org/meta-openembedded/commit/?id=ab7c469bfeb7aba97402d8eab03d9bb18725c6af
[1]: https://autobuilder.yoctoproject.org/typhoon/#/builders/155/builds/14/steps/30/logs/stdio</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98393</commentid>
    <comment_count>1</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2024-03-07 00:15:11 +0000</bug_when>
    <thetext>I&apos;m willing to wager that &quot;bitbake-layers layerindex-fetch meta-networking&quot; would work however ;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98454</commentid>
    <comment_count>2</comment_count>
    <who name="Simone Weiß">simone.p.weiss</who>
    <bug_when>2024-03-11 18:53:23 +0000</bug_when>
    <thetext>There is already a --force option for bitbake-layers. It ignores the recipe parse verification when adding layers. I will how to add it for remove as well</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98455</commentid>
    <comment_count>3</comment_count>
    <who name="Simone Weiß">simone.p.weiss</who>
    <bug_when>2024-03-11 19:43:02 +0000</bug_when>
    <thetext>(In reply to Tim Orling from comment #1)
&gt; I&apos;m willing to wager that &quot;bitbake-layers layerindex-fetch meta-networking&quot;
&gt; would work however ;)

Actually not :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98459</commentid>
    <comment_count>4</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2024-03-11 21:55:52 +0000</bug_when>
    <thetext>(In reply to Simone Weiß from comment #3)
&gt; (In reply to Tim Orling from comment #1)
&gt; &gt; I&apos;m willing to wager that &quot;bitbake-layers layerindex-fetch meta-networking&quot;
&gt; &gt; would work however ;)
&gt; 
&gt; Actually not :)

Only because meta-openembedded hasn&apos;t branched for scarthgap yet.

bibake-layers layerindex-fetch --branch master meta-networking is just fine.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98497</commentid>
    <comment_count>5</comment_count>
    <who name="Simone Weiß">simone.p.weiss</who>
    <bug_when>2024-03-16 09:22:16 +0000</bug_when>
    <thetext>This would maybe do, but feels too messy for me
diff --git a/bitbake/bin/bitbake-layers b/bitbake/bin/bitbake-layers
index d4b1d1aaf2..78c316fff7 100755
--- a/bitbake/bin/bitbake-layers
+++ b/bitbake/bin/bitbake-layers
@@ -34,6 +34,7 @@ def main():
     parser.add_argument(&apos;-d&apos;, &apos;--debug&apos;, help=&apos;Enable debug output&apos;, action=&apos;store_true&apos;)
     parser.add_argument(&apos;-q&apos;, &apos;--quiet&apos;, help=&apos;Print only errors&apos;, action=&apos;store_true&apos;)
     parser.add_argument(&apos;-F&apos;, &apos;--force&apos;, help=&apos;Force add without recipe parse verification&apos;, action=&apos;store_true&apos;)
+    parser.add_argument(&apos;-T&apos;, &apos;--notinfoil&apos;, help=&apos;Force run without tinfoil, this might fail.&apos;, action=&apos;store_true&apos;)
     parser.add_argument(&apos;--color&apos;, choices=[&apos;auto&apos;, &apos;always&apos;, &apos;never&apos;], default=&apos;auto&apos;, help=&apos;Colorize output (where %(metavar)s is %(choices)s)&apos;, metavar=&apos;COLOR&apos;)
 
     global_args, unparsed_args = parser.parse_known_args()
@@ -59,16 +60,21 @@ def main():
     plugins = []
     tinfoil = bb.tinfoil.Tinfoil(tracking=True)
     tinfoil.logger.setLevel(logger.getEffectiveLevel())
-    try:
+    if global_args.notinfoil:
+        bbpath_string = []
+    else:
         tinfoil.prepare(True)
-        for path in ([topdir] +
-                    tinfoil.config_data.getVar(&apos;BBPATH&apos;).split(&apos;:&apos;)):
+        bbpath_string = tinfoil.config_data.getVar(&apos;BBPATH&apos;).split(&apos;:&apos;)
+        print(bbpath_string)
+    
+    try: 
+        for path in ([topdir] + bbpath_string):
             pluginpath = os.path.join(path, &apos;lib&apos;, &apos;bblayers&apos;)
             bb.utils.load_plugins(logger, plugins, pluginpath)
-
         registered = False
+
         for plugin in plugins:
-            if hasattr(plugin, &apos;tinfoil_init&apos;):
+            if hasattr(plugin, &apos;tinfoil_init&apos;) and not global_args.notinfoil:
                 plugin.tinfoil_init(tinfoil)
             if hasattr(plugin, &apos;register_commands&apos;):
                 registered = True</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98498</commentid>
    <comment_count>6</comment_count>
    <who name="Simone Weiß">simone.p.weiss</who>
    <bug_when>2024-03-16 09:24:49 +0000</bug_when>
    <thetext>(In reply to Simone Weiß from comment #5)
&gt; This would maybe do, but feels too messy for me
&gt; diff --git a/bitbake/bin/bitbake-layers b/bitbake/bin/bitbake-layers
&gt; index d4b1d1aaf2..78c316fff7 100755
&gt; --- a/bitbake/bin/bitbake-layers
&gt; +++ b/bitbake/bin/bitbake-layers
&gt; @@ -34,6 +34,7 @@ def main():
&gt;      parser.add_argument(&apos;-d&apos;, &apos;--debug&apos;, help=&apos;Enable debug output&apos;,
&gt; action=&apos;store_true&apos;)
&gt;      parser.add_argument(&apos;-q&apos;, &apos;--quiet&apos;, help=&apos;Print only errors&apos;,
&gt; action=&apos;store_true&apos;)
&gt;      parser.add_argument(&apos;-F&apos;, &apos;--force&apos;, help=&apos;Force add without recipe
&gt; parse verification&apos;, action=&apos;store_true&apos;)
&gt; +    parser.add_argument(&apos;-T&apos;, &apos;--notinfoil&apos;, help=&apos;Force run without
&gt; tinfoil, this might fail.&apos;, action=&apos;store_true&apos;)
&gt;      parser.add_argument(&apos;--color&apos;, choices=[&apos;auto&apos;, &apos;always&apos;, &apos;never&apos;],
&gt; default=&apos;auto&apos;, help=&apos;Colorize output (where %(metavar)s is %(choices)s)&apos;,
&gt; metavar=&apos;COLOR&apos;)
&gt;  
&gt;      global_args, unparsed_args = parser.parse_known_args()
&gt; @@ -59,16 +60,21 @@ def main():
&gt;      plugins = []
&gt;      tinfoil = bb.tinfoil.Tinfoil(tracking=True)
&gt;      tinfoil.logger.setLevel(logger.getEffectiveLevel())
&gt; -    try:
&gt; +    if global_args.notinfoil:
&gt; +        bbpath_string = []
&gt; +    else:
&gt;          tinfoil.prepare(True)
&gt; -        for path in ([topdir] +
&gt; -                    tinfoil.config_data.getVar(&apos;BBPATH&apos;).split(&apos;:&apos;)):
&gt; +        bbpath_string = tinfoil.config_data.getVar(&apos;BBPATH&apos;).split(&apos;:&apos;)
&gt; +        print(bbpath_string)
&gt; +    
&gt; +    try: 
&gt; +        for path in ([topdir] + bbpath_string):
&gt;              pluginpath = os.path.join(path, &apos;lib&apos;, &apos;bblayers&apos;)
&gt;              bb.utils.load_plugins(logger, plugins, pluginpath)
&gt; -
&gt;          registered = False
&gt; +
&gt;          for plugin in plugins:
&gt; -            if hasattr(plugin, &apos;tinfoil_init&apos;):
&gt; +            if hasattr(plugin, &apos;tinfoil_init&apos;) and not
&gt; global_args.notinfoil:
&gt;                  plugin.tinfoil_init(tinfoil)
&gt;              if hasattr(plugin, &apos;register_commands&apos;):
&gt;                  registered = True

And then also using this in bitbake/lib/bblayers/action.py
 for adding and removing...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98585</commentid>
    <comment_count>7</comment_count>
    <who name="Pavel Zhukov">pavel</who>
    <bug_when>2024-03-22 15:57:44 +0000</bug_when>
    <thetext>This is even worse. 


$ bitbake-layers add-layer  ../../sources/meta-openembedded/meta-python/
NOTE: Starting bitbake server...
ERROR: Layer &apos;networking-layer&apos; depends on layer &apos;meta-python&apos;, but this layer is not enabled in your configuration</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>