openubmc-bingo 0.5.240__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.

Potentially problematic release.


This version of openubmc-bingo might be problematic. Click here for more details.

Files changed (242) hide show
  1. bmcgo/__init__.py +12 -0
  2. bmcgo/bmcgo.py +22 -0
  3. bmcgo/bmcgo_config.py +176 -0
  4. bmcgo/cli/__init__.py +10 -0
  5. bmcgo/cli/cli.py +584 -0
  6. bmcgo/codegen/__init__.py +14 -0
  7. bmcgo/codegen/c/__init__.py +9 -0
  8. bmcgo/codegen/c/annotation.py +52 -0
  9. bmcgo/codegen/c/argument.py +42 -0
  10. bmcgo/codegen/c/codegen.py +153 -0
  11. bmcgo/codegen/c/comment.py +22 -0
  12. bmcgo/codegen/c/ctype_defination.py +353 -0
  13. bmcgo/codegen/c/helper.py +87 -0
  14. bmcgo/codegen/c/interface.py +63 -0
  15. bmcgo/codegen/c/method.py +82 -0
  16. bmcgo/codegen/c/property.py +180 -0
  17. bmcgo/codegen/c/renderer.py +21 -0
  18. bmcgo/codegen/c/signal.py +64 -0
  19. bmcgo/codegen/c/template/client.c.mako +145 -0
  20. bmcgo/codegen/c/template/client.h.mako +36 -0
  21. bmcgo/codegen/c/template/interface.c.mako +0 -0
  22. bmcgo/codegen/c/template/interface.introspect.xml.mako +99 -0
  23. bmcgo/codegen/c/template/micro_component.c.mako +32 -0
  24. bmcgo/codegen/c/template/public.c.mako +228 -0
  25. bmcgo/codegen/c/template/public.h.mako +128 -0
  26. bmcgo/codegen/c/template/server.c.mako +104 -0
  27. bmcgo/codegen/c/template/server.h.mako +36 -0
  28. bmcgo/codegen/lua/.lua-format +7 -0
  29. bmcgo/codegen/lua/Makefile +101 -0
  30. bmcgo/codegen/lua/__init__.py +9 -0
  31. bmcgo/codegen/lua/codegen.py +171 -0
  32. bmcgo/codegen/lua/proto/Makefile +87 -0
  33. bmcgo/codegen/lua/proto/ipmi_types.proto +17 -0
  34. bmcgo/codegen/lua/proto/types.proto +52 -0
  35. bmcgo/codegen/lua/script/check_intfs.py +161 -0
  36. bmcgo/codegen/lua/script/dto/__init__.py +11 -0
  37. bmcgo/codegen/lua/script/dto/exception.py +53 -0
  38. bmcgo/codegen/lua/script/dto/kepler_abstract.py +47 -0
  39. bmcgo/codegen/lua/script/dto/options.py +33 -0
  40. bmcgo/codegen/lua/script/dto/print_simple.py +19 -0
  41. bmcgo/codegen/lua/script/dto/redfish_api.py +241 -0
  42. bmcgo/codegen/lua/script/dto/url_route.py +195 -0
  43. bmcgo/codegen/lua/script/gen_db_json.py +444 -0
  44. bmcgo/codegen/lua/script/gen_depends.py +89 -0
  45. bmcgo/codegen/lua/script/gen_entry.py +263 -0
  46. bmcgo/codegen/lua/script/gen_feature_json.py +156 -0
  47. bmcgo/codegen/lua/script/gen_historical_local_db_json.py +88 -0
  48. bmcgo/codegen/lua/script/gen_intf_json.py +261 -0
  49. bmcgo/codegen/lua/script/gen_intf_rpc_json.py +575 -0
  50. bmcgo/codegen/lua/script/gen_ipmi_json.py +485 -0
  51. bmcgo/codegen/lua/script/gen_mdb_json.py +117 -0
  52. bmcgo/codegen/lua/script/gen_rpc_msg_json.py +487 -0
  53. bmcgo/codegen/lua/script/gen_schema.py +302 -0
  54. bmcgo/codegen/lua/script/ipmi_types_pb2.py +135 -0
  55. bmcgo/codegen/lua/script/loader/__init__.py +11 -0
  56. bmcgo/codegen/lua/script/loader/file_utils.py +33 -0
  57. bmcgo/codegen/lua/script/loader/kepler_abstract_collect.py +79 -0
  58. bmcgo/codegen/lua/script/loader/kepler_abstract_loader.py +47 -0
  59. bmcgo/codegen/lua/script/loader/redfish_loader.py +127 -0
  60. bmcgo/codegen/lua/script/lua_format.py +62 -0
  61. bmcgo/codegen/lua/script/mds_util.py +385 -0
  62. bmcgo/codegen/lua/script/merge_model.py +330 -0
  63. bmcgo/codegen/lua/script/merge_proto_algo.py +85 -0
  64. bmcgo/codegen/lua/script/proto_loader.py +47 -0
  65. bmcgo/codegen/lua/script/proto_plugin.py +140 -0
  66. bmcgo/codegen/lua/script/redfish_source_tree.py +118 -0
  67. bmcgo/codegen/lua/script/render_utils/__init__.py +38 -0
  68. bmcgo/codegen/lua/script/render_utils/base.py +25 -0
  69. bmcgo/codegen/lua/script/render_utils/client_lua.py +98 -0
  70. bmcgo/codegen/lua/script/render_utils/controller_lua.py +71 -0
  71. bmcgo/codegen/lua/script/render_utils/db_lua.py +224 -0
  72. bmcgo/codegen/lua/script/render_utils/error_lua.py +185 -0
  73. bmcgo/codegen/lua/script/render_utils/factory.py +52 -0
  74. bmcgo/codegen/lua/script/render_utils/ipmi_lua.py +159 -0
  75. bmcgo/codegen/lua/script/render_utils/ipmi_message_lua.py +24 -0
  76. bmcgo/codegen/lua/script/render_utils/mdb_lua.py +177 -0
  77. bmcgo/codegen/lua/script/render_utils/mdb_register.py +215 -0
  78. bmcgo/codegen/lua/script/render_utils/message_lua.py +26 -0
  79. bmcgo/codegen/lua/script/render_utils/messages_lua.py +156 -0
  80. bmcgo/codegen/lua/script/render_utils/model_lua.py +485 -0
  81. bmcgo/codegen/lua/script/render_utils/old_model_lua.py +429 -0
  82. bmcgo/codegen/lua/script/render_utils/plugin_lua.py +38 -0
  83. bmcgo/codegen/lua/script/render_utils/redfish_proto.py +86 -0
  84. bmcgo/codegen/lua/script/render_utils/request_lua.py +76 -0
  85. bmcgo/codegen/lua/script/render_utils/service_lua.py +130 -0
  86. bmcgo/codegen/lua/script/render_utils/utils_message_lua.py +125 -0
  87. bmcgo/codegen/lua/script/render_utils/validate_lua.py +221 -0
  88. bmcgo/codegen/lua/script/sep_ipmi_message_cmds.py +217 -0
  89. bmcgo/codegen/lua/script/template.py +166 -0
  90. bmcgo/codegen/lua/script/types_pb2.py +516 -0
  91. bmcgo/codegen/lua/script/utils.py +663 -0
  92. bmcgo/codegen/lua/script/validate.py +80 -0
  93. bmcgo/codegen/lua/script/yaml_to_json.py +73 -0
  94. bmcgo/codegen/lua/templates/Makefile +114 -0
  95. bmcgo/codegen/lua/templates/apps/Makefile +261 -0
  96. bmcgo/codegen/lua/templates/apps/Makefile.mdb.mk +64 -0
  97. bmcgo/codegen/lua/templates/apps/app.lua.mako +19 -0
  98. bmcgo/codegen/lua/templates/apps/class.lua.mako +35 -0
  99. bmcgo/codegen/lua/templates/apps/client.lua.mako +429 -0
  100. bmcgo/codegen/lua/templates/apps/controller.lua.mako +276 -0
  101. bmcgo/codegen/lua/templates/apps/datas.lua.mako +8 -0
  102. bmcgo/codegen/lua/templates/apps/db.lua.mako +89 -0
  103. bmcgo/codegen/lua/templates/apps/entry.lua.mako +128 -0
  104. bmcgo/codegen/lua/templates/apps/feature.lua.mako +37 -0
  105. bmcgo/codegen/lua/templates/apps/generate_route.mako +25 -0
  106. bmcgo/codegen/lua/templates/apps/impl_feature.lua.mako +72 -0
  107. bmcgo/codegen/lua/templates/apps/ipmi.lua.mako +97 -0
  108. bmcgo/codegen/lua/templates/apps/ipmi_cmd.lua.mako +18 -0
  109. bmcgo/codegen/lua/templates/apps/ipmi_message.lua.mako +36 -0
  110. bmcgo/codegen/lua/templates/apps/local_db.lua.mako +263 -0
  111. bmcgo/codegen/lua/templates/apps/main.lua.mako +25 -0
  112. bmcgo/codegen/lua/templates/apps/mc.lua.mako +77 -0
  113. bmcgo/codegen/lua/templates/apps/mdb.lua.mako +45 -0
  114. bmcgo/codegen/lua/templates/apps/mdb_interface.lua.mako +73 -0
  115. bmcgo/codegen/lua/templates/apps/message.lua.mako +38 -0
  116. bmcgo/codegen/lua/templates/apps/model.lua.mako +239 -0
  117. bmcgo/codegen/lua/templates/apps/orm_classes.lua.mako +16 -0
  118. bmcgo/codegen/lua/templates/apps/plugin.lua.mako +8 -0
  119. bmcgo/codegen/lua/templates/apps/redfish.proto.mako +47 -0
  120. bmcgo/codegen/lua/templates/apps/service.lua.mako +440 -0
  121. bmcgo/codegen/lua/templates/apps/signal_listen.lua.mako +19 -0
  122. bmcgo/codegen/lua/templates/apps/utils/default_intf.lua.mako +41 -0
  123. bmcgo/codegen/lua/templates/apps/utils/enum.mako +10 -0
  124. bmcgo/codegen/lua/templates/apps/utils/imports.mako +13 -0
  125. bmcgo/codegen/lua/templates/apps/utils/mdb_intf.lua.mako +25 -0
  126. bmcgo/codegen/lua/templates/apps/utils/mdb_obj.lua.mako +23 -0
  127. bmcgo/codegen/lua/templates/apps/utils/message.mako +160 -0
  128. bmcgo/codegen/lua/templates/apps/utils/request.lua.mako +59 -0
  129. bmcgo/codegen/lua/templates/apps/utils/validate.mako +83 -0
  130. bmcgo/codegen/lua/templates/errors.lua.mako +36 -0
  131. bmcgo/codegen/lua/templates/messages.lua.mako +32 -0
  132. bmcgo/codegen/lua/templates/new_app/.clang-format.mako +170 -0
  133. bmcgo/codegen/lua/templates/new_app/.gitignore.mako +26 -0
  134. bmcgo/codegen/lua/templates/new_app/CHANGELOG.md.mako +0 -0
  135. bmcgo/codegen/lua/templates/new_app/CMakeLists.txt.mako +29 -0
  136. bmcgo/codegen/lua/templates/new_app/Makefile.mako +25 -0
  137. bmcgo/codegen/lua/templates/new_app/README.md.mako +0 -0
  138. bmcgo/codegen/lua/templates/new_app/conanfile.py.mako +7 -0
  139. bmcgo/codegen/lua/templates/new_app/config.cfg.mako +6 -0
  140. bmcgo/codegen/lua/templates/new_app/mds/model.json.mako +3 -0
  141. bmcgo/codegen/lua/templates/new_app/mds/service.json.mako +21 -0
  142. bmcgo/codegen/lua/templates/new_app/permissions.ini.mako +16 -0
  143. bmcgo/codegen/lua/templates/new_app/src/lualib/${project_name}_app.lua.mako +16 -0
  144. bmcgo/codegen/lua/templates/new_app/src/service/main.lua.mako +25 -0
  145. bmcgo/codegen/lua/templates/new_app/test/integration/test_${project_name}.conf.mako +9 -0
  146. bmcgo/codegen/lua/templates/new_app/test/integration/test_${project_name}.lua.mako +47 -0
  147. bmcgo/codegen/lua/templates/new_app/test/unit/test.lua.mako +23 -0
  148. bmcgo/codegen/lua/templates/new_app/user_conf/rootfs/etc/systemd/system/${project_name}.service.mako +18 -0
  149. bmcgo/codegen/lua/templates/new_app/user_conf/rootfs/etc/systemd/system/multi-user.target.wants/${project_name}.service.link +1 -0
  150. bmcgo/component/__init__.py +10 -0
  151. bmcgo/component/analysis/analysis.py +183 -0
  152. bmcgo/component/analysis/build_deps.py +165 -0
  153. bmcgo/component/analysis/data_deps.py +333 -0
  154. bmcgo/component/analysis/dep-rules.json +912 -0
  155. bmcgo/component/analysis/dep_node.py +110 -0
  156. bmcgo/component/analysis/intf_deps.py +163 -0
  157. bmcgo/component/analysis/intf_validation.py +254 -0
  158. bmcgo/component/analysis/rule.py +211 -0
  159. bmcgo/component/analysis/smc_dfx_whitelist.json +11 -0
  160. bmcgo/component/analysis/sr_validation.py +391 -0
  161. bmcgo/component/build.py +222 -0
  162. bmcgo/component/component_dt_version_parse.py +348 -0
  163. bmcgo/component/component_helper.py +114 -0
  164. bmcgo/component/coverage/__init__.py +11 -0
  165. bmcgo/component/coverage/c_incremental_cov_report.template +53 -0
  166. bmcgo/component/coverage/incremental_cov.py +464 -0
  167. bmcgo/component/deploy.py +110 -0
  168. bmcgo/component/gen.py +169 -0
  169. bmcgo/component/package_info.py +236 -0
  170. bmcgo/component/template/conanbase.py.mako +278 -0
  171. bmcgo/component/template/conanfile.deploy.py.mako +40 -0
  172. bmcgo/component/test.py +947 -0
  173. bmcgo/errors.py +119 -0
  174. bmcgo/frame.py +217 -0
  175. bmcgo/functional/__init__.py +10 -0
  176. bmcgo/functional/analysis.py +96 -0
  177. bmcgo/functional/bmc_studio_action.py +98 -0
  178. bmcgo/functional/check.py +185 -0
  179. bmcgo/functional/conan_index_build.py +251 -0
  180. bmcgo/functional/config.py +332 -0
  181. bmcgo/functional/csr_build.py +724 -0
  182. bmcgo/functional/deploy.py +263 -0
  183. bmcgo/functional/diff.py +235 -0
  184. bmcgo/functional/fetch.py +235 -0
  185. bmcgo/functional/full_component.py +391 -0
  186. bmcgo/functional/maintain.py +381 -0
  187. bmcgo/functional/new.py +166 -0
  188. bmcgo/functional/schema_valid.py +111 -0
  189. bmcgo/functional/simple_sign.py +104 -0
  190. bmcgo/functional/upgrade.py +78 -0
  191. bmcgo/ipmigen/__init__.py +13 -0
  192. bmcgo/ipmigen/ctype_defination.py +82 -0
  193. bmcgo/ipmigen/ipmigen.py +309 -0
  194. bmcgo/ipmigen/template/cmd.c.mako +366 -0
  195. bmcgo/ipmigen/template/ipmi.c.mako +25 -0
  196. bmcgo/ipmigen/template/ipmi.h.mako +51 -0
  197. bmcgo/logger.py +176 -0
  198. bmcgo/misc.py +117 -0
  199. bmcgo/target/app.yml +17 -0
  200. bmcgo/target/install_sdk.yml +15 -0
  201. bmcgo/target/personal.yml +53 -0
  202. bmcgo/target/publish.yml +45 -0
  203. bmcgo/tasks/__init__.py +11 -0
  204. bmcgo/tasks/download_buildtools_hm.py +124 -0
  205. bmcgo/tasks/misc.py +15 -0
  206. bmcgo/tasks/task.py +354 -0
  207. bmcgo/tasks/task_build_conan.py +714 -0
  208. bmcgo/tasks/task_build_rootfs_img.py +595 -0
  209. bmcgo/tasks/task_buildgppbin.py +88 -0
  210. bmcgo/tasks/task_buildhpm_ext4.py +82 -0
  211. bmcgo/tasks/task_create_interface_config.py +122 -0
  212. bmcgo/tasks/task_download_buildtools.py +99 -0
  213. bmcgo/tasks/task_download_dependency.py +72 -0
  214. bmcgo/tasks/task_hpm_envir_prepare.py +112 -0
  215. bmcgo/tasks/task_packet_to_supporte.py +87 -0
  216. bmcgo/tasks/task_prepare.py +105 -0
  217. bmcgo/tasks/task_sign_and_pack_hpm.py +42 -0
  218. bmcgo/utils/__init__.py +10 -0
  219. bmcgo/utils/buffer.py +128 -0
  220. bmcgo/utils/combine_json_schemas.py +170 -0
  221. bmcgo/utils/component_post.py +54 -0
  222. bmcgo/utils/component_version_check.py +86 -0
  223. bmcgo/utils/config.py +1067 -0
  224. bmcgo/utils/fetch_component_code.py +232 -0
  225. bmcgo/utils/install_manager.py +61 -0
  226. bmcgo/utils/installations/__init__.py +10 -0
  227. bmcgo/utils/installations/base_installer.py +70 -0
  228. bmcgo/utils/installations/install_consts.py +30 -0
  229. bmcgo/utils/installations/install_plans/bingo.yml +11 -0
  230. bmcgo/utils/installations/install_workflow.py +50 -0
  231. bmcgo/utils/installations/installers/apt_installer.py +177 -0
  232. bmcgo/utils/installations/installers/pip_installer.py +46 -0
  233. bmcgo/utils/installations/version_util.py +100 -0
  234. bmcgo/utils/mapping_config_patch.py +443 -0
  235. bmcgo/utils/perf_analysis.py +114 -0
  236. bmcgo/utils/tools.py +704 -0
  237. bmcgo/worker.py +417 -0
  238. openubmc_bingo-0.5.240.dist-info/METADATA +30 -0
  239. openubmc_bingo-0.5.240.dist-info/RECORD +242 -0
  240. openubmc_bingo-0.5.240.dist-info/WHEEL +5 -0
  241. openubmc_bingo-0.5.240.dist-info/entry_points.txt +2 -0
  242. openubmc_bingo-0.5.240.dist-info/top_level.txt +1 -0
