[RFC,1/2] meta: Move aggregate_files to base class

Message ID 20211129145241.2932943-2-Vijaikumar_Kanagarajan@mentor.com
State RFC
Headers show
Series Buildchroot non-determinism | expand

Commit Message

Vijai Kumar K Nov. 29, 2021, 4:52 a.m. UTC
This API is generic and can be used to aggregate any set of files.
This can be reused for building buildchroot preferences file in future.

Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
---
 meta/classes/base.bbclass                           | 10 ++++++++++
 meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 10 ----------
 2 files changed, 10 insertions(+), 10 deletions(-)

Patch

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 72d4cc0..6d24ca7 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -235,3 +235,13 @@  def base_set_filespath(path, d):
             if p != "":
                 filespath.append(os.path.join(p, o))
     return ":".join(filespath)
+
+def aggregate_files(d, file_list, file_out):
+    import shutil
+
+    with open(file_out, "wb") as out_fd:
+        for entry in file_list:
+            entry_real = bb.parse.resolve_file(entry, d)
+            with open(entry_real, "rb") as in_fd:
+                 shutil.copyfileobj(in_fd, out_fd, 1024*1024*10)
+            out_fd.write("\n".encode())
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index e9f9291..bc8ce22 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -68,16 +68,6 @@  python () {
         d.appendVar("SRC_URI", " file://%s" % bb.parse.resolve_file(file, d))
 }
 
-def aggregate_files(d, file_list, file_out):
-    import shutil
-
-    with open(file_out, "wb") as out_fd:
-        for entry in file_list:
-            entry_real = bb.parse.resolve_file(entry, d)
-            with open(entry_real, "rb") as in_fd:
-                 shutil.copyfileobj(in_fd, out_fd, 1024*1024*10)
-            out_fd.write("\n".encode())
-
 def parse_aptsources_list_line(source_list_line):
     import re