From f762f9c1d68b61421d463717c2fae98480b79f56 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Wed, 4 Nov 2020 17:18:57 +0800 Subject: [PATCH] Bugfix and version recommend with package type 1.bugfix url for version control: hg and hg_raw 2.version recommend consider with package type Signed-off-by: Leo Fang --- advisors/check_upstream.py | 4 ++-- advisors/simple_update_robot.py | 14 ++++++++++++-- advisors/yaml2url.py | 4 ++-- tests/test_yaml2url.py | 4 ++-- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/advisors/check_upstream.py b/advisors/check_upstream.py index 46211a81..da6eea42 100755 --- a/advisors/check_upstream.py +++ b/advisors/check_upstream.py @@ -142,8 +142,8 @@ def check_hg_raw(info, clean_tag=True): for line in resp.splitlines(): tags.append(line.split()[0]) if clean_tag: - result_list = clean_tags(tags, info) - return result_list + tags = clean_tags(tags, info) + return tags def check_hg(info, clean_tag=True): diff --git a/advisors/simple_update_robot.py b/advisors/simple_update_robot.py index 42dd5310..9712ea06 100755 --- a/advisors/simple_update_robot.py +++ b/advisors/simple_update_robot.py @@ -40,6 +40,7 @@ from advisors import gitee from advisors import oa_upgradable from advisors import version_recommend from advisors import match_patches +from advisors import package_type def get_spec_path(gt_api, pkg): @@ -359,12 +360,21 @@ def auto_update_pkg(gt_api, u_pkg, u_branch, u_ver=None): pkg_tags = oa_upgradable.get_ver_tags(gt_api, u_pkg) if pkg_tags is None: return + ver_rec = version_recommend.VersionRecommend(pkg_tags, pkg_ver, 0) + pkg_type = package_type.PackageType(u_pkg) - if branch_info["recommend_type"] == "master": + if pkg_type.pkg_type == "core": + print("WARNING: {} is core package, if need upgrade, please specify "\ + "upgarde version for it.".format(u_pkg)) + return + if pkg_type.pkg_type == "app": u_ver = ver_rec.latest_version else: - u_ver = ver_rec.maintain_version + if branch_info["recommend_type"] == "master": + u_ver = ver_rec.latest_version + else: + u_ver = ver_rec.maintain_version if update_ver_check(u_pkg, pkg_ver, u_ver): fork_clone_repo(gt_api, u_pkg, u_branch) diff --git a/advisors/yaml2url.py b/advisors/yaml2url.py index 81276410..94647861 100755 --- a/advisors/yaml2url.py +++ b/advisors/yaml2url.py @@ -22,7 +22,7 @@ def __get_hg_url(pkg_info): """ Get hg repo url of package """ - url = urljoin(pkg_info["src_repo"] + "/", "raw-tags") + url = urljoin(pkg_info["src_repo"] + "/", "json-tags") return url @@ -30,7 +30,7 @@ def __get_hg_raw_url(pkg_info): """ Get hg raw repo url of package """ - url = urljoin(pkg_info["src_repo"] + "/", "json-tags") + url = urljoin(pkg_info["src_repo"] + "/", "raw-tags") return url diff --git a/tests/test_yaml2url.py b/tests/test_yaml2url.py index dc880da4..ac43c210 100644 --- a/tests/test_yaml2url.py +++ b/tests/test_yaml2url.py @@ -34,7 +34,7 @@ def test_get_hg_url(): pkg_info = yaml.load(doc, Loader=yaml.Loader) url = yaml2url.yaml2url(pkg_info) - assert url == "https://hg.mozilla.org/projects/python-nss/raw-tags" + assert url == "https://hg.mozilla.org/projects/python-nss/json-tags" def test_get_hg_raw_url(): @@ -46,7 +46,7 @@ def test_get_hg_raw_url(): pkg_info = yaml.load(doc, Loader=yaml.Loader) url = yaml2url.yaml2url(pkg_info) - assert url == "http://hg.libsdl.org/SDL/json-tags" + assert url == "http://hg.libsdl.org/SDL/raw-tags" def test_get_github_url(): -- Gitee