openubmc-bingo 0.6.45__py3-none-any.whl → 0.6.99__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. bmcgo/__init__.py +1 -1
  2. bmcgo/bmcgo.py +9 -3
  3. bmcgo/bmcgo_config.py +16 -0
  4. bmcgo/cli/cli.py +72 -21
  5. bmcgo/codegen/__init__.py +1 -1
  6. bmcgo/codegen/lua/codegen.py +2 -2
  7. bmcgo/codegen/lua/script/check_intfs.py +1 -0
  8. bmcgo/codegen/lua/script/dto/options.py +1 -0
  9. bmcgo/codegen/lua/script/gen_db_json.py +4 -3
  10. bmcgo/codegen/lua/script/gen_rpc_msg_json.py +78 -11
  11. bmcgo/codegen/lua/script/model_consistency_check.py +1 -1
  12. bmcgo/codegen/lua/script/render_utils/db_lua.py +5 -6
  13. bmcgo/codegen/lua/script/render_utils/model_lua.py +5 -1
  14. bmcgo/codegen/lua/script/template.py +5 -0
  15. bmcgo/codegen/lua/script/utils.py +50 -8
  16. bmcgo/codegen/lua/templates/apps/Makefile +2 -2
  17. bmcgo/codegen/lua/templates/apps/client.lua.mako +1 -1
  18. bmcgo/codegen/lua/templates/apps/model.lua.mako +4 -3
  19. bmcgo/codegen/lua/templates/apps/service.lua.mako +1 -1
  20. bmcgo/codegen/lua/templates/apps/utils/mdb_intf.lua.mako +4 -0
  21. bmcgo/codegen/lua/templates/new_app_v2/CMakeLists.txt.mako +26 -0
  22. bmcgo/codegen/lua/templates/new_app_v2/conanfile.py.mako +9 -0
  23. bmcgo/codegen/lua/v1/script/render_utils/db_lua.py +5 -6
  24. bmcgo/codegen/lua/v1/script/render_utils/model_lua.py +13 -1
  25. bmcgo/codegen/lua/v1/templates/apps/client.lua.mako +1 -1
  26. bmcgo/codegen/lua/v1/templates/apps/local_db.lua.mako +0 -4
  27. bmcgo/codegen/lua/v1/templates/apps/message.lua.mako +3 -0
  28. bmcgo/codegen/lua/v1/templates/apps/model.lua.mako +3 -0
  29. bmcgo/codegen/lua/v1/templates/apps/utils/mdb_intf.lua.mako +6 -4
  30. bmcgo/component/analysis/analysis.py +9 -4
  31. bmcgo/component/analysis/dep-rules.json +20 -8
  32. bmcgo/component/analysis/dep_node.py +2 -0
  33. bmcgo/component/analysis/intf_validation.py +8 -7
  34. bmcgo/component/analysis/sr_validation.py +5 -4
  35. bmcgo/component/busctl_log_parse/busctl_log_parser.py +809 -0
  36. bmcgo/component/busctl_log_parse/mock_data_save.py +170 -0
  37. bmcgo/component/busctl_log_parse/test_data_save.py +49 -0
  38. bmcgo/component/component_helper.py +29 -0
  39. bmcgo/component/coverage/incremental_cov.py +5 -0
  40. bmcgo/component/fixture/__init__.py +29 -0
  41. bmcgo/component/fixture/auto_case_generator.py +490 -0
  42. bmcgo/component/fixture/busctl_type_converter.py +1081 -0
  43. bmcgo/component/fixture/common_config.py +15 -0
  44. bmcgo/component/fixture/dbus_gateway.py +669 -0
  45. bmcgo/component/fixture/dbus_library.py +250 -0
  46. bmcgo/component/fixture/dbus_mock_utils.py +514 -0
  47. bmcgo/component/fixture/dbus_response_handler.py +138 -0
  48. bmcgo/component/fixture/dbus_signature.py +110 -0
  49. bmcgo/component/template_v2/conanbase.py.mako +1 -5
  50. bmcgo/component/test.py +69 -10
  51. bmcgo/error_analyzer/__init__.py +0 -0
  52. bmcgo/error_analyzer/case_matcher.py +114 -0
  53. bmcgo/error_analyzer/log_parser.py +128 -0
  54. bmcgo/error_analyzer/unified_error_analyzer.py +359 -0
  55. bmcgo/error_cases/cases.yml +59 -0
  56. bmcgo/error_cases/cases_template_valid.json +71 -0
  57. bmcgo/error_cases/conanfile.py +58 -0
  58. bmcgo/frame.py +0 -4
  59. bmcgo/functional/analysis.py +18 -12
  60. bmcgo/functional/bmc_studio_action.py +21 -10
  61. bmcgo/functional/check.py +86 -42
  62. bmcgo/functional/conan_index_build.py +1 -1
  63. bmcgo/functional/config.py +22 -18
  64. bmcgo/functional/csr_build.py +63 -34
  65. bmcgo/functional/deploy.py +4 -3
  66. bmcgo/functional/diff.py +51 -34
  67. bmcgo/functional/full_component.py +16 -5
  68. bmcgo/functional/hpm_signer.py +484 -0
  69. bmcgo/functional/new.py +8 -2
  70. bmcgo/functional/schema_valid.py +111 -15
  71. bmcgo/functional/upgrade.py +6 -6
  72. bmcgo/misc.py +1 -0
  73. bmcgo/tasks/task_build_conan.py +27 -6
  74. bmcgo/tasks/task_build_rootfs_img.py +120 -83
  75. bmcgo/tasks/task_buildgppbin.py +30 -13
  76. bmcgo/tasks/task_buildhpm_ext4.py +5 -3
  77. bmcgo/tasks/task_download_buildtools.py +20 -11
  78. bmcgo/tasks/task_download_dependency.py +29 -20
  79. bmcgo/tasks/task_hpm_envir_prepare.py +32 -53
  80. bmcgo/tasks/task_packet_to_supporte.py +12 -4
  81. bmcgo/tasks/task_prepare.py +1 -1
  82. bmcgo/tasks/task_sign_and_pack_hpm.py +15 -7
  83. bmcgo/utils/component_version_check.py +4 -4
  84. bmcgo/utils/config.py +3 -0
  85. bmcgo/utils/fetch_component_code.py +148 -17
  86. bmcgo/utils/install_manager.py +2 -2
  87. bmcgo/utils/installations/base_installer.py +10 -27
  88. bmcgo/utils/installations/install_plans/studio.yml +3 -0
  89. bmcgo/utils/mapping_config_patch.py +5 -4
  90. bmcgo/utils/tools.py +49 -7
  91. {openubmc_bingo-0.6.45.dist-info → openubmc_bingo-0.6.99.dist-info}/METADATA +1 -1
  92. {openubmc_bingo-0.6.45.dist-info → openubmc_bingo-0.6.99.dist-info}/RECORD +95 -74
  93. bmcgo/tasks/download_buildtools_hm.py +0 -124
  94. {openubmc_bingo-0.6.45.dist-info → openubmc_bingo-0.6.99.dist-info}/WHEEL +0 -0
  95. {openubmc_bingo-0.6.45.dist-info → openubmc_bingo-0.6.99.dist-info}/entry_points.txt +0 -0
  96. {openubmc_bingo-0.6.45.dist-info → openubmc_bingo-0.6.99.dist-info}/top_level.txt +0 -0
