diff --git a/advisors/check_abi.py b/advisors/check_abi.py index 0f6b05298ce66eb159f02af21dc93eb4df2a6a59..cc68e6aef917d2893158998df7da0d0742e06e9f 100755 --- a/advisors/check_abi.py +++ b/advisors/check_abi.py @@ -41,7 +41,7 @@ class CheckAbi(): def __init__(self, **config): self.work_path = config.get('work_path', "/var/tmp") - self.result_output_file = config.get('result_output_file', None) + self.result_output_file = config.get('result_output_file', "/var/tmp/result.md") self.show_all_info = config.get('show_all_info', False) self.input_rpms_path = config.get('input_rpms_path', False) self.target_sos = set() @@ -334,12 +334,13 @@ class CheckAbi(): for x in files_last_name] logging.debug("result_files:%s", result_files) - merged_file = os.path.join(self.work_path, "{}_all_result.md".format(base_name)) - if self.result_output_file: merged_file = os.path.abspath(self.result_output_file) + else: + merged_file = os.path.join(self.work_path, "{}_all_result.md".format(base_name)) + self.result_output_file = merged_file _ = [write_result(x, merged_file) for x in result_files] - logging.info("-------------all result write at:%s", merged_file) + logging.error("-------------all result write at:%s", merged_file) def process_effect_rpms(self, abs_dir, base_name): """ @@ -519,11 +520,14 @@ def write_result(result_file, merged_file): with open(result_file, "r") as fd_rest: lines = fd_rest.readlines() fd_rest.close() - ofile = open(merged_file, "a+") + outfile = open(merged_file, "a+") for line in lines: - ofile.write(line) - ofile.write("\n") - ofile.close() + outfile.write(line) + outfile.write("\n") + outfile.close() + else: + with open(merged_file, "a+") as outfile: + outfile.write("\n") def get_rpms_path(rpms_url, dest): diff --git a/advisors/simple_update_robot.py b/advisors/simple_update_robot.py index f00652a0d5a45e26c48a380e8b2a594c7ebec813..68eec0730cc5cce795a450d5a2a8314250981105 100755 --- a/advisors/simple_update_robot.py +++ b/advisors/simple_update_robot.py @@ -27,6 +27,7 @@ Expected process: import sys import re import time +import platform import json import shutil import os.path @@ -72,7 +73,7 @@ def download_helper(src_url, file_name=None): down_cnt = 0 while down_cnt < 2: down_cnt += 1 - if not subprocess.call(["timeout 15m wget -c {url} -O {name}".format(url=src_url, + if not subprocess.call(["timeout 15m wget -c {url} -O {name} -q".format(url=src_url, name=file_name)], shell=True): break return src_url @@ -329,19 +330,27 @@ def build_pkg(u_pkg, u_branch, obs_prj): "mv -v $file $newfile;done"], shell=True) #Build old version - if subprocess.call(["osc", "build", "standard_aarch64", "--clean"]): + if 'aarch64' in platform.machine(): + standard = 'standard_aarch64' + standard_path = 'standard_aarch64-aarch64' + else: + standard = 'standard_x86_64' + standard_path = 'standard_x86_64-x86_64' + + if subprocess.call(["osc", "build", '--no-verify', standard, "--clean"]): result = False else: result = True - rpmbuildpath = "/var/tmp/build-root/standard_aarch64-aarch64/home/abuild/rpmbuild/RPMS" + rpmbuildpath = "/var/tmp/build-root/{path}/home/abuild/rpmbuild/RPMS".format(path=standard_path) oldrpmpath = "/root/oldrpms" #Copy rpms to oldrpmpath from rpmbuildpath copyrpms(rpmbuildpath, oldrpmpath) #Build update version subprocess.call(["cp ../../{pkg}/* .".format(pkg=u_pkg)], shell=True) - if subprocess.call(["osc", "build", "standard_aarch64"]): + + if subprocess.call(["osc", "build", '--no-verify', standard]): result = False else: result = True @@ -412,7 +421,7 @@ def auto_update_pkg(gt_api, u_pkg, u_branch, u_ver=None): ver_rec = version_recommend.VersionRecommend(pkg_tags, pkg_ver, 0) - print("version_recommen ver_rec is :{}".format(ver_rec)) + pkg_type = package_type.PackageType(u_pkg) if pkg_type.pkg_type == "core": print("WARNING: {} is core package, if need upgrade, please specify "\ @@ -425,6 +434,7 @@ def auto_update_pkg(gt_api, u_pkg, u_branch, u_ver=None): u_ver = ver_rec.latest_version else: u_ver = ver_rec.maintain_version + print("version_recommen u_ver is :{}".format(u_ver)) if update_ver_check(u_pkg, pkg_ver, u_ver): fork_clone_repo(gt_api, u_pkg, u_branch) @@ -488,15 +498,17 @@ def check_rpm_abi(u_pkg): # check abi in old_rpm and new_rpm check_abi_file = check_abi.CheckAbi() - ret_abi = check_abi_file.process_with_rpm(rpms, debuginfos) - temp_abi_res = os.path.join(check_abi_file.work_path, "{}_all_result.md".format(u_pkg)) - ret_abi = os.path.join(check_abi_file.work_path, "{}_result.txt".format(u_pkg)) - joint_abi_rest(temp_abi_res, ret_abi) + check_abi_file.process_with_rpm(rpms, debuginfos) + + if not os.path.exists(check_abi_file.result_output_file): + return "" + ret_abi = os.path.join(check_abi_file.work_path, "{}_result.txt".format(u_pkg)) + joint_abi_rest(check_abi_file.result_output_file, ret_abi) # check command - ret_commd = check_command.process_check_command(rpms) - print("ret_commd is : {}".format(ret_commd)) - review_body = make_check_review(ret_conf, ret_commd, ret_abi) + ret_command = check_command.process_check_command(rpms) + print("ret_command is : {}".format(ret_command)) + review_body = make_check_review(ret_conf, ret_command, ret_abi) return review_body