diff mbox series

[2/3] classes/insane: create one CachedPath instance in qa_check_staged

Message ID 20260630140800.4018491-2-ross.burton@arm.com
State New
Headers show
Series [1/3] classes/insane: increase shebang size limit | expand

Commit Message

Ross Burton June 30, 2026, 2:07 p.m. UTC
There's no need to create a new CachedPath instance for every file that
we want to scan, just create one at the beginning of the function.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes-global/insane.bbclass | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass
index 08bff7dca45..68ad78c39d6 100644
--- a/meta/classes-global/insane.bbclass
+++ b/meta/classes-global/insane.bbclass
@@ -729,6 +729,10 @@  def qa_check_staged(path,d):
     workdir = os.path.join(tmpdir, "work")
     recipesysroot = d.getVar("RECIPE_SYSROOT")
 
+    # package_qa_check_shebang_size needs the global cpath to be already created
+    global cpath
+    cpath = oe.cachedpath.CachedPath()
+
     if bb.data.inherits_class("native", d) or bb.data.inherits_class("cross", d):
         pkgconfigcheck = workdir
     else:
@@ -772,10 +776,7 @@  def qa_check_staged(path,d):
                         oe.qa.handle_error("pkgconfig", error_msg, d)
 
             if not skip_shebang_size:
-                global cpath
-                cpath = oe.cachedpath.CachedPath()
                 package_qa_check_shebang_size(path, "", d, None)
-                cpath = None
 
 # Walk over all files in a directory and call func
 def package_qa_walk(checkfuncs, package, d):