bmcgo/functional/diff.py CHANGED
@@ -10,11 +10,11 @@
10
10
  # MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
11
11
  # See the Mulan PSL v2 for more details.
12
12
  import os
13
- import subprocess
14
13
  import re
15
14
  import shutil
16
15
  import json
17
16
  from tempfile import NamedTemporaryFile
17
+ import yaml
18
18
  from git import Repo
19
19
  from bmcgo import misc
20
20
  from bmcgo.utils.tools import Tools
@@ -39,7 +39,10 @@ def if_available(bconfig: BmcgoConfig):
39
39
  return True
40
40
 
41
41
  CONAN_DATA = ".conan/data"
42
- VERSION_KEY = "revision"
42
+ if misc.conan_v1():
43
+ VERSION_KEY = "revision"
44
+ else:
45
+ VERSION_KEY = "branch"
43
46
 
44
47
 
45
48
  class BmcgoCommand:
@@ -76,20 +79,20 @@ class BmcgoCommand:
76
79
  cur_version = version_msg.get('url')[:-4]
77
80
  for _log in current_commit[::-1]:
78
81
  if "See merge request" in _log:
79
- line = re.search("(?<=!)\d+", _log)[0]
82
+ line = re.search(r"(?<=!)\d+", _log)[0]
80
83
  log.info("%s/merge_requests/%s: %s", cur_version, line, description)
