Skip to contentSkip to conversation

rrs: fix bitbakepath variable

PATCH New Yi Zhao 1 participant 2 messages Sep 7, 2024

lore
Share & tools
lore

Yi Zhao

author
#0 lore raw

PATCH 1/2 rrs: fix bitbakepath variable

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

---
 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(-)
rrs/tools/rrs_distros.py +7 -1
index e4c6045..4c5b273 100755
@@ -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'))
 
 
rrs/tools/rrs_upgrade_history.py +6 -1
index 42ba9b8..b762144 100755
@@ -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
rrs/tools/rrs_upstream_history.py +7 -1
index 73b6d91..2a17c30 100755
@@ -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
rrs/tools/upgrade_history_internal.py +7 -1
index 842fe81..7f3b93e 100644
@@ -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):
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 2/2 rrs_upstream_email.py: fix email sending error

According to commit [1], use recipesymbol instead of recipe to fix email sending errors:

django.core.exceptions.FieldError: Cannot resolve keyword 'recipe' into field. Choices are: history, history_id, id, maintainer, maintainer_id, recipesymbol, recipesymbol_id

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

---
 rrs/tools/rrs_upstream_email.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
rrs/tools/rrs_upstream_email.py +4 -4
index d87f791..9341333 100755
@@ -174,13 +174,13 @@ def main():
                 sys.exit(1)
 
             for recipe in layerbranch.recipe_set.all():
-                recipe_upstream_query = RecipeUpstream.objects.filter(recipe =
-                        recipe, history = recipe_upstream_history)
+                recipe_upstream_query = RecipeUpstream.objects.filter(recipesymbol__pn =
+                        recipe.pn, history = recipe_upstream_history)
                 if recipe_upstream_query and recipe_upstream_query[0].status == 'N':
                     recipes[recipe] = {}
 
-                    recipe_maintainer = RecipeMaintainer.objects.filter(recipe =
-                            recipe, history = recipe_maintainer_history)[0]
+                    recipe_maintainer = RecipeMaintainer.objects.filter(recipesymbol__pn =
+                            recipe.pn, history = recipe_maintainer_history)[0]
                     recipes[recipe]['maintainer'] = recipe_maintainer
                     recipes[recipe]['upstream'] = recipe_upstream_query[0]
 
Signature · 1 line
2.25.1