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
@@ -55,7 +55,7 @@ local foreach_non_virtual_interface_objects = mdb_service.foreach_non_virtual_in
55
55
  % if intf_data['interface'].startswith('bmc.dev.'):
56
56
  local ${intf} = require '${project_name}.device_types.${intf}'
57
57
  %else:
58
- local ${intf} = require '${project_name}.json_types.${intf}'
58
+ local ${intf} = require '${render_utils.get_interface_require_path(intf_data["interface"], project_name, intf)}'
59
59
  % endif
60
60
  % endfor
61
61
 
@@ -182,7 +182,7 @@ local ${class_name} = {
182
182
  methods = ${render_utils.get_privileges(intf_msg.get('methods', {}))}
183
183
  },
184
184
  ${render_utils.get_readonlys(intf_msg.get('properties', {}))},
185
- require '${project_name}.json_types.${intf_name}')
185
+ require '${render_utils.get_interface_require_path(interface, project_name, intf_name)}')
186
186
  objs['${interface}'] = obj
187
187
  end<% num = num + 1 %>
188
188
  % endfor
@@ -222,9 +222,10 @@ end
222
222
 
223
223
  % for (method, method_config) in intf_msg['methods'].items():
224
224
  -- The callback needs to be registered during app initialization
225
- function M.Impl${class_name}${render_utils.get_intf_name(interface, intf_msg)}${method}(cb)
225
+ <% intf_name = render_utils.get_intf_name(interface, intf_msg)%>
226
+ function M.Impl${class_name}${intf_name}${method}(cb)
226
227
  class('${class_name}')['${interface}'].${method} = function(obj, ctx, ...)
227
- local ${interface.split(".")[-1].lower()}_types = require "${project_name}.json_types.${render_utils.get_intf_name(interface, intf_msg)}"
228
+ local ${interface.split(".")[-1].lower()}_types = require "${render_utils.get_interface_require_path(interface, project_name, intf_name)}"
228
229
  local req = ${interface.split(".")[-1].lower()}_types.${method}Req.new(...):validate(nil, nil, true)
229
230
  local rsp = ${interface.split(".")[-1].lower()}_types.${method}Rsp.new(cb(obj, ctx, req:unpack())):validate()
230
231
  return rsp:unpack(true)
@@ -47,7 +47,7 @@ end
47
47
  % endif
48
48
 
49
49
  % for intf, intf_data in root['intf_imports'].items():
50
- local ${intf}Types = require '${project_name}.json_types.${intf}'
50
+ local ${intf}Types = require '${render_utils.get_interface_require_path(intf_data["interface"], project_name, intf)}'
51
51
  % endfor
52
52
 
53
53
  % for cls, cls_data in root['class_require'].items():