81
84
  break
82
85
  #将数据分割为一个一个commit
83
86
  for i, _log in enumerate(log_list):
84
- if re.match('^\s*Created-by:', _log):
87
+ if re.match(r'^\s*Created-by:', _log):
85
88
  new_commit = False
86
89
  edit_description = False
87
90
  #都为真时记录描述信息
88
91
  if new_commit and edit_description:
89
92
  description += _log
90
- if re.match('^\s*merge', _log):
93
+ if re.match(r'^\s*merge', _log):
91
94
  edit_description = True
92
- if re.match('^commit', _log):
95
+ if re.match(r'^commit', _log):
93
96
  new_commit = True
94
97
  if i != 0:
95
98
  current_commit = log_list[commit_index: i - 1]
@@ -102,36 +105,51 @@ class BmcgoCommand:
102
105
 
103
106
  @staticmethod
104
107
  def get_version_msg(version):
105
- tempfile = NamedTemporaryFile()
106
- # 过滤只包含scm的信息, 并将其生成为字典对象
107
- ret = tools.run_command(f"conan info {version} --json {tempfile.name} \
108
- -r {misc.conan_remote()}", ignore_error=True, command_echo=False, capture_output=True)
109
- file_handler = open(tempfile.name, "r")
110
- conan_comps = json.load(file_handler)
111
- version_msg = ""
112
- for conan_comp in conan_comps:
113
- comp_ref = conan_comp.get("reference", "")
114
- if comp_ref == version:
115
- version_msg = conan_comp.get("scm", "")
116
- break
117
- file_handler.close()
118
- if ret.returncode != 0 or version_msg == "":
119
- log.info(version)
120
- log.info("仅自研软件支持版本对比功能!")
121
- return 1, version_msg
122
- # 由于两个组件版本之间的依赖可能冲突,所以清理一遍data
123
- if os.path.exists(os.path.join(os.path.expanduser('~'), CONAN_DATA)):
124
- shutil.rmtree(os.path.join(os.path.expanduser('~'), CONAN_DATA))
108
+ if misc.conan_v1():
109
+ tempfile = NamedTemporaryFile()
110
+ # 过滤只包含scm的信息, 并将其生成为字典对象
111
+ ret = tools.run_command(f"conan info {version} --json {tempfile.name} \
112
+ -r {misc.conan_remote()}", ignore_error=True, command_echo=False, capture_output=True)
113
+ file_handler = open(tempfile.name, "r")
114
+ conan_comps = json.load(file_handler)
115
+ version_msg = ""
116
+ for conan_comp in conan_comps:
117
+ comp_ref = conan_comp.get("reference", "")
118
+ if comp_ref == version:
119
+ version_msg = conan_comp.get("scm", "")
120
+ break
121
+ file_handler.close()
122
+ if ret.returncode != 0 or version_msg == "":
123
+ log.info(version)
124
+ log.info("仅自研软件支持版本对比功能!")
125
+ return 1, version_msg
126
+ # 由于两个组件版本之间的依赖可能冲突,所以清理一遍data
127
+ if os.path.exists(os.path.join(os.path.expanduser('~'), CONAN_DATA)):
128
+ shutil.rmtree(os.path.join(os.path.expanduser('~'), CONAN_DATA))
129
+ else:
130
+ tools.run_command(f"conan download {version} -r {misc.conan_remote()} --only-recipe",
131
+ command_echo=False, capture_output=True)
132
+ ret = tools.run_command(f"conan cache path {version}", command_echo=False, capture_output=True)
133
+ conandata_path = os.path.join(ret.stdout.strip(), "conandata.yml")
134
+ with open(conandata_path, mode="r") as fp:
135
+ conan_data = yaml.safe_load(fp)
136
+ comp_ver = version.split("/")[1].split("@")[0]
137
+ version_msg = conan_data.get("sources", {}).get(comp_ver, {})
138
+ url = version_msg.get("url", "")
139
+ if url == "":
140
+ log.info(version)
141
+ log.info("仅自研软件支持版本对比功能!")
142
+ return 1, version_msg
125
143
  return ret.returncode, version_msg
126
144
 
127
- def stage_match_parse(self, repo, stage):
145
+ def stage_match_parse(self, repo):
128
146
  merge_time_1 = repo.git.log("--pretty=format:%at", "-1", self.version_before)
129
147
  merge_time_2 = repo.git.log("--pretty=format:%at", "-1", self.version_after)
130
148
  # 先对比两个version id的subsys目录下的几个文件, 并获取到有差异的组件
131
149
  if merge_time_1 > merge_time_2:
132
150
  self.version_before, self.version_after = self.version_after, self.version_before
133
151
 
134
- diff_list = repo.git.diff(self.version_before, self.version_after, "--", f"build/subsys/{stage}").split('\n')
152
+ diff_list = repo.git.diff(self.version_before, self.version_after, "--", f"build/subsys/stable").split('\n')
135
153
  log.info("====>>>>>> manifest 由 %s 演进至 %s <<<<<<====", self.version_before, self.version_after)
136
154
  # 由于git diff会打印许多的无关内容, 这里对其过滤
137
155
  cmp_bef_dict = {}
@@ -139,14 +157,14 @@ class BmcgoCommand:
139
157
  for diff in diff_list:
140
158
  # 时间旧的 version id
141
159
  match_bef = None
142
- match_bef = re.search("(?<=^- - conan: ).*", diff)
160
+ match_bef = re.search(r"(?<=^- - conan: ).*", diff)
143
161
  if match_bef is not None:
144
162
  match_bef = match_bef[0].replace('"', '')
145
163
  cmp_bef_dict[match_bef.split('/')[0]] = match_bef
146
164
 
147
165
  # 时间新的 version id
148
166
  match_aft = None
149
- match_aft = re.search("(?<=^\+ - conan: ).*", diff)
167
+ match_aft = re.search(r"(?<=^\+ - conan: ).*", diff)
150
168
  if match_aft is not None:
151
169
  match_aft = match_aft[0].replace('"', '')
152
170
  cmp_aft_dict[match_aft.split('/')[0]] = match_aft
@@ -186,11 +204,11 @@ class BmcgoCommand:
186
204
  # 由于组件在版本变更时,可能存储地址发生了改变,旧地址不存在,导致下载失败,同时输入的新地址可能也不存在
187
205
  # 故用try进行确认,确保创建目标目录和下载正确执行
188
206
  try:
189
- Repo.clone_from(version_msg1.get("url"), to_path=to_path, branch='main')
207
+ Repo.clone_from(version_msg1.get("url"), to_path=to_path)
190
208
  except Exception as e1:
191
209
  if version_after:
192
210
  try:
193
- Repo.clone_from(version_msg2.get("url"), to_path=to_path, branch='main')
211
+ Repo.clone_from(version_msg2.get("url"), to_path=to_path)
194
212
  except Exception as e2:
195
213
  log.error(f"远程软件仓库地址不存在:{version_msg2.get('url')}")
196
214
  raise e2
@@ -222,8 +240,7 @@ class BmcgoCommand:
222
240
  log.info(f"合并记录为时间排序,并非编号排序")
223
241
  log.info(f"版本演进均为旧版本演进为新版本, 回滚提交也视为演进")
224
242
  repo = Repo(self.bconfig.manifest.folder)
225
- self.stage_match_parse(repo, "stable")
226
- self.stage_match_parse(repo, "rc")
243
+ self.stage_match_parse(repo)
227
244
 
228
245
  def run(self):
229
246
  if "@" in self.version_before and "@" in self.version_after:
@@ -91,9 +91,12 @@ class BuildComponent:
91
91
  if misc.conan_v2():
92
92
  self.option_cmd = self.option_cmd + f" -o {self.comp_name}/*:{key}={value}"
93
93
  else:
94
- self.option_cmd = self.option_cmd + f" -o {self.comp_name}:{key}={value}"
94
+ if isinstance(key, str) and ":" in key:
95
+ self.option_cmd = self.option_cmd + f" -o {key}={value}"
96
+ else:
97
+ self.option_cmd = self.option_cmd + f" -o {self.comp_name}:{key}={value}"
95
98
  command = (
96
- f"--remote {self.remote} -nc --stage {self.stage} --build_type {self.build_type.lower()}"
99
+ f"--remote {self.remote} -nc --stage {self.stage.value} --build_type {self.build_type.value.lower()}"
97
100
  f" --profile {self.profile} {self.option_cmd}"
98
101
  )
99
102
  log.info(f"执行构建命令{misc.tool_name()} build {command}")
@@ -204,6 +207,8 @@ class BmcgoCommand:
204
207
  if conan_file_cls.name in obj:
205
208
  for exclude_option in obj[conan_file_cls.name]["exclude_options"]:
206
209
  del options_dict[exclude_option]
210
+ if obj[conan_file_cls.name].get("add_options", {}):
211
+ options_dict.update(obj[conan_file_cls.name]["add_options"])
207
212
 
208
213
  @staticmethod
209
214
  def exclude_all_options(obj, options_dict):
@@ -211,15 +216,20 @@ class BmcgoCommand:
211
216
  for exclude_option in obj["all"]["exclude_options"]:
212
217
  if exclude_option in options_dict:
213
218
  del options_dict[exclude_option]
219
+ if obj["all"].get("add_options", {}):
220
+ options_dict.update(obj["all"]["add_options"])
214
221
 
215
222
  @staticmethod
216
223
  def copy_stable2rc(comp: str):
217
224
  com_folder = os.path.join(tool.conan_data, comp)
225
+ cwd = os.getcwd()
226
+ os.chdir(com_folder)
218
227
  for version in os.listdir(com_folder):
219
228
  pkg = f"{comp}/{version}@{CONAN_USER}.release/{STAGE_STABLE}"
220
229
  if not os.path.exists(os.path.join(tool.conan_data, pkg.replace("@", "/"))):
221
230
  continue
222
231
  tool.run_command(f"conan copy {pkg} {CONAN_USER}.release/{STAGE_RC} --all --force")
232
+ os.chdir(cwd)
223
233
 
224
234
  @staticmethod
225
235
  def copy_all_stable2rc(tools: Tools):
@@ -323,7 +333,8 @@ class BmcgoCommand:
323
333
  self.revise_comp_version(service_json)
324
334
  self.revise_service_dependencies(service_json)
325
335
  self.build_all_packages(service_json)
326
- self.copy_all_stable2rc(tool)
336
+ if misc.conan_v1():
337
+ self.copy_all_stable2rc(tool)
327
338
  if self.upload:
328
339
  log.info("上传组件包至conan仓......")
329
340
  tool.run_command(f'conan upload "*" --all --remote {self.remote} -c --no-overwrite')
@@ -356,9 +367,9 @@ class BmcgoCommand:
356
367
  for build_args in all_build_params:
357
368
  profile, stage, build_type, *option_values = build_args
358
369
  if misc.conan_v1():
359
- if profile == "profile.dt.ini" and build_type.lower() != BUILD_TYPE_DT.lower():
370
+ if profile == "profile.dt.ini" and build_type.value.lower() != BUILD_TYPE_DT.lower():
360
371
  continue
361
- if profile != "profile.dt.ini" and build_type.lower() == BUILD_TYPE_DT.lower():
372
+ if profile != "profile.dt.ini" and build_type.value.lower() == BUILD_TYPE_DT.lower():
362
373
  continue
363
374
  build_options = dict(zip(options_dict.keys(), option_values))
364
375
  task = BuildComponent(