diff mbox series

[layerindex-web,1/2] rrs: fix bitbakepath variable

Message ID 20240907113114.3361680-1-yi.zhao@windriver.com
State Under Review
Delegated to: Tim Orling
Headers show
Series [layerindex-web,1/2] rrs: fix bitbakepath variable | expand

Commit Message

Yi Zhao Sept. 7, 2024, 11:31 a.m. UTC
Since commit[1], the bitbake default path no longer uses the path
'bitbake', but instead uses the same URL processing as the layer
fetching.

[1] https://git.yoctoproject.org/layerindex-web/commit/?id=c91372587bbddd4c595d7202e51a8740b787a06e

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
---
 rrs/tools/rrs_distros.py              | 8 +++++++-
 rrs/tools/rrs_upgrade_history.py      | 7 ++++++-
 rrs/tools/rrs_upstream_history.py     | 8 +++++++-
 rrs/tools/upgrade_history_internal.py | 8 +++++++-
 4 files changed, 27 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/rrs/tools/rrs_distros.py b/rrs/tools/rrs_distros.py
index e4c6045..4c5b273 100755
--- a/rrs/tools/rrs_distros.py
+++ b/rrs/tools/rrs_distros.py
@@ -33,7 +33,13 @@  if not fetchdir:
     sys.exit(1)
 
 # setup bitbake path
-bitbakepath = os.path.join(fetchdir, 'bitbake')
+from layerindex.models import LayerItem
+bitbakeitem = LayerItem()
+bitbakeitem.vcs_url = settings.BITBAKE_REPO_URL
+bitbakepath = os.path.join(fetchdir, bitbakeitem.get_fetch_dir())
+if getattr(settings, 'BITBAKE_PATH', ''):
+    bitbakepath = os.path.join(bitbakepath, settings.BITBAKE_PATH)
+
 sys.path.insert(0, os.path.join(bitbakepath, 'lib'))
 
 
diff --git a/rrs/tools/rrs_upgrade_history.py b/rrs/tools/rrs_upgrade_history.py
index 42ba9b8..b762144 100755
--- a/rrs/tools/rrs_upgrade_history.py
+++ b/rrs/tools/rrs_upgrade_history.py
@@ -31,11 +31,16 @@  import settings
 
 logger = get_logger("HistoryUpgrade", settings)
 fetchdir = settings.LAYER_FETCH_DIR
-bitbakepath = os.path.join(fetchdir, 'bitbake')
 if not fetchdir:
     logger.error("Please set LAYER_FETCH_DIR in settings.py")
     sys.exit(1)
 
+from layerindex.models import LayerItem
+bitbakeitem = LayerItem()
+bitbakeitem.vcs_url = settings.BITBAKE_REPO_URL
+bitbakepath = os.path.join(fetchdir, bitbakeitem.get_fetch_dir())
+if getattr(settings, 'BITBAKE_PATH', ''):
+    bitbakepath = os.path.join(bitbakepath, settings.BITBAKE_PATH)
 
 def run_internal(maintplanlayerbranch, commit, commitdate, options, logger, bitbake_map, initial=False):
     from layerindex.models import PythonEnvironment
diff --git a/rrs/tools/rrs_upstream_history.py b/rrs/tools/rrs_upstream_history.py
index 73b6d91..2a17c30 100755
--- a/rrs/tools/rrs_upstream_history.py
+++ b/rrs/tools/rrs_upstream_history.py
@@ -33,7 +33,13 @@  if not fetchdir:
     sys.exit(1)
 
 # setup bitbake path
-bitbakepath = os.path.join(fetchdir, 'bitbake')
+from layerindex.models import LayerItem
+bitbakeitem = LayerItem()
+bitbakeitem.vcs_url = settings.BITBAKE_REPO_URL
+bitbakepath = os.path.join(fetchdir, bitbakeitem.get_fetch_dir())
+if getattr(settings, 'BITBAKE_PATH', ''):
+    bitbakepath = os.path.join(bitbakepath, settings.BITBAKE_PATH)
+
 sys.path.insert(0, os.path.join(bitbakepath, 'lib'))
 
 from layerindex.models import Recipe, LayerBranch
diff --git a/rrs/tools/upgrade_history_internal.py b/rrs/tools/upgrade_history_internal.py
index 842fe81..7f3b93e 100644
--- a/rrs/tools/upgrade_history_internal.py
+++ b/rrs/tools/upgrade_history_internal.py
@@ -448,7 +448,13 @@  def generate_history(options, layerbranch_id, commit, logger):
             return
 
     # setup bitbake
-    bitbakepath = os.path.join(fetchdir, 'bitbake')
+    from layerindex.models import LayerItem
+    bitbakeitem = LayerItem()
+    bitbakeitem.vcs_url = settings.BITBAKE_REPO_URL
+    bitbakepath = os.path.join(fetchdir, bitbakeitem.get_fetch_dir())
+    if getattr(settings, 'BITBAKE_PATH', ''):
+        bitbakepath = os.path.join(bitbakepath, settings.BITBAKE_PATH)
+
     if options.bitbake_rev:
         bitbake_rev = options.bitbake_rev
         if not re.match('^[0-9a-f]{40}$', bitbake_rev):