diff --git a/advisors/oa_upgradable.py b/advisors/oa_upgradable.py index 6761fea64d93cc1a78e5a270e3675425ae9cf0b1..ca4ceb6879ffd6c497fb0f25a0bdfe9357781e14 100755 --- a/advisors/oa_upgradable.py +++ b/advisors/oa_upgradable.py @@ -18,13 +18,13 @@ import os import sys import argparse import re +from datetime import datetime from pyrpm.spec import Spec, replace_macros import yaml from advisors import gitee from advisors import check_upstream from advisors import version_recommend -from datetime import datetime NEW_COMMENT = """Dear {repo} maintainer: @@ -163,7 +163,7 @@ def main_process(push, default, repo): if push: issues = user_gitee.get_issues(repo) for issue in issues: - if issue["title"] == "Upgrade to latest release": + if "Upgrade to latest release" in issue["title"]: need_push_issue = False ages = datetime.now() - user_gitee.get_gitee_datetime(issue["created_at"]) if ages.days <= 30: @@ -175,7 +175,10 @@ def main_process(push, default, repo): days=ages.days)) break if need_push_issue: - user_gitee.post_issue(repo, "Upgrade to latest release", """Dear {repo} maintainer: + tile = """Upgrade to latest release [{repo}: {cur_ver} -> {ver}]""".format(repo=repo, + ver=ver_rec.latest_version, + cur_ver=cur_version) + body = """Dear {repo} maintainer: We found the latest version of {repo} is {ver}, while the current version in openEuler mainline is {cur_ver}. @@ -186,9 +189,10 @@ 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=repo, ver=ver_rec.latest_version, - cur_ver=cur_version)) - return [repo, cur_version, ver_rec.latest_version] + cur_ver=cur_version) + user_gitee.post_issue(repo, tile, body) + return [repo, cur_version, ver_rec.latest_version] if __name__ == "__main__": diff --git a/advisors/simple_update_robot.py b/advisors/simple_update_robot.py index 5524c741c7855f803e590b77fe3d6aa8e7232d2e..201e76946192af68358a98fa4d68bea3ad885151 100755 --- a/advisors/simple_update_robot.py +++ b/advisors/simple_update_robot.py @@ -347,7 +347,10 @@ def build_pkg(u_pkg, u_branch, obs_prj): result = True rpmbuildpath = "/var/tmp/build-root/{path}/home/abuild/rpmbuild/RPMS".format(path=standard_path) - oldrpmpath = "/root/oldrpms" + + home_path = os.path.expanduser('~') + old_dir = os.path.join(home_path, 'oldrpms') + oldrpmpath = os.path.join(home_path, 'oldrpms') #Copy rpms to oldrpmpath from rpmbuildpath copyrpms(rpmbuildpath, oldrpmpath) @@ -358,8 +361,8 @@ def build_pkg(u_pkg, u_branch, obs_prj): result = False else: result = True - - newrpmpath = "/root/newrpms" + new_dir = os.path.join(home_path, 'newrpms') + newrpmpath = os.path.join(home_path, 'newrpms') #Copy rpms to newrpmpath from rpmbuildpath copyrpms(rpmbuildpath, newrpmpath) @@ -490,8 +493,9 @@ def check_rpm_abi(u_pkg): """ rpm check abi """ - old_dir = "/root/oldrpms" - new_dir = "/root/newrpms" + home_path = os.path.expanduser('~') + old_dir = os.path.join(home_path, 'oldrpms') + new_dir = os.path.join(home_path, 'newrpms') old_rpm_path = get_rpm_debug_path(u_pkg, old_dir) new_rpm_path = get_rpm_debug_path(u_pkg, new_dir) @@ -688,7 +692,8 @@ def main(): try: user_gitee = gitee.Gitee() except NameError: - sys.exit(1) + print('Error: create gitee failed', NameError) + exit() if args.update: if args.update == "repo":