From faee5cc6e1abf8458d891f9868341775dcc443d6 Mon Sep 17 00:00:00 2001
From: MementoMori <1003350679@qq.com>
Date: Fri, 16 Jun 2023 15:39:32 +0800
Subject: [PATCH 01/16] gitee_comment.py
---
src/build/gitee_comment.py | 113 +++++++++++++++++++++++--------------
src/lib/comment.sh | 4 +-
2 files changed, 74 insertions(+), 43 deletions(-)
diff --git a/src/build/gitee_comment.py b/src/build/gitee_comment.py
index 8b7d775..fa41974 100755
--- a/src/build/gitee_comment.py
+++ b/src/build/gitee_comment.py
@@ -53,20 +53,20 @@ class Comment(object):
self.compare_package_result = {}
self.check_item_result = {}
- @staticmethod
- def _get_rpm_name(rpm):
+ def _get_dict(self, key_list, data):
"""
- 返回rpm包名称
- :param rpm:
+ 获取字典value
+ :param key_list: key列表
+ :param data: 字典
:return:
"""
- rpm_name = re.match(r"^(.+)-.+-.+", rpm)
-
- if rpm_name:
- return rpm_name.group(1)
- else:
- logger.error(f"Prase rpm name error: {rpm}")
- return rpm
+ value = data
+ for key in key_list:
+ if value and isinstance(value, dict):
+ value = value.get(key)
+ else:
+ return None
+ return value
def comment_build(self, gitee_proxy):
"""
@@ -271,50 +271,81 @@ class Comment(object):
name, _ = JenkinsProxy.get_job_path_build_no_from_build_url(build["url"])
status = build["result"]
ac_result = ACResult.get_instance(status)
- build_url = build["url"]
+
if "x86-64" in name:
arch = "x86_64"
elif "aarch64" in name:
arch = "aarch64"
else:
arch = name.split("/")[-2]
- arch_dict = {}
- check_item_result = {}
+
for check_item_comment_file in self._check_item_comment_files:
+ all_data = {}
if not os.path.exists(check_item_comment_file):
logger.info("%s not exists", check_item_comment_file)
continue
- if ACResult.get_instance(status) == SUCCESS and match(name, check_item_comment_file): # 保证build状态成功
- with open(check_item_comment_file, "r") as f:
+ # if ACResult.get_instance(status) == SUCCESS and match(name, check_item_comment_file): # 保证build状态成功
+ if match(name, check_item_comment_file):
+ with open(check_item_comment_file, "r") as data:
try:
- content = yaml.safe_load(f)
- except YAMLError: # yaml base exception
- logger.exception("illegal yaml format of check item comment file ")
- logger.debug("comment: %s", content)
- for item in content:
- check_item_result[item.get("name")] = ACResult.get_instance(item.get("result"))
- break
- item_num = 1 + len(check_item_result)
- if os.path.exists("support_arch"):
- with open("support_arch", "r") as s_file:
- if arch not in s_file.readline():
- ac_result = ACResult.get_instance("EXCLUDE")
- item_num = 2
- comments.append("
{} | {} | {}{} | " \
- "#{} |
".format(
- item_num, arch, "check_build", ac_result.emoji, ac_result.hint, item_num,
- "{}{}".format(build_url, "console"), build["number"]))
- arch_dict["check_build"] = ac_result.hint
- if ac_result.hint == "EXCLUDE":
- comments.append("{} | {}{} | ".format(
- "check_install", ac_result.emoji, ac_result.hint))
- arch_dict["check_install"] = ac_result.hint
- else:
- for check_item, check_result in check_item_result.items():
+ all_data = json.load(data)
+ except json.decode.JSONDecodeError:
+ logger.error("%s is not an illegal json file", os.path.basename(check_item_comment_file))
+ comment = self._comment_of_combine_item(all_data, arch, build, ac_result)
+ comments.extend(comment)
+ return comments
+
+ def _comment_of_combine_item(self, all_data, arch, build, ac_result):
+ """
+ check item combine comment
+ :param all_data:
+ :param arch:
+ :param build:
+ :return:
+ """
+ comments = []
+ arch_dict = {}
+
+ check_item_info = {}
+ if all_data:
+ single_build_result = self._get_dict(["single_build_check", "current_result"], all_data)
+ check_item_info["single_install"] = self._get_dict(["single_install_check",
+ "current_result"], all_data)
+ else:
+ single_build_result = build["result"]
+ logger.info(f"single_build_result:{single_build_result}")
+ logger.info(f"check_item_info:{check_item_info}")
+
+ if os.path.exists("support_arch"):
+ with open("support_arch", "r") as s_file:
+ if arch not in s_file.readline():
+ ac_result = ACResult.get_instance("EXCLUDE")
+ item_num = 2
+ else:
+ ac_result = ACResult.get_instance(single_build_result)
+ item_num = len(check_item_info) - list(check_item_info.values()).count(None) + 1
+ else:
+ ac_result = ACResult.get_instance(single_build_result)
+ item_num = len(check_item_info) - list(check_item_info.values()).count(None) + 1
+
+ comments.append("
{} | {} | {}{} | " \
+ "#{} |
".format(
+ item_num, arch, "check_build", ac_result.emoji, ac_result.hint, item_num,
+ "{}{}".format(build["url"], "console"), build["number"]))
+ arch_dict["check_build"] = ac_result.hint
+
+ if ac_result.hint == "EXCLUDE":
+ comments.append("{} | {}{} | ".format(
+ "check_install", ac_result.emoji, ac_result.hint))
+ arch_dict["check_install"] = ac_result.hint
+ else:
+ for check_item, check_result in check_item_info.items():
+ if check_result:
+ check_result = ACResult.get_instance(check_result)
comments.append("
{} | {}{} | ".format(
check_item, check_result.emoji, check_result.hint))
arch_dict[check_item] = check_result.hint
- self.check_item_result[arch] = arch_dict
+ self.check_item_result[arch] = arch_dict
logger.info("check item comment: %s", comments)
return comments
diff --git a/src/lib/comment.sh b/src/lib/comment.sh
index 62005d9..60a3fe8 100644
--- a/src/lib/comment.sh
+++ b/src/lib/comment.sh
@@ -23,8 +23,8 @@ config_debug_variable
function clearn_env() {
log_info "***** Start to clearn env *****"
# download compare package comment files
- check_item_comment_aarch64="${repo}_${prid}_aarch64_comment"
- check_item_comment_x86="${repo}_${prid}_x86_64_comment"
+ check_item_comment_aarch64="${repo}_aarch64_${prid}_buildinfo"
+ check_item_comment_x86="${repo}_x86_64_${prid}_buildinfo"
#cat $compare_package_comment_x86
compare_package_result_aarch64="${repo}_${prid}_aarch64_compare_result"
compare_package_result_x86="${repo}_${prid}_x86_64_compare_result"
--
Gitee
From 6d5bd7e40fa738f28073734e78c34ebf58e05606 Mon Sep 17 00:00:00 2001
From: MementoMori <1003350679@qq.com>
Date: Fri, 16 Jun 2023 16:22:08 +0800
Subject: [PATCH 02/16] gitee_comment.py
---
src/build/gitee_comment.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/build/gitee_comment.py b/src/build/gitee_comment.py
index fa41974..5d13afc 100755
--- a/src/build/gitee_comment.py
+++ b/src/build/gitee_comment.py
@@ -309,13 +309,12 @@ class Comment(object):
check_item_info = {}
if all_data:
single_build_result = self._get_dict(["single_build_check", "current_result"], all_data)
- check_item_info["single_install"] = self._get_dict(["single_install_check",
+ check_item_info["check_install"] = self._get_dict(["single_install_check",
"current_result"], all_data)
else:
single_build_result = build["result"]
logger.info(f"single_build_result:{single_build_result}")
logger.info(f"check_item_info:{check_item_info}")
-
if os.path.exists("support_arch"):
with open("support_arch", "r") as s_file:
if arch not in s_file.readline():
--
Gitee
From b6a4473cec94d9b1607f9ea29b343ffb3b1c9898 Mon Sep 17 00:00:00 2001
From: MementoMori <1003350679@qq.com>
Date: Mon, 19 Jun 2023 09:19:33 +0800
Subject: [PATCH 03/16] gitee_comment.py
---
src/lib/comment.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lib/comment.sh b/src/lib/comment.sh
index 60a3fe8..62005d9 100644
--- a/src/lib/comment.sh
+++ b/src/lib/comment.sh
@@ -23,8 +23,8 @@ config_debug_variable
function clearn_env() {
log_info "***** Start to clearn env *****"
# download compare package comment files
- check_item_comment_aarch64="${repo}_aarch64_${prid}_buildinfo"
- check_item_comment_x86="${repo}_x86_64_${prid}_buildinfo"
+ check_item_comment_aarch64="${repo}_${prid}_aarch64_comment"
+ check_item_comment_x86="${repo}_${prid}_x86_64_comment"
#cat $compare_package_comment_x86
compare_package_result_aarch64="${repo}_${prid}_aarch64_compare_result"
compare_package_result_x86="${repo}_${prid}_x86_64_compare_result"
--
Gitee
From a1fcda3a6497c38d6ec9e1bdcbad49357fd9d4c3 Mon Sep 17 00:00:00 2001
From: MementoMori <1003350679@qq.com>
Date: Mon, 19 Jun 2023 16:30:17 +0800
Subject: [PATCH 04/16] gitee_comment.py
---
src/build/gitee_comment.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/build/gitee_comment.py b/src/build/gitee_comment.py
index 5d13afc..5cd0ac1 100755
--- a/src/build/gitee_comment.py
+++ b/src/build/gitee_comment.py
@@ -278,7 +278,7 @@ class Comment(object):
arch = "aarch64"
else:
arch = name.split("/")[-2]
-
+ logger.info(f"comment_files:{self._check_item_comment_files}")
for check_item_comment_file in self._check_item_comment_files:
all_data = {}
if not os.path.exists(check_item_comment_file):
--
Gitee
From 07d83a987e043fa9e6ff4abd75db3f08ff9d18f6 Mon Sep 17 00:00:00 2001
From: MementoMori <1003350679@qq.com>
Date: Mon, 19 Jun 2023 17:03:43 +0800
Subject: [PATCH 05/16] gitee_comment.py
---
src/build/gitee_comment.py | 2 +-
src/utils/compare_package.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/build/gitee_comment.py b/src/build/gitee_comment.py
index 5cd0ac1..0bc7527 100755
--- a/src/build/gitee_comment.py
+++ b/src/build/gitee_comment.py
@@ -289,7 +289,7 @@ class Comment(object):
with open(check_item_comment_file, "r") as data:
try:
all_data = json.load(data)
- except json.decode.JSONDecodeError:
+ except json.decoder.JSONDecodeError:
logger.error("%s is not an illegal json file", os.path.basename(check_item_comment_file))
comment = self._comment_of_combine_item(all_data, arch, build, ac_result)
comments.extend(comment)
diff --git a/src/utils/compare_package.py b/src/utils/compare_package.py
index 6c9731c..3c32132 100644
--- a/src/utils/compare_package.py
+++ b/src/utils/compare_package.py
@@ -236,7 +236,7 @@ class ComparePackage(object):
with open(json_file, "r") as data:
try:
all_data = json.load(data)
- except json.decode.JSONDecodeError:
+ except json.decoder.JSONDecodeError:
self.logger.error("%s is not an illegal json file", os.path.basename(json_file))
return status, all_data
try:
--
Gitee
From 95c45c707782693569d60cbfd0704b05deb81d23 Mon Sep 17 00:00:00 2001
From: MementoMori <1003350679@qq.com>
Date: Mon, 19 Jun 2023 17:39:06 +0800
Subject: [PATCH 06/16] gitee_comment.py
---
src/build/gitee_comment.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/build/gitee_comment.py b/src/build/gitee_comment.py
index 0bc7527..464bd7e 100755
--- a/src/build/gitee_comment.py
+++ b/src/build/gitee_comment.py
@@ -288,9 +288,13 @@ class Comment(object):
if match(name, check_item_comment_file):
with open(check_item_comment_file, "r") as data:
try:
- all_data = json.load(data)
- except json.decoder.JSONDecodeError:
- logger.error("%s is not an illegal json file", os.path.basename(check_item_comment_file))
+ all_data = yaml.safe_load(data)
+ except YAMLError: # yaml base exception
+ logger.exception(f"{os.path.basename(check_item_comment_file)} is an illegal yaml format of check item comment file ")
+ # try:
+ # all_data = json.load(data)
+ # except json.decoder.JSONDecodeError:
+ # logger.error("%s is not an illegal json file", os.path.basename(check_item_comment_file))
comment = self._comment_of_combine_item(all_data, arch, build, ac_result)
comments.extend(comment)
return comments
--
Gitee
From 1ad74835848b5c2686e82af0e065fe3e0e875c89 Mon Sep 17 00:00:00 2001
From: MementoMori <1003350679@qq.com>
Date: Tue, 20 Jun 2023 08:38:56 +0800
Subject: [PATCH 07/16] gitee_comment.py
---
src/build/gitee_comment.py | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/build/gitee_comment.py b/src/build/gitee_comment.py
index 464bd7e..d923b7d 100755
--- a/src/build/gitee_comment.py
+++ b/src/build/gitee_comment.py
@@ -266,7 +266,7 @@ class Comment(object):
if "x86-64" in name and "x86_64" in comment_file:
return True
return False
-
+ logger.info(f"BUILDS:{builds}")
for build in builds:
name, _ = JenkinsProxy.get_job_path_build_no_from_build_url(build["url"])
status = build["result"]
@@ -287,14 +287,14 @@ class Comment(object):
# if ACResult.get_instance(status) == SUCCESS and match(name, check_item_comment_file): # 保证build状态成功
if match(name, check_item_comment_file):
with open(check_item_comment_file, "r") as data:
- try:
- all_data = yaml.safe_load(data)
- except YAMLError: # yaml base exception
- logger.exception(f"{os.path.basename(check_item_comment_file)} is an illegal yaml format of check item comment file ")
# try:
- # all_data = json.load(data)
- # except json.decoder.JSONDecodeError:
- # logger.error("%s is not an illegal json file", os.path.basename(check_item_comment_file))
+ # all_data = yaml.safe_load(data)
+ # except YAMLError: # yaml base exception
+ # logger.exception(f"{os.path.basename(check_item_comment_file)} is an illegal yaml format of check item comment file ")
+ try:
+ all_data = json.load(data)
+ except json.decoder.JSONDecodeError:
+ logger.error("%s is not an illegal json file", os.path.basename(check_item_comment_file))
comment = self._comment_of_combine_item(all_data, arch, build, ac_result)
comments.extend(comment)
return comments
--
Gitee
From 2433237e68743954ab3e61ecbe09f8225ef24f5a Mon Sep 17 00:00:00 2001
From: MementoMori <1003350679@qq.com>
Date: Tue, 20 Jun 2023 09:00:30 +0800
Subject: [PATCH 08/16] gitee_comment.py
---
src/build/gitee_comment.py | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/src/build/gitee_comment.py b/src/build/gitee_comment.py
index d923b7d..f9d3206 100755
--- a/src/build/gitee_comment.py
+++ b/src/build/gitee_comment.py
@@ -266,7 +266,6 @@ class Comment(object):
if "x86-64" in name and "x86_64" in comment_file:
return True
return False
- logger.info(f"BUILDS:{builds}")
for build in builds:
name, _ = JenkinsProxy.get_job_path_build_no_from_build_url(build["url"])
status = build["result"]
@@ -287,36 +286,34 @@ class Comment(object):
# if ACResult.get_instance(status) == SUCCESS and match(name, check_item_comment_file): # 保证build状态成功
if match(name, check_item_comment_file):
with open(check_item_comment_file, "r") as data:
- # try:
- # all_data = yaml.safe_load(data)
- # except YAMLError: # yaml base exception
- # logger.exception(f"{os.path.basename(check_item_comment_file)} is an illegal yaml format of check item comment file ")
try:
- all_data = json.load(data)
- except json.decoder.JSONDecodeError:
+ yaml_data = yaml.safe_load(data)
+ json_data = json.load(data)
+ except (json.decoder.JSONDecodeError, YAMLError):
logger.error("%s is not an illegal json file", os.path.basename(check_item_comment_file))
- comment = self._comment_of_combine_item(all_data, arch, build, ac_result)
+ comment = self._comment_of_combine_item(json_data, yaml_data, arch, build, ac_result)
comments.extend(comment)
return comments
- def _comment_of_combine_item(self, all_data, arch, build, ac_result):
+ def _comment_of_combine_item(self, json_data, yaml_data, arch, build, ac_result):
"""
check item combine comment
- :param all_data:
+ :param json_data:
+ :param yaml_data:
:param arch:
:param build:
:return:
"""
comments = []
arch_dict = {}
-
check_item_info = {}
- if all_data:
+ if json_data:
single_build_result = self._get_dict(["single_build_check", "current_result"], all_data)
check_item_info["check_install"] = self._get_dict(["single_install_check",
"current_result"], all_data)
else:
single_build_result = build["result"]
+ check_item_info["check_install"] = yaml_data["check_install"]
logger.info(f"single_build_result:{single_build_result}")
logger.info(f"check_item_info:{check_item_info}")
if os.path.exists("support_arch"):
--
Gitee
From 9d88dacb40e72d618e10b55f23a7876e30923a76 Mon Sep 17 00:00:00 2001
From: MementoMori <1003350679@qq.com>
Date: Tue, 20 Jun 2023 09:00:56 +0800
Subject: [PATCH 09/16] gitee_comment.py
---
src/build/gitee_comment.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/build/gitee_comment.py b/src/build/gitee_comment.py
index f9d3206..e7fa4cd 100755
--- a/src/build/gitee_comment.py
+++ b/src/build/gitee_comment.py
@@ -308,9 +308,9 @@ class Comment(object):
arch_dict = {}
check_item_info = {}
if json_data:
- single_build_result = self._get_dict(["single_build_check", "current_result"], all_data)
+ single_build_result = self._get_dict(["single_build_check", "current_result"], json_data)
check_item_info["check_install"] = self._get_dict(["single_install_check",
- "current_result"], all_data)
+ "current_result"], json_data)
else:
single_build_result = build["result"]
check_item_info["check_install"] = yaml_data["check_install"]
--
Gitee
From aa95592a7ac3bab3c84a056d60c511901f06abde Mon Sep 17 00:00:00 2001
From: MementoMori <1003350679@qq.com>
Date: Tue, 20 Jun 2023 10:11:34 +0800
Subject: [PATCH 10/16] gitee_comment.py
---
src/build/gitee_comment.py | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/build/gitee_comment.py b/src/build/gitee_comment.py
index e7fa4cd..3d62602 100755
--- a/src/build/gitee_comment.py
+++ b/src/build/gitee_comment.py
@@ -287,10 +287,18 @@ class Comment(object):
if match(name, check_item_comment_file):
with open(check_item_comment_file, "r") as data:
try:
- yaml_data = yaml.safe_load(data)
json_data = json.load(data)
- except (json.decoder.JSONDecodeError, YAMLError):
+ except json.decoder.JSONDecodeError:
logger.error("%s is not an illegal json file", os.path.basename(check_item_comment_file))
+ json_data = None
+ with open(check_item_comment_file, "r") as data:
+ try:
+ yaml_data = yaml.safe_load(data)
+ except YAMLError:
+ logger.error("%s is not an illegal yaml file",
+ os.path.basename(check_item_comment_file))
+ else:
+ yaml_data = None
comment = self._comment_of_combine_item(json_data, yaml_data, arch, build, ac_result)
comments.extend(comment)
return comments
@@ -313,7 +321,7 @@ class Comment(object):
"current_result"], json_data)
else:
single_build_result = build["result"]
- check_item_info["check_install"] = yaml_data["check_install"]
+ check_item_info["check_install"] = yaml_data[0]["check_install"]
logger.info(f"single_build_result:{single_build_result}")
logger.info(f"check_item_info:{check_item_info}")
if os.path.exists("support_arch"):
--
Gitee
From 9070dd8e5b97cf9cd382e65e9e210b466e531896 Mon Sep 17 00:00:00 2001
From: MementoMori <1003350679@qq.com>
Date: Tue, 20 Jun 2023 10:30:19 +0800
Subject: [PATCH 11/16] gitee_comment.py
---
src/build/gitee_comment.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/build/gitee_comment.py b/src/build/gitee_comment.py
index 3d62602..5f480cb 100755
--- a/src/build/gitee_comment.py
+++ b/src/build/gitee_comment.py
@@ -321,7 +321,7 @@ class Comment(object):
"current_result"], json_data)
else:
single_build_result = build["result"]
- check_item_info["check_install"] = yaml_data[0]["check_install"]
+ check_item_info["check_install"] = yaml_data[0]["result"]
logger.info(f"single_build_result:{single_build_result}")
logger.info(f"check_item_info:{check_item_info}")
if os.path.exists("support_arch"):
--
Gitee
From 52cb14e7a0b878e24aa1994acbb62d6fb27c1dcb Mon Sep 17 00:00:00 2001
From: MementoMori <1003350679@qq.com>
Date: Mon, 17 Jul 2023 10:21:38 +0800
Subject: [PATCH 12/16] gitee_comment.py
---
src/build/gitee_comment.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/build/gitee_comment.py b/src/build/gitee_comment.py
index 5f480cb..1026bc7 100755
--- a/src/build/gitee_comment.py
+++ b/src/build/gitee_comment.py
@@ -266,6 +266,14 @@ class Comment(object):
if "x86-64" in name and "x86_64" in comment_file:
return True
return False
+
+ check_branches = None
+ if os.path.exists('check_build.yaml'):
+ with open('check_build.yaml', 'r') as f:
+ check_branches = yaml.safe_load(f)
+ tbranch = os.getenv('tbranch')
+ if check_branches and tbranch not in check_branches.keys():
+ return comments
for build in builds:
name, _ = JenkinsProxy.get_job_path_build_no_from_build_url(build["url"])
status = build["result"]
@@ -277,6 +285,11 @@ class Comment(object):
arch = "aarch64"
else:
arch = name.split("/")[-2]
+ if check_branches:
+ arches = check_branches.get(tbranch)
+ if arches:
+ if arch in arches.keys() and not arches.get(arch):
+ continue
logger.info(f"comment_files:{self._check_item_comment_files}")
for check_item_comment_file in self._check_item_comment_files:
all_data = {}
--
Gitee
From f322db109e4a0f25830b6fce9813207804ddb201 Mon Sep 17 00:00:00 2001
From: MementoMori <1003350679@qq.com>
Date: Mon, 17 Jul 2023 10:25:05 +0800
Subject: [PATCH 13/16] gitee_comment.py
---
src/build/gitee_comment.py | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/build/gitee_comment.py b/src/build/gitee_comment.py
index 1026bc7..957d6bf 100755
--- a/src/build/gitee_comment.py
+++ b/src/build/gitee_comment.py
@@ -290,9 +290,7 @@ class Comment(object):
if arches:
if arch in arches.keys() and not arches.get(arch):
continue
- logger.info(f"comment_files:{self._check_item_comment_files}")
for check_item_comment_file in self._check_item_comment_files:
- all_data = {}
if not os.path.exists(check_item_comment_file):
logger.info("%s not exists", check_item_comment_file)
continue
--
Gitee
From 86e91de64e5c4fc07ec6aac229c488dc6e14eee1 Mon Sep 17 00:00:00 2001
From: MementoMori <1003350679@qq.com>
Date: Mon, 17 Jul 2023 14:40:38 +0800
Subject: [PATCH 14/16] gitee_comment.py
---
src/build/gitee_comment.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/build/gitee_comment.py b/src/build/gitee_comment.py
index 957d6bf..99f446c 100755
--- a/src/build/gitee_comment.py
+++ b/src/build/gitee_comment.py
@@ -310,8 +310,8 @@ class Comment(object):
os.path.basename(check_item_comment_file))
else:
yaml_data = None
- comment = self._comment_of_combine_item(json_data, yaml_data, arch, build, ac_result)
- comments.extend(comment)
+ comment = self._comment_of_combine_item(json_data, yaml_data, arch, build, ac_result)
+ comments.extend(comment)
return comments
def _comment_of_combine_item(self, json_data, yaml_data, arch, build, ac_result):
@@ -330,9 +330,11 @@ class Comment(object):
single_build_result = self._get_dict(["single_build_check", "current_result"], json_data)
check_item_info["check_install"] = self._get_dict(["single_install_check",
"current_result"], json_data)
- else:
+ elif yaml_data:
single_build_result = build["result"]
check_item_info["check_install"] = yaml_data[0]["result"]
+ else:
+ single_build_result = build["result"]
logger.info(f"single_build_result:{single_build_result}")
logger.info(f"check_item_info:{check_item_info}")
if os.path.exists("support_arch"):
--
Gitee
From 4b09d8532b413e3d9ef36c7b7c229a8bbbef2b7a Mon Sep 17 00:00:00 2001
From: MementoMori <1003350679@qq.com>
Date: Mon, 17 Jul 2023 15:03:50 +0800
Subject: [PATCH 15/16] gitee_comment.py
---
src/build/gitee_comment.py | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/build/gitee_comment.py b/src/build/gitee_comment.py
index 99f446c..740dd99 100755
--- a/src/build/gitee_comment.py
+++ b/src/build/gitee_comment.py
@@ -290,31 +290,33 @@ class Comment(object):
if arches:
if arch in arches.keys() and not arches.get(arch):
continue
+ json_data, yaml_data = None, None
for check_item_comment_file in self._check_item_comment_files:
+ logger.info(f"check_item_comment_file:{check_item_comment_file}")
if not os.path.exists(check_item_comment_file):
logger.info("%s not exists", check_item_comment_file)
continue
- # if ACResult.get_instance(status) == SUCCESS and match(name, check_item_comment_file): # 保证build状态成功
- if match(name, check_item_comment_file):
+ if ACResult.get_instance(status) == SUCCESS and match(name, check_item_comment_file): # 保证build状态成功
with open(check_item_comment_file, "r") as data:
try:
json_data = json.load(data)
except json.decoder.JSONDecodeError:
- logger.error("%s is not an illegal json file", os.path.basename(check_item_comment_file))
+ logger.error("%s is not an legal json file", os.path.basename(check_item_comment_file))
json_data = None
with open(check_item_comment_file, "r") as data:
try:
yaml_data = yaml.safe_load(data)
except YAMLError:
- logger.error("%s is not an illegal yaml file",
+ logger.error("%s is not an legal yaml file",
os.path.basename(check_item_comment_file))
else:
yaml_data = None
- comment = self._comment_of_combine_item(json_data, yaml_data, arch, build, ac_result)
- comments.extend(comment)
+ break
+ comment = self._comment_of_combine_item(arch, build, ac_result, json_data=json_data, yaml_data=yaml_data)
+ comments.extend(comment)
return comments
- def _comment_of_combine_item(self, json_data, yaml_data, arch, build, ac_result):
+ def _comment_of_combine_item(self, arch, build, ac_result, json_data=None, yaml_data=None):
"""
check item combine comment
:param json_data:
@@ -327,10 +329,12 @@ class Comment(object):
arch_dict = {}
check_item_info = {}
if json_data:
+ logger.info(f"JSON DATA:{json_data}")
single_build_result = self._get_dict(["single_build_check", "current_result"], json_data)
check_item_info["check_install"] = self._get_dict(["single_install_check",
"current_result"], json_data)
elif yaml_data:
+ logger.info(f"YAML DATA:{yaml_data}")
single_build_result = build["result"]
check_item_info["check_install"] = yaml_data[0]["result"]
else:
--
Gitee
From 6aa8201628b97bf3a9f7d0efb8d967b159212b9a Mon Sep 17 00:00:00 2001
From: MementoMori <1003350679@qq.com>
Date: Thu, 27 Jul 2023 11:09:15 +0800
Subject: [PATCH 16/16] gitee_comment.py
---
src/build/gitee_comment.py | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/build/gitee_comment.py b/src/build/gitee_comment.py
index 740dd99..3c8eec9 100755
--- a/src/build/gitee_comment.py
+++ b/src/build/gitee_comment.py
@@ -53,6 +53,21 @@ class Comment(object):
self.compare_package_result = {}
self.check_item_result = {}
+ @staticmethod
+ def _get_rpm_name(rpm):
+ """
+ 返回rpm包名称
+ :param rpm:
+ :return:
+ """
+ rpm_name = re.match(r"^(.+)-.+-.+", rpm)
+
+ if rpm_name:
+ return rpm_name.group(1)
+ else:
+ logger.error(f"Prase rpm name error: {rpm}")
+ return rpm
+
def _get_dict(self, key_list, data):
"""
获取字典value
--
Gitee