diff mbox series

[layerindex-web,5/6] rrs_upstream_history: fix get_recipe_pv_without_srcpv

Message ID 288b2eeba489d89fdcaf579bd7c8a712eb6711a4.1705341467.git.tim.orling@konsulko.com
State New
Headers show
Series [layerindex-web,1/6] rrs_maintainer_history: new override syntax | expand

Commit Message

Tim Orling Jan. 15, 2024, 6:03 p.m. UTC
The get_recipe_pv_without_srcpv function was renamed to
get_recipe_pv_with_pfx_sfx in:

84794b59 lib/oe/recipeutils.py: accommodate SRCPV being optional and deprecated in version check regex

Try to import/call the old method and fail over to the new method.

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
---
 rrs/tools/rrs_upstream_history.py | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/rrs/tools/rrs_upstream_history.py b/rrs/tools/rrs_upstream_history.py
index 25f4b20..bf32c5d 100755
--- a/rrs/tools/rrs_upstream_history.py
+++ b/rrs/tools/rrs_upstream_history.py
@@ -87,8 +87,11 @@  def set_regexes(d):
 
 def get_upstream_info(layerbranch, recipe_data, result):
     from bb.utils import vercmp_string
-    from oe.recipeutils import get_recipe_upstream_version, \
-            get_recipe_pv_without_srcpv
+    from oe.recipeutils import get_recipe_upstream_version
+    try:
+        from oe.recipeutils import get_recipe_pv_without_srcpv
+    except ImportError:
+        from oe.recipeutils import get_recipe_pv_with_pfx_sfx
 
     pn = recipe_data.getVar('PN', True)
 
@@ -109,10 +112,16 @@  def get_upstream_info(layerbranch, recipe_data, result):
         ru.type = ru_info['type']
         ru.date = ru_info['datetime']
 
-        pv, _, _ = get_recipe_pv_without_srcpv(recipe_pv,
-                get_pv_type(recipe_pv))
-        upv, _, _ = get_recipe_pv_without_srcpv(ru_info['version'],
-                get_pv_type(ru_info['version']))
+        try:
+            pv, _, _ = get_recipe_pv_without_srcpv(recipe_pv,
+                       get_pv_type(recipe_pv))
+            upv, _, _ = get_recipe_pv_without_srcpv(ru_info['version'],
+                        get_pv_type(ru_info['version']))
+        except NameError:
+            pv, _, _ = get_recipe_pv_with_pfx_sfx(recipe_pv,
+                       get_pv_type(recipe_pv))
+            upv, _, _ = get_recipe_pv_with_pfx_sfx(ru_info['version'],
+                        get_pv_type(ru_info['version']))
 
         if pv and upv:
             cmp_ver = vercmp_string(pv, upv)