bmcgo/errors.py ADDED
@@ -0,0 +1,119 @@
1
+ #!/usr/bin/python3
2
+ # coding: utf-8
3
+ # Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
+ # openUBMC is licensed under Mulan PSL v2.
5
+ # You can use this software according to the terms and conditions of the Mulan PSL v2.
6
+ # You may obtain a copy of Mulan PSL v2 at:
7
+ # http://license.coscl.org.cn/MulanPSL2
8
+ # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
9
+ # EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
10
+ # MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
11
+ # See the Mulan PSL v2 for more details.
12
+
13
+
14
+ class BmcGoException(Exception):
15
+ """
16
+ Generic bmcgo exception
17
+ """
18
+ def __init__(self, *args, **kwargs):
19
+ super(BmcGoException, self).__init__(*args, **kwargs)
20
+
21
+ def __str__(self):
22
+ return super(BmcGoException, self).__str__()
23
+
24
+
25
+ class ExitOk(Exception):
26
+ """
27
+ 触发bmcgo退出
28
+ """
29
+ def __init__(self, *args, **kwargs):
30
+ super(ExitOk, self).__init__(*args, **kwargs)
31
+
32
+ def __str__(self):
33
+ return super(ExitOk, self).__str__()
34
+
35
+
36
+ class EnvironmentException(Exception):
37
+ """
38
+ 环境异常,包括路径不正确,配置错误等
39
+ """
40
+ def __init__(self, *args, **kwargs):
41
+ super(EnvironmentException, self).__init__(*args, **kwargs)
42
+
43
+ def __str__(self):
44
+ return super(EnvironmentException, self).__str__()
45
+
46
+
47
+ class NotFoundException(BmcGoException): # 404
48
+ """
49
+ 404 error
50
+ """
51
+
52
+ def __init__(self, *args, **kwargs):
53
+ super(NotFoundException, self).__init__(*args, **kwargs)
54
+
55
+
56
+ class ParameterException(BmcGoException): # 404
57
+ """
58
+ 参数错误异常
59
+ """
60
+
61
+ def __init__(self, *args, **kwargs):
62
+ super(ParameterException, self).__init__(*args, **kwargs)
63
+
64
+
65
+ class DepAnalysisConfigException(BmcGoException): # 404
66
+ """
67
+ 依赖分析配置错误
68
+ """
69
+
70
+ def __init__(self, *args, **kwargs):
71
+ super(DepAnalysisConfigException, self).__init__(*args, **kwargs)
72
+
73
+
74
+ class DepAnalysisException(BmcGoException): # 404
75
+ """
76
+ 依赖分析错误
77
+ """
78
+
79
+ def __init__(self, *args, **kwargs):
80
+ super(DepAnalysisException, self).__init__(*args, **kwargs)
81
+
82
+
83
+ class NotIntegrateException(BmcGoException): # 404
84
+ """
85
+ 非集成环境 error
86
+ """
87
+
88
+ def __init__(self, *args, **kwargs):
89
+ super(NotIntegrateException, self).__init__(*args, **kwargs)
90
+
91
+
92
+ class CommandNotFoundException(BmcGoException): # 404
93
+ """
94
+ 非集成环境 error
95
+ """
96
+
97
+ def __init__(self, *args, **kwargs):
98
+ super(CommandNotFoundException, self).__init__(*args, **kwargs)
99
+
100
+
101
+ class XmlErrorException(BmcGoException): # 404
102
+ """
103
+ 404 error
104
+ """
105
+
106
+ def __init__(self, *args, **kwargs):
107
+ super(NotFoundException, self).__init__(*args, **kwargs)
108
+
109
+ def __str__(self):
110
+ return super(BmcGoException, self).__str__()
111
+
112
+
113
+ class ConfigException(BmcGoException):
114
+ """
115
+ 配置错误 error
116
+ """
117
+
118
+ def __init__(self, *args, **kwargs):
119
+ super(ConfigException, self).__init__(*args, **kwargs)
bmcgo/frame.py ADDED
@@ -0,0 +1,217 @@
1
+ #! /usr/bin/env python3
2
+ # -*- coding: UTF-8 -*-
3
+ # Copyright (c) 2024 Huawei Technologies Co., Ltd.
4
+ # openUBMC is licensed under Mulan PSL v2.
5
+ # You can use this software according to the terms and conditions of the Mulan PSL v2.
6
+ # You may obtain a copy of Mulan PSL v2 at:
7
+ # http://license.coscl.org.cn/MulanPSL2
8
+ # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
9
+ # EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
10
+ # MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
11
+ # See the Mulan PSL v2 for more details.
12
+ '''
13
+ 功 能:构建框架
14
+ 修改记录:2021-10-11 创建
15
+ '''
16
+ import os
17
+ import time
18
+ import sys
19
+ import argparse
20
+ import signal
21
+ import shutil
22
+ import stat
23
+
24
+ from bmcgo import misc
25
+ from bmcgo import errors
26
+ from bmcgo.utils.perf_analysis import PerfAnalysis
27
+ from bmcgo.utils.tools import Tools
28
+ from bmcgo.bmcgo_config import BmcgoConfig
29
+ from bmcgo.functional.deploy import BmcgoCommand as Deploy
30
+ from bmcgo.worker import WorkStatusServer, create_target_scheduler, q
31
+
32
+ tool = Tools(__name__)
33
+ log = tool.log
34
+
35
+
36
+ class Frame(object):
37
+ def __init__(self, bconfig: BmcgoConfig, config):
38
+ self.bconfig = bconfig
39
+ https_proxy = os.environ.get("https_proxy")
40
+ if https_proxy is not None and https_proxy != "":
41
+ log.warning("检测到环境设置了https_proxy代理,可能导致网络资源访问失败.")
42
+ log.warning(" 如需关闭代理,请执行命令: export https_proxy=")
43
+ log.warning(" 如需关闭特定域名或IP的代理,可以设置no_proxy环境变量,也可将no_proxy设置到/etc/profile中.")
44
+ log.warning(" no_proxy配置示例: export no_proxy=localhost,127.0.0.0/8,.huawei.com,.inhuawei.com")
45
+ self.perf = PerfAnalysis(os.path.join(bconfig.manifest.folder, "output"))
46
+ self.code_path = os.path.join(bconfig.manifest.folder, "build")
47
+ sys.path.append(self.code_path)
48
+ os.makedirs(misc.CACHE_DIR, exist_ok=True)
49
+ self.ws_server = None
50
+ self.config = config
51
+ self.config.log_init()
52
+ self.need_deploy = False
53
+ self.args = None
54
+ self.conan_args = None
55
+ self.targets = {}
56
+
57
+ def record_build_time(self):
58
+ date_file = f"{self.config.temp_path}/date/date.txt"
59
+ os.makedirs(os.path.dirname(date_file), exist_ok=True)
60
+ with os.fdopen(os.open(date_file, os.O_WRONLY | os.O_CREAT | os.O_TRUNC,
61
+ stat.S_IWUSR | stat.S_IRUSR), 'w') as file_handler:
62
+ now = time.strftime("%H:%M:%S %b %-d %Y", time.localtime())
63
+ file_handler.write(now)
64
+ file_handler.close()
65
+
66
+ def get_all_target(self, ex_target_dir=""):
67
+ targets = {}
68
+ bingo_install_path = os.path.dirname(os.path.abspath(__file__))
69
+ dirname = os.path.join(bingo_install_path, "target")
70
+ for file in os.listdir(dirname):
71
+ if not file.endswith(".yml"):
72
+ continue
73
+ tgt_file = os.path.join(dirname, file)
74
+ targets[file.split(".")[0]] = tgt_file
75
+ if not os.path.isdir(ex_target_dir):
76
+ return targets
77
+ for file in os.listdir(ex_target_dir):
78
+ if not file.endswith(".yml"):
79
+ continue
80
+ tgt_file = os.path.join(ex_target_dir, file)
81
+ targets[file.split(".")[0]] = tgt_file
82
+ return targets
83
+
84
+ def cmc_open_parse(self, args, unknown_args):
85
+ if args.target != "cmc_open" and args.target != "docker_build":
86
+ return None, unknown_args
87
+ parser = argparse.ArgumentParser(description="cmc_open info")
88
+ parser.add_argument("-ud", "--upload_docker", help="是否上传docker镜像", action=misc.STORE_TRUE)
89
+ parser.add_argument("-pn", "--partner_name", help="伙伴名称")
90
+ local_time = time.strftime("%y%m%d%H%M", time.localtime())
91
+ default_tag = f'v3_partner_{local_time}_{self.bconfig.current_branch}'
92
+ parser.add_argument("-dtag", "--docker_tag", help="上传docker镜像tag", default=default_tag)
93
+ docker_args, unknown_args = parser.parse_known_args(unknown_args)
94
+ if docker_args.upload_docker and docker_args.partner_name is None:
95
+ raise errors.BmcGoException("伙伴名称为空, 无法完成上传, 请指定伙伴名称!")
96
+ return docker_args, unknown_args
97
+
98
+ def kunpeng_publish_parse(self, args, unknown_args):
99
+ if args.target != "cmc_open" and args.target != "kunpeng_publish":
100
+ return None, unknown_args
101
+ os.environ['NOT_CLEAN_CONAN_CACHE'] = "True"
102
+ parser = argparse.ArgumentParser(description="open_source conan repo info")
103
+ parser.add_argument("-opr", "--open_conan_remote", help="开源/伙伴仓远端(场内远端)")
104
+ kunpeng_publish_args, unknown_args = parser.parse_known_args(unknown_args)
105
+ return kunpeng_publish_args, unknown_args
106
+
107
+ def parse(self, argv=None, ex_target_dir=""):
108
+ parser = argparse.ArgumentParser(description="构建openUBMC",
109
+ parents=[self.config.argparser(self.code_path, self.bconfig.partner_mode)],
110
+ add_help=False,
111
+ formatter_class=argparse.RawTextHelpFormatter,
112
+ )
113
+ help_info = "构建目标,请查看build/target目录, 支持的目标:"
114
+ self.targets = self.get_all_target(ex_target_dir)
115
+ for tgt, _ in self.targets.items():
116
+ help_info += "\n" + tgt
117
+
118
+ parser.add_argument("-d", "--debug_frame", help=argparse.SUPPRESS, const="debug", action="store_const")
119
+ if log.is_debug:
120
+ parser.add_argument("--debug_task", help="调试任务,与目标描述文件的klass完全相同,如:bmcgo.tasks.task_download_buildtools",
121
+ default=None)
122
+ else:
123
+ parser.add_argument("--debug_task", help=argparse.SUPPRESS, default=None)
124
+
125
+ parser.add_argument("-v", "--version", help="构建版本号,不指定时从manifest.yml读取", default="")
126
+ parser.add_argument("-t", "--target", help=help_info, default="personal")
127
+ parser.add_argument("--deploy", help="将hpm包部署至bmc设备", action=misc.STORE_TRUE)
128
+ args, unknown_args = parser.parse_known_args(argv)
129
+ if args.target.startswith("target_"):
130
+ args.target = args.target[7:]
131
+ log.info(f'已知参数: {argv}')
132
+ log.info(f"调试框架: {args.debug_frame}, 构建参数: {args}")
133
+ conan_index_options = []
134
+ if args.target == "dependencies":
135
+ parser = argparse.ArgumentParser(description="build target")
136
+ parser.add_argument("-cp", "--conan_package", help="软件包名, 示例: kmc/21.1.2.B001", default="")
137
+ parser.add_argument("-uci", "--upload_package", help="是否上传软件包", action=misc.STORE_TRUE)
138
+ parser.add_argument("-o", "--options", help="组件特性配置, 示例: -o skynet:enable_luajit=True",
139
+ action='append')
140
+ self.conan_args, unknown_args = parser.parse_known_args(unknown_args)
141
+ if self.conan_args is None or self.conan_args.conan_package == "":
142
+ raise errors.BmcGoException("软件包选项为空, 请输入软件包选项!")
143
+ conan_index_options = self.conan_args.options
144
+ docker_args, unknown_args = self.cmc_open_parse(args, unknown_args)
145
+ kunpeng_publish_args, unknown_args = self.kunpeng_publish_parse(args, unknown_args)
146
+ self.config.parse_args(argv)
147
+ self.config.pre_cook_manifest()
148
+ self.record_build_time()
149
+ self.config.set_version(args.version)
150
+ self.config.set_target(args.target)
151
+ self.config.set_conan_index_options(conan_index_options)
152
+ if docker_args:
153
+ self.config.set_docker_info(docker_args)
154
+ if kunpeng_publish_args:
155
+ self.config.set_kunpeng_publish_info(kunpeng_publish_args)
156
+ self.need_deploy = args.deploy
157
+ # 开启schema校验,也可参考personal目标配置禁用校验
158
+ self.config.set_schema_need_validate(True)
159
+ self.args = args
160
+
161
+ def sigint_handler(self, _, __):
162
+ log.debug('关闭全局状态管理器,所有任务都将因与状态管理器通信失败而退出!')
163
+ self.ws_server.kill()
164
+ signal.raise_signal(signal.SIGKILL)
165
+
166
+ def sigterm_handler(self, _, __):
167
+ log.debug('接收到终止信号!, 退出!')
168
+ signal.raise_signal(signal.SIGINT)
169
+
170
+ def run(self):
171
+ tool.sudo_passwd_check()
172
+ shutil.rmtree(misc.CACHE_DIR)
173
+ os.makedirs(misc.CACHE_DIR)
174
+ os.chmod(misc.CACHE_DIR, 0o777)
175
+ if shutil.which(misc.CONAN) is not None:
176
+ tool.run_command("conan remove --locks")
177
+ # 启动全局状态服务
178
+ signal.signal(signal.SIGINT, self.sigint_handler)
179
+ signal.signal(signal.SIGTERM, self.sigterm_handler)
180
+ self.ws_server = WorkStatusServer()
181
+ self.ws_server.start()
182
+ succ = True
183
+ args = self.args
184
+ conan_args = self.conan_args
185
+ # 初始化性能数据收集功能
186
+ try:
187
+ # 等待sever起来
188
+ q.get()
189
+ succ = create_target_scheduler(
190
+ args.target,
191
+ args.target,
192
+ self.perf,
193
+ self.config,
194
+ args,
195
+ conan_args,
196
+ self.targets[args.target],
197
+ )
198
+ except Exception as e:
199
+ log.error(str(e))
200
+ log.error(f"Error: 构建目标({args.target})失败,请参考“构建检查”和下载“全量构建日志(右上角-日志-全量构建日志)”检查错误!!!!!!!!")
201
+ succ = False
202
+
203
+ self.ws_server.kill()
204
+ if os.environ.get("PERF") is not None:
205
+ self.perf.render(args.target)
206
+ if succ:
207
+ log.success(f"任务 {args.target} 执行成功")
208
+ hpm_path = os.path.join(self.config.output_path, f"rootfs_{self.config.board_name}.hpm")
209
+ if self.need_deploy and os.path.isfile(hpm_path):
210
+ deploy = Deploy(self.bconfig, ["-f", hpm_path])
211
+ deploy.run()
212
+ time.sleep(0.5)
213
+ else:
214
+ # 等待2秒给各子任务同步状态
215
+ time.sleep(2)
216
+ raise errors.BmcGoException(f"任务 {args.target} 执行失败")
217
+ return 0
@@ -0,0 +1,10 @@
1
+ # coding: utf-8
2
+ # Copyright (c) 2024 Huawei Technologies Co., Ltd.
3
+ # openUBMC is licensed under Mulan PSL v2.
4
+ # You can use this software according to the terms and conditions of the Mulan PSL v2.
5
+ # You may obtain a copy of Mulan PSL v2 at:
6
+ # http://license.coscl.org.cn/MulanPSL2
7
+ # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8
+ # EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9
+ # MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10
+ # See the Mulan PSL v2 for more details.
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env python3
2
+ # encoding=utf-8
3
+ # 描述:组件依赖和接口分析
4
+ # Copyright (c) 2024 Huawei Technologies Co., Ltd.
5
+ # openUBMC is licensed under Mulan PSL v2.
6
+ # You can use this software according to the terms and conditions of the Mulan PSL v2.
7
+ # You may obtain a copy of Mulan PSL v2 at:
8
+ # http://license.coscl.org.cn/MulanPSL2
9
+ # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
10
+ # EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
11
+ # MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
12
+ # See the Mulan PSL v2 for more details.
13
+ import os
14
+ import argparse
15
+ from multiprocessing import Process
16
+ import urllib3
17
+ from bmcgo.frame import Frame
18
+ from bmcgo.misc import CommandInfo
19
+ from bmcgo import misc
20
+ from bmcgo.utils.tools import Tools
21
+ from bmcgo.bmcgo_config import BmcgoConfig
22
+ from bmcgo.component.analysis.analysis import AnalysisComp
23
+ from bmcgo.component.analysis.intf_validation import InterfaceValidation
24
+ from bmcgo.component.analysis.sr_validation import SrValidate
25
+
26
+ urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
27
+
28
+ tool = Tools("analysis")
29
+ log = tool.log
30
+ command_info: CommandInfo = CommandInfo(
31
+ group="Misc commands",
32
+ name="analysis",
33
+ description=["依赖和接口分析"],
34
+ hidden=False
35
+ )
36
+
37
+
38
+ def if_available(bconfig: BmcgoConfig):
39
+ return bconfig.manifest is not None or bconfig.component is not None
40
+
41
+
42
+ class BmcgoCommand:
43
+ def __init__(self, bconfig: BmcgoConfig, *args):
44
+ parser = argparse.ArgumentParser(prog="bmcgo analysis", description="BMC package analysis", add_help=True,
45
+ formatter_class=argparse.RawTextHelpFormatter)
46
+ parser.add_argument("-r", "--remote", help="指定conan远端")
47
+ parser.add_argument("--rebuild", dest="rebuild", help="rebuild the package before analysis",
48
+ action=misc.STORE_TRUE)
49
+ parser.add_argument("--out_dir", dest="out_dir", help="analysis artifacts directory")
50
+ parser.add_argument("--lock_file", dest="lock_file", help="manifest lock file path")
51
+ parser.add_argument("-b", "--board_name", help="find supported boards in the manifest/build/product directory",
52
+ default="openUBMC")
53
+ pre_parsed_args, _ = parser.parse_known_args(*args)
54
+
55
+ self.bconfig = bconfig
56
+ self.remote = pre_parsed_args.remote
57
+ self.rebuild = pre_parsed_args.rebuild
58
+ self.out_dir = pre_parsed_args.out_dir
59
+ self.lock_file = pre_parsed_args.lock_file
60
+ self.board_name = pre_parsed_args.board_name
61
+
62
+ def run(self):
63
+ is_integrated, work_dir = self._is_integrated_project()
64
+ if is_integrated:
65
+ os.chdir(work_dir)
66
+ else:
67
+ os.chdir(self.bconfig.component.folder)
68
+ # 组件级构建
69
+ if not is_integrated:
70
+ if not InterfaceValidation(self.remote).run() or not SrValidate(os.getcwd()).run():
71
+ return -1
72
+ return 0
73
+ custom_sr_dir = None
74
+ # 非集成环境
75
+ if not is_integrated:
76
+ custom_sr_dir = os.getcwd()
77
+ elif self.rebuild:
78
+ parsed = []
79
+ if self.board_name:
80
+ parsed.append("-b")
81
+ parsed.append(self.board_name)
82
+ frame = Frame(self.bconfig)
83
+ frame.parse(parsed)
84
+ return frame.run()
85
+ os.chdir(os.path.join(work_dir, misc.BUILD))
86
+ analysis_task = AnalysisComp(self.board_name, self.out_dir, self.lock_file, custom_sr_dir)
87
+ rc = analysis_task.run()
88
+ if not rc:
89
+ return -1
90
+ log.success("BMC 构建分析成功")
91
+ return 0
92
+
93
+ def _is_integrated_project(self):
94
+ if self.bconfig.manifest is not None:
95
+ return True, self.bconfig.manifest.folder
96
+ return False, None
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/python3
2
+ # coding: utf-8
3
+ # 启动停止bmc studio的操作
4
+ # Copyright (c) 2024 Huawei Technologies Co., Ltd.
5
+ # openUBMC is licensed under Mulan PSL v2.
6
+ # You can use this software according to the terms and conditions of the Mulan PSL v2.
7
+ # You may obtain a copy of Mulan PSL v2 at:
8
+ # http://license.coscl.org.cn/MulanPSL2
9
+ # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
10
+ # EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
11
+ # MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
12
+ # See the Mulan PSL v2 for more details.
13
+ import os
14
+ import argparse
15
+
16
+ from bmcgo.utils.tools import Tools
17
+ from bmcgo import misc
18
+ from bmcgo.bmcgo_config import BmcgoConfig
19
+
20
+ tools = Tools("bmc_studio")
21
+ log = tools.log
22
+ ACTION_TRUE = "store_true"
23
+
24
+
25
+ command_info: misc.CommandInfo = misc.CommandInfo(
26
+ group=misc.GRP_STUDIO,
27
+ name="studio",
28
+ description=["执行bmc studio启动停止操作"],
29
+ hidden=False
30
+ )
31
+
32
+
33
+ def if_available(bconfig: BmcgoConfig):
34
+ return True
35
+
36
+
37
+ class BmcgoCommand(object):
38
+ def __init__(self, bconfig: BmcgoConfig, *args):
39
+ self.bconfig = bconfig
40
+ parser = argparse.ArgumentParser(prog="bmc studio", description="启动停止bmc studio", add_help=True,
41
+ formatter_class=argparse.RawTextHelpFormatter)
42
+ action_group = parser.add_mutually_exclusive_group()
43
+ action_group.add_argument("-start", action=ACTION_TRUE, help="bmc studio的启动操作")
44
+ action_group.add_argument("-stop", action=ACTION_TRUE, help="bmc studio的停止操作")
45
+ action_group.add_argument("-restart", action=ACTION_TRUE, help="bmc studio的重启操作")
46
+ parser.add_argument("-b", "--backend", help="指定bmc studio是前端运行还是后端运行,默认前端运行", action=ACTION_TRUE)
47
+ parsed_args, _ = parser.parse_known_args(*args)
48
+ self.action = self.get_action(parsed_args)
49
+ self.backend = parsed_args.backend
50
+ self.studio_path = tools.get_studio_path()
51
+ self.studio_command = ""
52
+ self.studio_script = ""
53
+ if self.studio_path:
54
+ self.studio_script = f"{self.studio_path}/bmc_studio.sh"
55
+ self.studio_command = f"{self.studio_script} {self.action}"
56
+
57
+ def get_action(self, parsed_args):
58
+ if parsed_args.stop:
59
+ return "stop"
60
+ elif parsed_args.restart:
61
+ return "restart"
62
+ else:
63
+ return "start"
64
+
65
+ def run(self):
66
+ if not self.studio_command or not os.path.isfile(self.studio_script):
67
+ raise Exception(f"bmc studio服务不存在,请安装之后重试操作。")
68
+
69
+ if self.action == "stop":
70
+ self.run_stop()
71
+ return
72
+
73
+ self.run_start()
74
+
75
+ def run_stop(self):
76
+ stop_ret = tools.run_command(self.studio_command, command_echo=False,
77
+ ignore_error=True, capture_output=True)
78
+ stop_out = stop_ret.stdout
79
+ if stop_ret.returncode == 0:
80
+ log.info(stop_out)
81
+ return
82
+
83
+ log.warning(stop_out)
84
+
85
+ def run_start(self):
86
+ if not self.backend:
87
+ tools.run_command(self.studio_command, command_echo=False, show_log=True, timeout=None)
88
+ return
89
+
90
+ self.studio_command = f"{self.studio_command} backend"
91
+ start_ret = tools.run_command(self.studio_command, command_echo=False,
92
+ ignore_error=True, capture_output=True)
93
+ start_out = start_ret.stdout
94
+ if start_ret.returncode == 0:
95
+ log.info(start_out)
96
+ return
97
+
98
+ log.warning(start_out)