Skip to contentSkip to conversation

bitbake-setup: correctly deduce top directory from BBPATH environment variable

PATCH New Alexander Kanavin 1 participant 1 message Jan 12

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitbake-setup: correctly deduce top directory from BBPATH environment variable

From: Alexander Kanavin <[email protected]>

This fixes running 'bitbake-setup init' in an active bitbake session when a top dir settings file is absent. In this case, bitbake-setup was trying to make a whole new top directory under the current directory. It will will now use the existing top directory, deducing it from BBPATH (similar to status and update operations), which was always the intent.

The code was relying on an existence of a top directory settings file, which was always present in earlier prototypes, but is currently created
only when a setting is explicitly written into it. This logic is changed to use the bitbake-setup's cache directory, which is also explicitly created.

---
 bin/bitbake-setup | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
bin/bitbake-setup +2 -1
index abe7614c8..7f6ea550c 100755
@@ -43,6 +43,7 @@ def cache_dir(top_dir):
 def init_bb_cache(top_dir, settings, args):
     dldir = settings["default"]["dl-dir"]
     bb_cachedir = os.path.join(cache_dir(top_dir), 'bitbake-cache')
+    os.makedirs(bb_cachedir, exist_ok=True)
 
     d = bb.data.init()
     d.setVar("DL_DIR", dldir)
@@ -920,7 +921,7 @@ def get_top_dir(args, settings):
     setup_dir_via_bbpath = get_setup_dir_via_bbpath()
     if setup_dir_via_bbpath:
         top_dir = os.path.dirname(setup_dir_via_bbpath)
-        if os.path.exists(topdir_settings_path(top_dir)):
+        if os.path.exists(cache_dir(top_dir)):
             return top_dir
 
     if hasattr(args, 'setup_dir'):
Signature · 1 line
2.47.3