Skip to contentSkip to conversation

recipeutils.py: add optional same_major_version parameter to get_recipe_upgrade_status

RFC PATCH Superseded [email protected] 1 participant 1 message Apr 29

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 recipeutils.py: add optional same_major_version parameter to get_recipe_upgrade_status

From: Chen Qi <[email protected]>

We want have the ability to do LTS package upgrades. So we need to add an optional same_major_version parameter to get_recipe_upgrade_status. When enabled, the version with the same major version will be reported.

---
 meta/lib/oe/recipeutils.py | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
meta/lib/oe/recipeutils.py +15 -6
index c6604f536d..495ca40133 100644
@@ -1009,7 +1009,11 @@ def get_recipe_pv_with_pfx_sfx(pv, uri_type):
 
     return (pv, pfx, sfx)
 
-def get_recipe_upstream_version(rd):
+def get_major_version(pv):
+    major_version = '.'.join(pv.split('.')[:-1])
+    return major_version
+
+def get_recipe_upstream_version(rd, same_major_version=False):
     """
         Get upstream version of recipe using bb.fetch2 methods with support for
         http, https, ftp and git.
@@ -1080,7 +1084,10 @@ def get_recipe_upstream_version(rd):
             except bb.fetch2.FetchError as e:
                 bb.warn("Unable to obtain latest revision: {}".format(e))
         else:
-            pupver = ud.method.latest_versionstring(ud, rd)
+            if same_major_version:
+                pupver = ud.method.latest_versionstring(ud, rd, major_version=get_major_version(ru['current_version']))
+            else:
+                pupver = ud.method.latest_versionstring(ud, rd)
             (upversion, revision) = pupver
 
         if upversion:
@@ -1094,8 +1101,8 @@ def get_recipe_upstream_version(rd):
 
     return ru
 
-def _get_recipe_upgrade_status(data):
-    uv = get_recipe_upstream_version(data)
+def _get_recipe_upgrade_status(data, same_major_version):
+    uv = get_recipe_upstream_version(data, same_major_version=same_major_version)
 
     pn = data.getVar('PN')
     cur_ver = uv['current_version']
@@ -1119,9 +1126,10 @@ def _get_recipe_upgrade_status(data):
 
     return {'pn':pn, 'status':status, 'cur_ver':cur_ver, 'next_ver':next_ver, 'maintainer':maintainer, 'revision':revision, 'no_upgrade_reason':no_upgrade_reason}
 
-def get_recipe_upgrade_status(recipes=None):
+def get_recipe_upgrade_status(recipes=None, same_major_version=False):
     pkgs_list = []
     data_copy_list = []
+    mv_copy_list = []
     copy_vars = ('SRC_URI',
                  'PV',
                  'DL_DIR',
@@ -1180,12 +1188,13 @@ def get_recipe_upgrade_status(recipes=None):
                     data_copy.setVar(k, data.getVar(k))
 
             data_copy_list.append(data_copy)
+            mv_copy_list.append(same_major_version)
 
             recipeincludes[data.getVar('FILE')] = {'bbincluded':data.getVar('BBINCLUDED').split(),'pn':data.getVar('PN')}
 
     from concurrent.futures import ProcessPoolExecutor
     with ProcessPoolExecutor(max_workers=utils.cpu_count()) as executor:
-        pkgs_list = executor.map(_get_recipe_upgrade_status, data_copy_list)
+        pkgs_list = executor.map(_get_recipe_upgrade_status, data_copy_list, mv_copy_list)
 
     return _group_recipes(pkgs_list, _get_common_include_recipes(recipeincludes))
 
Signature · 1 line
2.34.1