Introduce the KCONFIG_CONFIG_ROOTDIR variable to allow recipes
which the .config file is not under the ${B} to select the root
directory location for the config file.

Signed-off-by: Diego Sueiro <diego.sue...@arm.com>
---
 meta/classes/cml1.bbclass | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/meta/classes/cml1.bbclass b/meta/classes/cml1.bbclass
index 8ab2405..9b9866f 100644
--- a/meta/classes/cml1.bbclass
+++ b/meta/classes/cml1.bbclass
@@ -27,12 +27,16 @@ CROSS_CURSES_INC = '-DCURSES_LOC="<curses.h>"'
 TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
 
 KCONFIG_CONFIG_COMMAND ??= "menuconfig"
+KCONFIG_CONFIG_ROOTDIR ??= "${B}"
 python do_menuconfig() {
     import shutil
 
+    config = os.path.join(d.getVar('KCONFIG_CONFIG_ROOTDIR'), ".config")
+    configorig = os.path.join(d.getVar('KCONFIG_CONFIG_ROOTDIR'), 
".config.orig")
+
     try:
-        mtime = os.path.getmtime(".config")
-        shutil.copy(".config", ".config.orig")
+        mtime = os.path.getmtime(config)
+        shutil.copy(config, configorig)
     except OSError:
         mtime = 0
 
@@ -42,7 +46,7 @@ python do_menuconfig() {
     # FIXME this check can be removed when the minimum bitbake version has 
been bumped
     if hasattr(bb.build, 'write_taint'):
         try:
-            newmtime = os.path.getmtime(".config")
+            newmtime = os.path.getmtime(config)
         except OSError:
             newmtime = 0
 
@@ -52,7 +56,7 @@ python do_menuconfig() {
 }
 do_menuconfig[depends] += "ncurses-native:do_populate_sysroot"
 do_menuconfig[nostamp] = "1"
-do_menuconfig[dirs] = "${B}"
+do_menuconfig[dirs] = "${KCONFIG_CONFIG_ROOTDIR}"
 addtask menuconfig after do_configure
 
 python do_diffconfig() {
@@ -61,8 +65,8 @@ python do_diffconfig() {
 
     workdir = d.getVar('WORKDIR')
     fragment = workdir + '/fragment.cfg'
-    configorig = '.config.orig'
-    config = '.config'
+    configorig = os.path.join(d.getVar('KCONFIG_CONFIG_ROOTDIR'), 
".config.orig")
+    config = os.path.join(d.getVar('KCONFIG_CONFIG_ROOTDIR'), ".config")
 
     try:
         md5newconfig = bb.utils.md5_file(configorig)
@@ -85,5 +89,5 @@ python do_diffconfig() {
 }
 
 do_diffconfig[nostamp] = "1"
-do_diffconfig[dirs] = "${B}"
+do_diffconfig[dirs] = "${KCONFIG_CONFIG_ROOTDIR}"
 addtask diffconfig
-- 
2.7.4

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#141274): 
https://lists.openembedded.org/g/openembedded-core/message/141274
Mute This Topic: https://lists.openembedded.org/mt/76025360/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to