Skip to contentSkip to conversation

populate_sdk_ext: copy BBMULTICONFIG files

PATCH Superseded Justin Bronder 2 participants 2 messages Jun 16, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 populate_sdk_ext: copy BBMULTICONFIG files

As the generated local.conf includes BBMULTICONFIG, the referenced files in conf/multiconfig also need to be copied. Otherwise with BBMULTICONFIG="abc" for instance, building the esdk fails with:

ERROR: ParseError at tmp/build-glibc/work/qemux86_64-oe-linux/core-image-ssh/1.0-r0/sdk-ext/image/tmp-renamed-sdk/layers/openembedded-core/meta/conf/bitbake.conf:767: Could not include required file conf/multiconfig/abc.conf

---
 meta/classes/populate_sdk_ext.bbclass | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
meta/classes/populate_sdk_ext.bbclass +11 -1
index fe840d9cfb..71f601fa9b 100644
@@ -397,6 +397,13 @@ python copy_buildsystem () {
             f.write('require conf/locked-sigs.inc\n')
             f.write('require conf/unlocked-sigs.inc\n')
 
+    # Copy multiple configurations if they exist
+    if d.getVar('BBMULTICONFIG') is not None:
+        bb.utils.mkdirhier(os.path.join(baseoutpath, 'conf', 'multiconfig'))
+        for mc in d.getVar('BBMULTICONFIG').split():
+            dest_stub = "/conf/multiconfig/%s.conf" % (mc,)
+            shutil.copyfile(builddir + dest_stub, baseoutpath + dest_stub)
+
     if os.path.exists(builddir + '/cache/bb_unihashes.dat'):
         bb.parse.siggen.save_unitaskhashes()
         bb.utils.mkdirhier(os.path.join(baseoutpath, 'cache'))
@@ -556,6 +563,9 @@ python copy_buildsystem () {
     # sdk_ext_postinst() below) thus the checksum we take here would always
     # be different.
     manifest_file_list = ['conf/*']
+    if d.getVar('BBMULTICONFIG') is not None:
+        manifest_file_list.append('conf/multiconfig/*')
+
     esdk_manifest_excludes = (d.getVar('ESDK_MANIFEST_EXCLUDES') or '').split()
     esdk_manifest_excludes_list = []
     for exclude_item in esdk_manifest_excludes:
@@ -564,7 +574,7 @@ python copy_buildsystem () {
     with open(manifest_file, 'w') as f:
         for item in manifest_file_list:
             for fn in glob.glob(os.path.join(baseoutpath, item)):
-                if fn == manifest_file:
+                if fn == manifest_file or os.path.isdir(fn):
                     continue
                 if fn in esdk_manifest_excludes_list:
                     continue
Signature · 1 line
2.31.1
#1 lore raw
Quoted 16 lines · Justin Bronder

As the generated local.conf includes BBMULTICONFIG, the referenced files in conf/multiconfig also need to be copied. Otherwise with BBMULTICONFIG="abc" for instance, building the esdk fails with:

ERROR: ParseError at tmp/build-glibc/work/qemux86_64-oe-linux/core-image-ssh/1.0-r0/sdk-ext/image/tmp-renamed-sdk/layers/openembedded-core/meta/conf/bitbake.conf:767: Could not include required file conf/multiconfig/abc.conf

---
  meta/classes/populate_sdk_ext.bbclass | 12 +++++++++++-
  1 file changed, 11 insertions(+), 1 deletion(-)
meta/classes/populate_sdk_ext.bbclass +0 -0
index fe840d9cfb..71f601fa9b 100644

meta/classes/populate_sdk_ext.bbclass python copy_buildsystem () { · line 405

Quoted 9 lines
meta/classes/populate_sdk_ext.bbclass +6 -0
@@ -397,6 +397,13 @@ python copy_buildsystem () {
              f.write('require conf/locked-sigs.inc\n')
              f.write('require conf/unlocked-sigs.inc\n')
 
+    # Copy multiple configurations if they exist
+    if d.getVar('BBMULTICONFIG') is not None:
+        bb.utils.mkdirhier(os.path.join(baseoutpath, 'conf', 'multiconfig'))
+        for mc in d.getVar('BBMULTICONFIG').split():
+            dest_stub = "/conf/multiconfig/%s.conf" % (mc,)
+            shutil.copyfile(builddir + dest_stub, baseoutpath + dest_stub)

multiconfig files can live in layers also, so they may not be in the the users conf/multiconfig directory. I'm not sure if you need to copy them for the esdk to work, but at a minimum if you don't find a multiconfig in the users conf directory it shouldn't be an error

Quoted 26 lines
meta/classes/populate_sdk_ext.bbclass +5 -1
+
      if os.path.exists(builddir + '/cache/bb_unihashes.dat'):
          bb.parse.siggen.save_unitaskhashes()
          bb.utils.mkdirhier(os.path.join(baseoutpath, 'cache'))
@@ -556,6 +563,9 @@ python copy_buildsystem () {
      # sdk_ext_postinst() below) thus the checksum we take here would always
      # be different.
      manifest_file_list = ['conf/*']
+    if d.getVar('BBMULTICONFIG') is not None:
+        manifest_file_list.append('conf/multiconfig/*')
+
      esdk_manifest_excludes = (d.getVar('ESDK_MANIFEST_EXCLUDES') or '').split()
      esdk_manifest_excludes_list = []
      for exclude_item in esdk_manifest_excludes:
@@ -564,7 +574,7 @@ python copy_buildsystem () {
      with open(manifest_file, 'w') as f:
          for item in manifest_file_list:
              for fn in glob.glob(os.path.join(baseoutpath, item)):
-                if fn == manifest_file:
+                if fn == manifest_file or os.path.isdir(fn):
                      continue
                  if fn in esdk_manifest_excludes_list:
                      continue