From b646bfcd94d8a08a73218434e19265c95be6a502 Mon Sep 17 00:00:00 2001 From: licihua Date: Fri, 5 Feb 2021 12:01:49 +0800 Subject: [PATCH] fix simple_update_robot command use wrong version bug,when the tags list is null --- advisors/oa_upgradable.py | 2 +- advisors/simple_update_robot.py | 7 +++++-- advisors/version_recommend.py | 7 ++++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/advisors/oa_upgradable.py b/advisors/oa_upgradable.py index cde171fa..af7abe5a 100755 --- a/advisors/oa_upgradable.py +++ b/advisors/oa_upgradable.py @@ -130,7 +130,7 @@ def main_process(push, default, repo): pkg_tags = get_ver_tags(user_gitee, repo, cwd_path=default) print("known release tags:", pkg_tags) - if pkg_tags is None: + if not pkg_tags: return None if cur_version not in pkg_tags: diff --git a/advisors/simple_update_robot.py b/advisors/simple_update_robot.py index cfbe413e..8fa497d3 100755 --- a/advisors/simple_update_robot.py +++ b/advisors/simple_update_robot.py @@ -425,11 +425,14 @@ def auto_update_pkg(gt_api, u_pkg, u_branch, u_ver=None): if not u_ver: pkg_tags = oa_upgradable.get_ver_tags(gt_api, u_pkg) - if pkg_tags is None: + if not pkg_tags: + print("WARNING: Can't get {} version list, stop upgrade.".format(u_pkg)) return ver_rec = version_recommend.VersionRecommend(pkg_tags, pkg_ver, 0) - + if not ver_rec: + print("WARNING: Can't get {} recommend version, stop upgrade.".format(u_pkg)) + return pkg_type = package_type.PackageType(u_pkg) if pkg_type.pkg_type == "core": diff --git a/advisors/version_recommend.py b/advisors/version_recommend.py index bd853b9c..1df17e58 100755 --- a/advisors/version_recommend.py +++ b/advisors/version_recommend.py @@ -263,6 +263,7 @@ class VersionTypeXYZW(VersionType): version = self.get_latest_version(version_candidate, 3) if version: return self._separator.join(version) + return current_version def __init__(self): @@ -775,11 +776,15 @@ class VersionRecommend(object): return True def _get_latest_version(self, version_entry): - if self.version_type is None: + if not version_entry: + return '' + if not self.version_type: return '' return self.version_type.latest_version(version_entry) def _get_maintain_version(self, version_entry, current_version, pkg_type): + if not version_entry: + return '' if self.version_type is None: return '' return self.version_type.maintain_version(version_entry, current_version, pkg_type) -- Gitee