@@ -2,7 +2,11 @@
2
2
  mdb.register_interface('${intf['name']}', {
3
3
  % if 'properties' in intf['data'] :
4
4
  % for p,p_data in intf['data']['properties'].items():
5
+ % if version >= 19:
6
+ ${p} = {'${render_utils.do_type_to_dbus_json(intf['data'], p_data)}', ${render_utils.options_json(p_data)}, ${render_utils.readonly_json(p_data)}, ${render_utils.default_json(p_data)}},
7
+ % else:
5
8
  ${p} = {'${render_utils.do_type_to_dbus_json(intf['data'], p_data)}', ${render_utils.options_json(p_data)}, ${render_utils.readonly_json(p_data)}, ${render_utils.default_json(p_data)}, false},
9
+ % endif
6
10
  % endfor
7
11
  % endif
8
12
  }, {
@@ -0,0 +1,26 @@
1
+ cmake_minimum_required(VERSION 3.14)
2
+ <% dollar="$" %>
3
+ project(${project_name})
4
+ find_package(PkgConfig REQUIRED)
5
+ pkg_search_module(GLIB REQUIRED glib-2.0)
6
+ pkg_search_module(GMODULE REQUIRED gmodule-2.0)
7
+
8
+ set(TARGET_LIB ${dollar}{PROJECT_NAME})
9
+ set(BUILD_DIR temp)
10
+
11
+ set(APP_INSTALL_DIR opt/bmc/apps/${dollar}{PROJECT_NAME})
12
+ set(LUACLIB_INSTALL_DIR ${dollar}{APP_INSTALL_DIR}/luaclib)
13
+
14
+ install(DIRECTORY src/lualib DESTINATION ${dollar}{APP_INSTALL_DIR} OPTIONAL)
15
+ install(DIRECTORY include/ DESTINATION opt/bmc/lualib OPTIONAL)
16
+ install(DIRECTORY src/service DESTINATION ${dollar}{APP_INSTALL_DIR} OPTIONAL)
17
+ if (NOT ${dollar}{CMAKE_BUILD_TYPE} STREQUAL Release)
18
+ install(DIRECTORY gen/debug/ DESTINATION ${dollar}{APP_INSTALL_DIR}/debug OPTIONAL)
19
+ install(DIRECTORY src/debug/lualib DESTINATION ${dollar}{APP_INSTALL_DIR} OPTIONAL)
20
+ endif()
21
+ install(DIRECTORY gen/${dollar}{PROJECT_NAME}/ DESTINATION ${dollar}{APP_INSTALL_DIR} OPTIONAL)
22
+ install(DIRECTORY gen/class DESTINATION ${dollar}{APP_INSTALL_DIR} OPTIONAL)
23
+ install(FILES mds/schema.json DESTINATION ${dollar}{APP_INSTALL_DIR}/mds OPTIONAL)
24
+ install(FILES mds/service.json DESTINATION ${dollar}{APP_INSTALL_DIR}/mds OPTIONAL)
25
+ install(DIRECTORY user_conf/rootfs/ DESTINATION . USE_SOURCE_PERMISSIONS OPTIONAL)
26
+ install(FILES config.cfg DESTINATION ${dollar}{APP_INSTALL_DIR} OPTIONAL)
@@ -0,0 +1,9 @@
1
+ from conanbase import ConanBase
2
+
3
+
4
+ required_conan_version = ">=2.13.0"
5
+
6
+ class AppConan(ConanBase):
7
+
8
+ def package_info(self):
9
+ pass
@@ -206,12 +206,11 @@ class ConsistencyDbLuaUtils(Base, Utils):
206
206
  return result + "}"
207
207
  value_name = Utils(self.data, self.options).enum_value_name(types["name"], d_val)
208
208
  return f'{types["package"]}.{types["name"]}.{value_name}'
209
- if Utils.get_lua_codegen_version() >= 10:
210
- if prop.get('repeated') and not isinstance(d_val, list):
211
- raise RuntimeError(f"model.json中类{class_name}的属性{prop['name']}默认值{d_val}类型与属性类型不一致")
212
- if isinstance(d_val, list) or isinstance(d_val, dict):
213
- json_str = json.dumps(d_val).replace("'", "''")
214
- return f"[['{json_str}']]"
209
+ if prop.get('repeated') and not isinstance(d_val, list):
210
+ raise RuntimeError(f"model.json中类{class_name}的属性{prop['name']}默认值{d_val}类型与属性类型不一致")
211
+ if isinstance(d_val, list) or isinstance(d_val, dict):
212
+ json_str = json.dumps(d_val).replace("'", "''")
213
+ return f"[['{json_str}']]"
215
214
  if type_name == "string" or type_name == 'bytes':
216
215
  return f'"\'{d_val}\'"'
217
216
  if type_name == "bool":
@@ -457,7 +457,8 @@ class ConsistencyModelLuaUtils(Base, Utils):
457
457
  for (interface, intf_msg) in msg.get('interfaces', {}).items():
458
458
  intf_name = self.get_intf_name(interface, intf_msg)
459
459
  intf_type = self.get_intf_type(intf_name)
460
- types[intf_type] = f"local {intf_type} = require '{project_name}.json_types.{intf_name}'\n"
460
+ path = Utils.get_interface_require_path(interface, project_name, intf_name)
461
+ types[intf_type] = f"local {intf_type} = require '{path}'\n"
461
462
  return types
462
463
 
463
464
  def render_types(self, project_name, root):
@@ -483,5 +484,16 @@ class ConsistencyModelLuaUtils(Base, Utils):
483
484
  for intf_msg in msg.get('interfaces', {}).values():
484
485
  self.collect_features(intf_msg, features)
485
486
  return sorted(list(features))
487
+
488
+ def remove_unnecessary_field(self, input_dict):
489
+ keys_to_delete = []
490
+ for key, value in input_dict.items():
491
+ if isinstance(value, dict):
492
+ _ = self.remove_unnecessary_field(value)
493
+ if key in ['description', 'constraint', 'example']:
494
+ keys_to_delete.append(key)
495
+ for key in keys_to_delete:
496
+ del input_dict[key]
497
+ return input_dict
486
498
 
487
499
  Factory().register("v1/templates/apps/model.lua.mako", ConsistencyModelLuaUtils)
@@ -54,7 +54,7 @@ local foreach_non_virtual_interface_objects = mdb_service.foreach_non_virtual_in
54
54
  % if intf_data['interface'].startswith('bmc.dev.'):
55
55
  local ${intf} = require '${project_name}.device_types.${intf}'
56
56
  %else:
57
- local ${intf} = require '${project_name}.json_types.${intf}'
57
+ local ${intf} = require '${render_utils.get_interface_require_path(intf_data["interface"], project_name, intf)}'
58
58
  % endif
59
59
  % endfor
60
60
 
@@ -139,9 +139,6 @@ db_selector["reset"] = ${ClassName}.new
139
139
  local ${ClassName} = class(db_base)
140
140
 
141
141
  function ${ClassName}:ctor()
142
- local db = Databases(path)
143
- local obj = {db = db}
144
-
145
142
  % for msg in root['data']:
146
143
  % if render_utils.table_name(msg) and render_utils.check_local_per_temporary(msg):
147
144
  self.${msg['name']} = self.db:Table('${render_utils.table_name(msg)}', {
@@ -156,7 +153,6 @@ function ${ClassName}:ctor()
156
153
  % endfor
157
154
 
158
155
  self.tables = self.db.tables
159
- return setmetatable(obj, ${ClassName})
160
156
  end
161
157
 
162
158
  % for msg in root['data']:
@@ -5,6 +5,9 @@ enums = [msg for msg in root['data'] if msg['type'] == 'Enum']
5
5
  %>
6
6
  local validate = require 'mc.validate'
7
7
  local utils = require 'mc.utils'
8
+ % if 'intf' in root:
9
+ local mdb = require 'mc.mdb'
10
+ % endif
8
11
  % if len(enums) > 0:
9
12
  local create_enum_type = require 'mc.enum'
10
13
  % endif
@@ -1,5 +1,6 @@
1
1
  ${make_header('lua')}
2
2
  local privilege = require 'mc.privilege'
3
+ local mdb = require 'mc.mdb'
3
4
  % if render_utils.get_features(root):
4
5
  require 'mc.plugin.loader'.load()
5
6
  % for feature in render_utils.get_features(root):
@@ -13,6 +14,8 @@ local classes = {}
13
14
 
14
15
  % for (class_name, msg) in root.items():
15
16
 
17
+ <% msg = render_utils.remove_unnecessary_field(msg) %>
18
+
16
19
  classes.${class_name} = {
17
20
  % if render_utils.has_table_name(msg):
18
21
  ['table_name'] = '${msg['tableName']}',
@@ -1,9 +1,12 @@
1
1
  <%def name="render(intf)">
2
- {
3
- '${intf['name']}', {
2
+ mdb.register_interface('${intf['name']}', {
4
3
  % if 'properties' in intf['data'] :
5
4
  % for p,p_data in intf['data']['properties'].items():
5
+ % if version >= 19:
6
+ ${p} = {'${render_utils.do_type_to_dbus_json(intf['data'], p_data)}', ${render_utils.options_json(p_data)}, ${render_utils.readonly_json(p_data)}, ${render_utils.default_json(p_data)}},
7
+ % else:
6
8
  ${p} = {'${render_utils.do_type_to_dbus_json(intf['data'], p_data)}', ${render_utils.options_json(p_data)}, ${render_utils.readonly_json(p_data)}, ${render_utils.default_json(p_data)}, false},
9
+ % endif
7
10
  % endfor
8
11
  % endif
9
12
  }, {
@@ -22,6 +25,5 @@
22
25
  ${s} = 'a{ss}${render_utils.do_types_to_dbus_json(intf['data'], intf['data']['signals'], s)}',
23
26
  % endfor
24
27
  % endif
25
- }
26
- }
28
+ })
27
29
  </%def>
@@ -119,19 +119,24 @@ class AnalysisComp():
119
119
  excluded_str = "/dev" if misc.conan_v1() else "openubmc"
120
120
  if node.package_name == "busybox" and excluded_str in node.ref:
121
121
  continue
122
+ if node.is_build_tool:
123
+ continue
122
124
  packages[node.index] = node
123
125
  requires[node.index] = node_data.get("requires", [])
124
126
  if misc.conan_v2():
125
127
  dependencies_data = node_data.get("dependencies", [])
126
- dependencies_keys = list(dependencies_data.keys())
128
+ dependencies_keys = [key for key, dep in dependencies_data.items() if dep["direct"]]
127
129
  requires[node.index] = dependencies_keys
128
130
  comm_name = misc.community_name()
131
+ excluded_prefixes = (comm_name, "openubmc")
129
132
  for index, pkg in packages.items():
130
- if not pkg.name.startswith(comm_name):
133
+ if not pkg.name.startswith(excluded_prefixes):
131
134
  self.set_node_subsys(pkg)
132
135
  for require_id in requires.get(index, []):
133
- pkg.requires.append(packages.get(int(require_id), None))
134
- if not pkg.name.startswith(comm_name):
136
+ require_package = packages.get(int(require_id), None)
137
+ if require_package:
138
+ pkg.requires.append(require_package)
139
+ if not pkg.name.startswith(excluded_prefixes):
135
140
  self.nodes.append(pkg)
136
141
 
137
142
  def run(self):
@@ -1,7 +1,14 @@
1
1
  {
2
- "Version": "0.0.46",
3
- "Description": "此文件对iBMCV3子系统与子系统、组件与组件的依赖关系约束进行了描述, 只有子系统架构师/领域专家才能修改",
2
+ "Version": "0.0.48",
3
+ "Description": "此文件对openUBMC子系统与子系统、组件与组件的依赖关系约束进行了描述, 只有TC委员/SIG maintainter才能修改",
4
4
  "Changelog": {
5
+ "0.0.48": [
6
+ "interface子系统新增dcmid组件,用于代理DCMI规范的IPMI命令"
7
+ ],
8
+ "0.0.47": [
9
+ "1、framework子系统增加设备驱动管理组件devmon",
10
+ "2、framework子系统增加设备驱动管理库component_drivers, libmcpp"
11
+ ],
5
12
  "0.0.46": [
6
13
  "1、om子系统增加可观测组件observability",
7
14
  "2、opensource增加可观测需要的开源软件, 包括fluent-bit, libyaml, opentelemetry, grpc, abseil, protobuf, re2, c_ares,opentelemetry-proto",
@@ -42,12 +49,12 @@
42
49
  "libyaml",
43
50
  "opentelemetry",
44
51
  "grpc",
45
- "grpc_tool",
46
52
  "abseil",
47
53
  "protobuf",
48
54
  "re2",
49
55
  "c_ares",
50
- "opentelemetry-proto"
56
+ "opentelemetry-proto",
57
+ "libspdm"
51
58
  ]
52
59
  },
53
60
 
@@ -103,7 +110,8 @@
103
110
  "persistence",
104
111
  "key_mgmt",
105
112
  "hwdiscovery",
106
- "hwproxy"
113
+ "hwproxy",
114
+ "devmon"
107
115
  ],
108
116
  "Libraries": [
109
117
  "persistence",
@@ -117,7 +125,9 @@
117
125
  "libmcc",
118
126
  "libmgmt_protocol",
119
127
  "libkvs",
120
- "liblogger"
128
+ "liblogger",
129
+ "component_drivers",
130
+ "libmcpp"
121
131
  ],
122
132
  "Configurations": [
123
133
  "rootfs_user"
@@ -159,7 +169,8 @@
159
169
  "capability_agent",
160
170
  "certificate",
161
171
  "hisec_ict_ne",
162
- "tpcm"
172
+ "tpcm",
173
+ "spdm"
163
174
  ],
164
175
  "Libraries": [
165
176
  "libiam"
@@ -245,7 +256,8 @@
245
256
  "snmp",
246
257
  "profile_schema",
247
258
  "critical_rest",
248
- "java_irc"
259
+ "java_irc",
260
+ "dcmid"
249
261
  ],
250
262
  "Libraries": [
251
263
  "libroute_mapper",
@@ -51,7 +51,9 @@ class DepNode():
51
51
  self.local_tables = {}
52
52
  self.remote_tables = {}
53
53
  self.table_conflict = False
54
+ self.is_build_tool = False
54
55
  if misc.conan_v2():
56
+ self.is_build_tool = node.get("context") == "build"
55
57
  self.recipe_folder = node.get("recipe_folder")
56
58
  self.binary = node.get("binary", "")
57
59
  if self.binary == "Skip":
@@ -34,15 +34,13 @@ class InterfaceValidation:
34
34
  self.intf_hardcoded: Dict[str, Set[str]] = defaultdict(set)
35
35
  self.all_predefined_intfs: Set[str] = set()
36
36
  self.remote = remote
37
- self._parse_mds_interfaces()
38
- self._parse_hardcoded_interfaces()
39
- self._pull_all_interfaces()
37
+ self.mdb_interface_repo_url = "https://gitcode.com/openUBMC/mdb_interface.git"
40
38
 
41
39
  @staticmethod
42
40
  def extract_dbus_intf_in_file(file_path):
43
41
  all_intfs = list()
44
42
  with open(file_path, "r") as file_descriptor:
45
- # iBMC d-bus interface pattern: bmc.(kepler|dev).[A-Z]
43
+ # d-bus interface pattern: bmc.(kepler|dev).[A-Z]
46
44
  pattern = "[\"\']bmc\.(?:kepler|dev)(?:\.[A-Z].*?)?[\"\']"
47
45
  intf_match = re.findall(pattern, file_descriptor.read())
48
46
  for intf in intf_match:
@@ -96,6 +94,10 @@ class InterfaceValidation:
96
94
  return package
97
95
 
98
96
  def run(self):
97
+ self._parse_mds_interfaces()
98
+ self._parse_hardcoded_interfaces()
99
+ self._pull_all_interfaces()
100
+
99
101
  intf_validation_passed = self._validate_mds_intf() and self._validate_hardcoded_intf() and \
100
102
  self._check_dbus_call()
101
103
  if intf_validation_passed:
@@ -142,7 +144,6 @@ class InterfaceValidation:
142
144
  self.intf_hardcoded[intf].update([file_path])
143
145
 
144
146
  def _pull_interfaces_from_repo(self):
145
- mdb_interface_repo_url = "https://gitcode.com/openUBMC/mdb_interface.git"
146
147
  mktemp_cmd = subprocess.run(["/usr/bin/mktemp", "-d", "--suffix", "_mdb_interface"], capture_output=True)
147
148
  if mktemp_cmd.returncode != 0:
148
149
  raise OSError(f"创建文件夹失败, 错误消息: {mktemp_cmd.stderr}")
@@ -150,10 +151,10 @@ class InterfaceValidation:
150
151
 
151
152
  git_cmd = Helper.get_git_path()
152
153
  repo_fetch = subprocess.run(
153
- [git_cmd, "clone", mdb_interface_repo_url, temp_dir, "--depth=1"],
154
+ [git_cmd, "clone", self.mdb_interface_repo_url, temp_dir, "--depth=1"],
154
155
  stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
155
156
  if repo_fetch.returncode != 0:
156
- log.error("克隆远端仓库 %s 失败, 错误信息: %s", mdb_interface_repo_url, repo_fetch.stderr)
157
+ log.error("克隆远端仓库 %s 失败, 错误信息: %s", self.mdb_interface_repo_url, repo_fetch.stderr)
157
158
  intf_dir = os.path.join(temp_dir, "json/intf/mdb/bmc")
158
159
 
159
160
  for root, _, files in os.walk(intf_dir):
@@ -22,6 +22,7 @@ from bmcgo.logger import Logger
22
22
 
23
23
  global log
24
24
  log = Logger()
25
+ script_dir = os.path.split(os.path.realpath(__file__))[0]
25
26
 
26
27
  SOFT_SR_SUFFIX = "_soft.sr"
27
28
  SOFTWARE_SUFFIX = "software"
@@ -194,7 +195,7 @@ class SrValidate(SrParser):
194
195
  self.is_product_sr_repo = False
195
196
  self.check_repo_type()
196
197
  self.smc_dfx_whitelist: Dict[str, Set[Tuple[int, int]]] = defaultdict(set)
197
- self.load_smc_dfx_whitelist()
198
+ self.whitelist_file = os.path.join(script_dir, "smc_dfx_whitelist.json")
198
199
 
199
200
  @staticmethod
200
201
  def merge_sr_objects(hardware_sr_objects: Dict[str, Dict], software_sr_objects: Dict[str, Dict]):
@@ -227,11 +228,10 @@ class SrValidate(SrParser):
227
228
  log.error('mds/service.json 文件解析失败: %s', e)
228
229
 
229
230
  def load_smc_dfx_whitelist(self):
230
- whitelist_file = Path(__file__).parent.joinpath("smc_dfx_whitelist.json")
231
- if not os.path.exists(whitelist_file):
231
+ if not os.path.exists(self.whitelist_file):
232
232
  return
233
233
  try:
234
- with open(whitelist_file, 'r') as file_descriptor:
234
+ with open(self.whitelist_file, 'r') as file_descriptor:
235
235
  content = json.load(file_descriptor)
236
236
  for item in content:
237
237
  chip_type = item.get("ChipType")
@@ -245,6 +245,7 @@ class SrValidate(SrParser):
245
245
  def run(self):
246
246
  if not self.is_sr_repo:
247
247
  return True
248
+ self.load_smc_dfx_whitelist()
248
249
  self.find_soft_sr_files()
249
250
  self.walk_sr_dir()
250
251
  file_count, problems_total, issues_count = self.log_issues()