diff mbox series

bitbake-layers: add/remove option to not use tinfoil

Message ID 20240325202757.7711-1-simone.p.weiss@posteo.com
State New
Headers show
Series bitbake-layers: add/remove option to not use tinfoil | expand

Commit Message

Simone Weiß March 25, 2024, 8:27 p.m. UTC
From: Simone Weiß <simone.p.weiss@posteo.com>

Fixes [YOCTO #15417]

When a layer adds a new dependency after it was added to a conf, it can not be
removed w/o this dependency in the setup. Even the dependent layer can not be
added, as the tinfoil setup will fail.
Add an option to not perform the tinfoil at all, the use will be at own risk,
i.e. the added layers might not parse properly afterwards.

Signed-off-by: Simone Weiß <simone.p.weiss@posteo.com>
---
 bin/bitbake-layers     | 16 +++++++++++-----
 lib/bblayers/action.py |  6 ++++--
 2 files changed, 15 insertions(+), 7 deletions(-)

Comments

Richard Purdie March 26, 2024, 11:48 a.m. UTC | #1
On Mon, 2024-03-25 at 20:27 +0000, Simone Weiß wrote:
> From: Simone Weiß <simone.p.weiss@posteo.com>
> 
> Fixes [YOCTO #15417]
> 
> When a layer adds a new dependency after it was added to a conf, it
> can not be
> removed w/o this dependency in the setup. Even the dependent layer
> can not be
> added, as the tinfoil setup will fail.
> Add an option to not perform the tinfoil at all, the use will be at
> own risk,
> i.e. the added layers might not parse properly afterwards.
> 
> Signed-off-by: Simone Weiß <simone.p.weiss@posteo.com>
> ---
>  bin/bitbake-layers     | 16 +++++++++++-----
>  lib/bblayers/action.py |  6 ++++--
>  2 files changed, 15 insertions(+), 7 deletions(-)

Rather than calling this "notinfoil", which won't mean much to users,
we should probably call it something which means "skip parsing tests"
or similar. That way people would understand what it does.

Cheers,

Richard
diff mbox series

Patch

diff --git a/bin/bitbake-layers b/bin/bitbake-layers
index d4b1d1aa..78c316ff 100755
--- a/bin/bitbake-layers
+++ b/bin/bitbake-layers
@@ -34,6 +34,7 @@  def main():
     parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true')
     parser.add_argument('-q', '--quiet', help='Print only errors', action='store_true')
     parser.add_argument('-F', '--force', help='Force add without recipe parse verification', action='store_true')
+    parser.add_argument('-T', '--notinfoil', help='Force run without tinfoil, this might fail.', action='store_true')
     parser.add_argument('--color', choices=['auto', 'always', 'never'], default='auto', help='Colorize output (where %(metavar)s is %(choices)s)', metavar='COLOR')
 
     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('BBPATH').split(':')):
+        bbpath_string = tinfoil.config_data.getVar('BBPATH').split(':')
+        print(bbpath_string)
+    
+    try: 
+        for path in ([topdir] + bbpath_string):
             pluginpath = os.path.join(path, 'lib', 'bblayers')
             bb.utils.load_plugins(logger, plugins, pluginpath)
-
         registered = False
+
         for plugin in plugins:
-            if hasattr(plugin, 'tinfoil_init'):
+            if hasattr(plugin, 'tinfoil_init') and not global_args.notinfoil:
                 plugin.tinfoil_init(tinfoil)
             if hasattr(plugin, 'register_commands'):
                 registered = True
diff --git a/lib/bblayers/action.py b/lib/bblayers/action.py
index a8f26993..7180ef64 100644
--- a/lib/bblayers/action.py
+++ b/lib/bblayers/action.py
@@ -50,8 +50,8 @@  class ActionPlugin(LayerPlugin):
 
         try:
             notadded, _ = bb.utils.edit_bblayers_conf(bblayers_conf, layerdirs, None)
-            self.tinfoil.modified_files()
-            if not (args.force or notadded):
+            if not (args.force or notadded or args.notinfoil):
+                self.tinfoil.modified_files()
                 try:
                     self.tinfoil.run_command('parseConfiguration')
                 except (bb.tinfoil.TinfoilUIException, bb.BBHandledException):
@@ -83,6 +83,8 @@  class ActionPlugin(LayerPlugin):
                 layerdir = os.path.abspath(item)
             layerdirs.append(layerdir)
         (_, notremoved) = bb.utils.edit_bblayers_conf(bblayers_conf, None, layerdirs)
+        if args.notinfoil:
+            return 0
         self.tinfoil.modified_files()
         if notremoved:
             for item in notremoved: