diff --git a/advisors/check_upstream.py b/advisors/check_upstream.py index 7b91b8db1809c4241aa0bc268d6b36c76e4c7379..701f9ba5fcc269457751addc53577ad1b7b38126 100755 --- a/advisors/check_upstream.py +++ b/advisors/check_upstream.py @@ -248,6 +248,20 @@ def check_gnome(info): tags = clean_tags(tags, info) return tags +def check_gitee(info): + resp = load_last_query_result(info) + repo_url = "https://gitee.com/" + info["src_repo"] + if resp == "": + resp = __check_git_helper(repo_url) + last_query = {} + last_query["time_stamp"] = datetime.now() + last_query["raw_data"] = resp + info["last_query"] = last_query + + tags = __git_resp_to_tags(resp) + tags = clean_tags(tags, info) + return tags + def check_svn(info): resp = load_last_query_result(info) repo_url = info["src_repo"] + "/tags" diff --git a/advisors/oa_upgradable.py b/advisors/oa_upgradable.py index df9c8afe16a03b49d6a4d1c99ae21af38871ca74..7f5d49b6fa3fcbf1fb15185ffc3b228a76a10cf8 100755 --- a/advisors/oa_upgradable.py +++ b/advisors/oa_upgradable.py @@ -44,7 +44,7 @@ def get_ver_tags(gt, repo, cwd_path=None): try: repo_yaml = open(os.path.join(cwd_path, repo + ".yaml")).read() except FileNotFoundError: - print("Cann't find yaml metadata for {pkg} from current working directory.".format(pkg=repo)) + print("Cann't find yaml metadata for {pkg} from in {d}.".format(pkg=repo, d=cwd_path)) repo_yaml = gt.get_yaml(repo) else: repo_yaml = gt.get_yaml(repo) @@ -54,7 +54,10 @@ def get_ver_tags(gt, repo, cwd_path=None): else: return None - vc_type = pkg_info["version_control"] + vc_type = pkg_info.get("version_control", None) + if vc_type is None: + print("Missing version_control in YAML file") + return None if vc_type == "hg": tags = check_upstream.check_hg(pkg_info) elif vc_type == "github": @@ -69,8 +72,11 @@ def get_ver_tags(gt, repo, cwd_path=None): tags = check_upstream.check_metacpan(pkg_info) elif vc_type == "pypi": tags = check_upstream.check_pypi(pkg_info) + elif vc_type == "gitee": + tags = check_upstream.check_gitee(pkg_info) else: print("Unsupport version control method {vc}".format(vc=vc_type)) + return None excpt_list = _get_rec_excpt() if repo in excpt_list: @@ -89,6 +95,8 @@ if __name__ == "__main__": args = parameters.parse_args() + print("Checking", args.repo) + user_gitee = gitee.Gitee() spec_string = user_gitee.get_spec(args.repo) if not spec_string: @@ -98,15 +106,34 @@ if __name__ == "__main__": spec_file = Spec.from_string(spec_string) cur_version = replace_macros(spec_file.version, spec_file) - print("Checking ", args.repo) - print("current version is ", cur_version) + if cur_version.startswith('v') or cur_version.startswith('V'): + cur_version = cur_version[1:] + + print("Current version is", cur_version) pkg_tags = get_ver_tags(user_gitee, args.repo, args.default) print("known release tags:", pkg_tags) if pkg_tags is None: sys.exit(1) + + if cur_version not in pkg_tags: + print("WARNING: Current {ver} doesn't exist in upstream. Please double check.".format(ver=cur_version)) + ver_rec = version_recommend.VersionRecommend(pkg_tags, cur_version, 0) print("Latest version is", ver_rec.latest_version) print("Maintain version is", ver_rec.maintain_version) + + if cur_version != ver_rec.latest_version: + if args.push: + user_gitee.post_issue(args.repo, "Upgrade to latest release", """Dear {repo} maintainer: + +We found the latest version of {repo} is {ver}, while the current version in openEuler mainline is {cur_ver}. + +Please consider upgrading. + +Yours openEuler Advisor. + +If you think this is not proper issue, Please visit https://gitee.com/openeuler/openEuler-Advisor. +Issues and feedbacks are welcome.""".format(repo=args.repo, ver=ver_rec.latest_version, cur_ver=cur_version)) diff --git a/advisors/version_recommend.py b/advisors/version_recommend.py index 47468630018c7a2cc0ad37e3a0f25e782d04c73d..d3f915ca27233dae5043d18512b7b78f5291e53c 100755 --- a/advisors/version_recommend.py +++ b/advisors/version_recommend.py @@ -214,6 +214,9 @@ class VersionTypeXYZW(VersionType): version_list.append(re.split(r'[._-]', version)) # 将 version 拆分为列表,方便后续比较 x = '0' for version in version_list: # 第一轮比较取出最大的第一位 + if int(version[0]) > 1000: # consider it an useless exception + continue + if self._compare(x, version[0]) < 0: x = version[0] @@ -361,6 +364,8 @@ class VersionTypeXYZ(VersionType): version_list.append(re.split(r'[._-]', version)) # 将 version 拆分为列表,方便后续比较 x = '0' for version in version_list: # 第一轮比较取出最大的第一位 + if int(version[0]) > 1000: # consider it an useless exception + continue if self._compare(x, version[0]) < 0: x = version[0] @@ -464,6 +469,9 @@ class VersionTypeXY(VersionType): version_list.append(re.split(r'[._-]', version)) # 将 version 拆分为列表,方便后续比较 x = '0' for version in version_list: # 第一轮比较取出最大的第一位 + if int(version[0]) > 1000: # consider it an useless exception + continue + if self._compare(x, version[0]) < 0: x = version[0] @@ -576,6 +584,9 @@ class VersionTypeX(VersionType): version_list.append(re.split(r'[._-]', version)) # 将 version 拆分为列表,方便后续比较 x = '0' for version in version_list: # 第一轮比较取出最大的第一位 + if int(version[0]) > 1000: # consider it an useless exception + continue + if self._compare(x, version[0]) < 0: x = version[0] diff --git a/upstream-info/buildroot.yaml b/upstream-info/buildroot.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9ed9dded48a3fad5b4eb0e86a53d27db2e67e33e --- /dev/null +++ b/upstream-info/buildroot.yaml @@ -0,0 +1,4 @@ +version_control: git +src_repo: https://git.busybox.net/buildroot +tag_prefix: ^ +separator: . diff --git a/upstream-info/ca-certificates.yaml b/upstream-info/ca-certificates.yaml index c06cfed39ec9230994d2b7e41e1462cb2740673d..484b0e67f917b9d037d99e399eb48c7fb2c6df20 100644 --- a/upstream-info/ca-certificates.yaml +++ b/upstream-info/ca-certificates.yaml @@ -1,4 +1,5 @@ -version_control: git -src_repo: https://src.fedoraproject.org/rpms/ca-certificates.git -tag_prefix: -separator: +version_control: NA +src_repo: NA +tag_prefix: ca-certificates- +separator: "[-_]" +git_url: https://src.fedoraproject.org/rpms/ca-certificates.git diff --git a/upstream-info/crontabs.yaml b/upstream-info/crontabs.yaml index 45f8bf6ae73770f25a57af47ebaa1e60f0a2de80..5025d6850e8a7a7a620ac881a0ff915bf8748eb7 100644 --- a/upstream-info/crontabs.yaml +++ b/upstream-info/crontabs.yaml @@ -1,4 +1,4 @@ version_control: github src_repo: cronie-crond/crontabs tag_prefix: crontabs- -separator: "" +separator: "." diff --git a/upstream-info/dump.yaml b/upstream-info/dump.yaml index d19aac5c1c63c555118de3e982b2c3291743f0d5..815ed18da8acd78e104dc2ed99aa645fc213a121 100644 --- a/upstream-info/dump.yaml +++ b/upstream-info/dump.yaml @@ -1,4 +1,4 @@ version_control: git src_repo: https://git.code.sf.net/p/dump/code tag_prefix: "^v" -separator: "." +separator: "b" diff --git a/upstream-info/expat.yaml b/upstream-info/expat.yaml index df0ee78a70af5429f58b24dc9585295b6f78903a..7361d14ae8829d1af29060928bcf50bc187f22ad 100644 --- a/upstream-info/expat.yaml +++ b/upstream-info/expat.yaml @@ -1,4 +1,4 @@ version_control: github src_repo: libexpat/libexpat -tag_prefix: ^v -separator: . +tag_prefix: "^R_" +separator: _ diff --git a/upstream-info/kubernetes.yaml b/upstream-info/kubernetes.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ba98d69bb3a878ebc822df8e0f85e639e637f216 --- /dev/null +++ b/upstream-info/kubernetes.yaml @@ -0,0 +1,4 @@ +version_control: github +src_repo: kubernetes/kubernetes +tag_prefix: "^v" +separator: "." diff --git a/upstream-info/libdmapsharing.yaml b/upstream-info/libdmapsharing.yaml index 7a69a77d8d2844921e8477e0a3cacf167d6b99a8..6e251afaa5d09e27d6235347ed96bbdd1c983c8d 100644 --- a/upstream-info/libdmapsharing.yaml +++ b/upstream-info/libdmapsharing.yaml @@ -1,4 +1,4 @@ version_control: git src_repo: https://gitlab.gnome.org/GNOME/libdmapsharing.git -tag_prefix: LIBDMAPSHARING -separator: _ +tag_prefix: "^LIBDMAPSHARING_" +separator: "_" diff --git a/upstream-info/libevent.yaml b/upstream-info/libevent.yaml index 2ae88c97b514909e1067676ce610389195249b02..6491b4592074473bd7ceec3331095e8f51d33805 100644 --- a/upstream-info/libevent.yaml +++ b/upstream-info/libevent.yaml @@ -1,4 +1,4 @@ version_control: github src_repo: libevent/libevent -tag_prefix: ^v +tag_prefix: ^release- separator: . diff --git a/upstream-info/libgsf.yaml b/upstream-info/libgsf.yaml index f0a23447fa6b380a634d09d053b5b13edc52d7ab..811270e26b1523d793d9572c11754a9b72e16915 100644 --- a/upstream-info/libgsf.yaml +++ b/upstream-info/libgsf.yaml @@ -1,7 +1,7 @@ --- version_control: gitlab.gnome src_repo: libgsf -tag_prefix: LIBGSF +tag_prefix: LIBGSF_ separator: _ last_query: time_stamp: 2020-04-24 13:57:08.807496280 +00:00 diff --git a/upstream-info/libmikmod.yaml b/upstream-info/libmikmod.yaml index 7becfb2b21d1c841aff8bec8565dd16b7334c8e2..b8e1b485d4e8963ecb2942af4e724ccc0d6674ae 100644 --- a/upstream-info/libmikmod.yaml +++ b/upstream-info/libmikmod.yaml @@ -1,4 +1,4 @@ version_control: git src_repo: https://git.code.sf.net/p/mikmod/mikmod -tag_prefix: ^ +tag_prefix: ^libmikmod- separator: . diff --git a/upstream-info/libnftnl.yaml b/upstream-info/libnftnl.yaml index ed940ab2d51d13c5c025290efb4ace8e1f19b15c..df9c83808ee51d00f8c54fdcf711e2134e836b61 100644 --- a/upstream-info/libnftnl.yaml +++ b/upstream-info/libnftnl.yaml @@ -1,4 +1,4 @@ version_control: git src_repo: https://git.netfilter.org/libnftnl -tag_prefix: ^libbftnl- +tag_prefix: ^libnftnl- separator: . diff --git a/upstream-info/libsamplerate.yaml b/upstream-info/libsamplerate.yaml new file mode 100644 index 0000000000000000000000000000000000000000..89e40825cadcf7b7558f929697a3d39e1fb954a1 --- /dev/null +++ b/upstream-info/libsamplerate.yaml @@ -0,0 +1,5 @@ +git_url: https://github.com/erikd/libsamplerate +version_control: NA +src_repo: erikd/libsamplerate +tag_prefix: NA +separator: NA diff --git a/upstream-info/mod_security_crs.yaml b/upstream-info/mod_security_crs.yaml index 7ef7d45ca740c6864eb2d6054dff2ec29086c623..2c7effa4586283ae4cab26265fbab0f9e12beda6 100644 --- a/upstream-info/mod_security_crs.yaml +++ b/upstream-info/mod_security_crs.yaml @@ -1,4 +1,4 @@ version_control: github src_repo: coreruleset/coreruleset -tag_prefix: ^ +tag_prefix: ^v separator: . diff --git a/upstream-info/mpfr.yaml b/upstream-info/mpfr.yaml index 85207228036fd268fee5348ba3ed2727b956591a..69271ad3c9cacec1f835f19ac09bfd007c088a31 100644 --- a/upstream-info/mpfr.yaml +++ b/upstream-info/mpfr.yaml @@ -1,4 +1,4 @@ version_control: svn -src_repo: https://scm.gforge.inria.fr/anonscm/svn/mpfr/tags +src_repo: https://scm.gforge.inria.fr/anonscm/svn/mpfr tag_prefix: separator: . diff --git a/upstream-info/python2.yaml b/upstream-info/python2.yaml index 97065dcc6d23e040835cd7cd0015adb6ab747068..50c0ac1d35d7b2dffb6f0fb940067dd7dfa37037 100644 --- a/upstream-info/python2.yaml +++ b/upstream-info/python2.yaml @@ -2,5 +2,5 @@ version_control: github src_repo: python/cpython tag_prefix: "^v?3*|^v" -seperator: "." +separator: "." url: https://github.com/python/cpython.git diff --git a/upstream-info/python3.yaml b/upstream-info/python3.yaml index a1ad3009dd64034ed7b97d345bfab9f0241792d6..77df83916f4adb147d6117005f528aebf5e5c643 100644 --- a/upstream-info/python3.yaml +++ b/upstream-info/python3.yaml @@ -2,5 +2,5 @@ version_control: github src_repo: python/cpython tag_prefix: "^v" -seperator: "." +separator: "." url: https://github.com/python/cpython.git diff --git a/upstream-info/rust.yaml b/upstream-info/rust.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f8e2e1d8db410105c3c1988bed52d72737075483 --- /dev/null +++ b/upstream-info/rust.yaml @@ -0,0 +1,4 @@ +version_control: github +src_repo: rust-lang/rust +tag_prefix: release- +separator: "." diff --git a/upstream-info/stax-ex.yaml b/upstream-info/stax-ex.yaml new file mode 100644 index 0000000000000000000000000000000000000000..097d30f04f7e65725aaac39c06f90e603e9dd4a5 --- /dev/null +++ b/upstream-info/stax-ex.yaml @@ -0,0 +1,4 @@ +version_control: github +src_repo: javaee/metro-stax-ex +tag_prefix: ^stax-ex- +separator: .