From f69983dc0dbe4d68bcc2b5c8658807f483c263a3 Mon Sep 17 00:00:00 2001 From: licihua Date: Fri, 25 Mar 2022 10:43:09 +0800 Subject: [PATCH] change upgrade title, add repo name , version etc.[D --- advisors/oa_upgradable.py | 14 +++++++++----- advisors/simple_update_robot.py | 17 +++++++++++------ 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/advisors/oa_upgradable.py b/advisors/oa_upgradable.py index 6761fea6..ca4ceb68 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 5524c741..201e7694 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": -- Gitee