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/misc.py ADDED
@@ -0,0 +1,117 @@
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
+ import re
13
+ import os
14
+ from enum import Enum
15
+ from bmcgo import errors
16
+ from bmcgo.logger import Logger
17
+
18
+ log = Logger("work_prepare")
19
+
20
+ CACHE_DIR = "/tmp/bmcgo"
21
+ CONAN_REPO = "openubmc_dev"
22
+ CONAN_USER = 'openUBMC'
23
+
24
+ STORE_TRUE = "store_true"
25
+ STORE_FALSE = "store_false"
26
+ SCHEMA_FILE_PATH = "/usr/share/bmcgo/schema"
27
+ GLOBAL_CFG_FILE = "/etc/bmcgo.conf"
28
+ CONAN = "conan"
29
+ # bmcgo.conf中用于定义路径的选项名
30
+ GLOBAL_BMCGO_CONF_FOLDER = "folder"
31
+ REF_TAGS = "refs/tags/"
32
+ CONAN_DEPDENCIES_KEY = "dependencies"
33
+ GIT_REVISION = "revision"
34
+ GRP_MISC = "Misc commands"
35
+ GRP_CONAN_IDX = "Conan Index commmands"
36
+ GRP_IBMC_SDK = "SDK commmands"
37
+ GRP_COMP = "Component commands"
38
+ GRP_INTE = "Integrated commands"
39
+ GRP_STUDIO = "Studio commands"
40
+
41
+ DESCRIPTION = "description"
42
+ PATTERN = "pattern"
43
+ ENV_CONST = "env"
44
+ HTTP_PROXY_CONST = "http_proxy"
45
+ HTTPS_PROXY_CONST = "https_proxy"
46
+ FTP_PROXY_CONST = "ftp_proxy"
47
+ NO_PROXY_CONST = "no_proxy"
48
+ TIMESTAMP_SIGN_SERVER = "timestamp_sign_server"
49
+ JARSIGNER_HTTP_PROXY = "jarsigner_http_proxy"
50
+ CUSTOM_PLUGINS = "plugins_path"
51
+ DEFAULT_PLUGINS_PATH = "/usr/share/bmcgo/plugins/"
52
+
53
+ DEPLOY_HOST_CONST = "deploy-host"
54
+ PORT_CONST = "port"
55
+ USERNAME_CONST = "username"
56
+ PASSWORD_CONST = "password"
57
+
58
+ DEPENDENCY_XML = "dependency.xml"
59
+ CODE_XML = "code.xml"
60
+ REPO_BASE = "repoBase"
61
+ ENV_LOGNAME = "LOGNAME"
62
+ NAME = "name"
63
+ COLOR_RED = "RED"
64
+ CLI = "cli"
65
+
66
+ BUILD = "build"
67
+ ANALYSIS = "analysis"
68
+ DEPLOY = "deploy"
69
+ TEST = "test"
70
+ GEN = "gen"
71
+ HELP = "help"
72
+
73
+
74
+ class StageEnum(Enum):
75
+ STAGE_DEV = "dev"
76
+ STAGE_PRE = "pre"
77
+ STAGE_RC = "rc"
78
+ STAGE_STABLE = "stable"
79
+
80
+
81
+ class ConanUserEnum(Enum):
82
+ CONAN_USER_RELEASE = f'{CONAN_USER}.release'
83
+ CONAN_USER_DEV = f'{CONAN_USER}.dev'
84
+
85
+
86
+ class CommandInfo():
87
+ def __init__(self, group, name, description, hidden, help_info=None, module=None):
88
+ # 命令组
89
+ self.group = group
90
+ # 命令对外呈现的名称
91
+ self.name = name
92
+ # 命令描述,字符串数组
93
+ self.description = description
94
+ # 命令帮助,可以为空
95
+ self.help_info = help_info
96
+ # 是否在help中隐藏
97
+ self.hidden = hidden
98
+ # 模块,由cli.py加载
99
+ self.module = module
100
+
101
+
102
+ def get_decleared_schema_file(file) -> str:
103
+ with open(file, "r") as fp:
104
+ lines = fp.readlines()
105
+ for line in lines:
106
+ match = re.match("#[ ]*yaml-language-server[ ]*:[ ]*\\$schema[ ]*=[ ]*(.*)$", line)
107
+ if match is None:
108
+ continue
109
+ schema_file = match.group(1).strip()
110
+ log.debug("读取行: " + line)
111
+ if os.path.isfile(schema_file):
112
+ return str(schema_file)
113
+ schema_file = os.path.join(os.path.dirname(file), schema_file)
114
+ schema_file = os.path.realpath(schema_file)
115
+ if os.path.isfile(schema_file):
116
+ return str(schema_file)
117
+ return ""
bmcgo/target/app.yml ADDED
@@ -0,0 +1,17 @@
1
+ - remark: app组件构建任务
2
+ name: work.prepare_env
3
+ klass: bmcgo.tasks.task_prepare
4
+ - name: work.build.download
5
+ subworks:
6
+ - name: task_download_buildtools
7
+ klass: bmcgo.tasks.task_download_buildtools
8
+ - name: task_download_dependency
9
+ klass: bmcgo.tasks.task_download_dependency
10
+ wait:
11
+ - work.prepare_env
12
+ - name: work.build.app
13
+ klass: bmcgo.tasks.task_build_conan
14
+ work_config:
15
+ skip_package: true
16
+ wait:
17
+ - work.build.download
@@ -0,0 +1,15 @@
1
+ # remark: 环境准备,从产品目录读取配置并安装必要的构建工具,如RTOS/SDK/Bisheng CPU等
2
+ target_config:
3
+ # 是否使用schema校验manifest.yml,默认true,个人构建禁用
4
+ schema_need_validate: false
5
+ subworks:
6
+ - name: work.prepare_env
7
+ klass: bmcgo.tasks.task_prepare
8
+ - name: task_download_buildtools
9
+ klass: bmcgo.tasks.task_download_buildtools
10
+ wait:
11
+ - work.prepare_env
12
+ - name: task_download_dependency
13
+ klass: bmcgo.tasks.task_download_dependency
14
+ wait:
15
+ - work.prepare_env
@@ -0,0 +1,53 @@
1
+ # 个人构建
2
+ target_config:
3
+ # 是否使用schema校验manifest.yml,默认true,个人构建禁用
4
+ schema_need_validate: false
5
+ # 是否启用调测模式,默认为false,个人构建启用
6
+ enable_debug_model: true
7
+ subworks:
8
+ - name: work.prepare_env
9
+ klass: bmcgo.tasks.task_prepare
10
+ - name: task_download_dependency
11
+ klass: bmcgo.tasks.task_download_dependency
12
+ wait:
13
+ - work.prepare_env
14
+ - name: work.build.download
15
+ subworks:
16
+ - name: task_download_buildtools
17
+ klass: bmcgo.tasks.task_download_buildtools
18
+ wait:
19
+ - work.prepare_env
20
+ - name: work.build.conan
21
+ klass: bmcgo.tasks.task_build_conan
22
+ wait:
23
+ - work.build.download
24
+ - name: work.task_build_rootfs_img
25
+ klass: bmcgo.tasks.task_build_rootfs_img
26
+ subworks:
27
+ - name: work.task_hpm_envir_prepare
28
+ klass: bmcgo.tasks.task_hpm_envir_prepare
29
+ subworks:
30
+ - name: work.task_buildgppbin
31
+ klass: bmcgo.tasks.task_buildgppbin
32
+ subworks:
33
+ - name: work.task_buildhpm_ext4
34
+ klass: bmcgo.tasks.task_buildhpm_ext4
35
+ subworks:
36
+ - name: work.task_sign_and_pack_hpm
37
+ klass: bmcgo.tasks.task_sign_and_pack_hpm
38
+ - name: work.task_build_qemu_rootfs
39
+ klass: works.packet.work_build_qemu_rootfs.TaskClass
40
+ # 当类不存在时不执行
41
+ ignore_not_exist: true
42
+ - name: works.packet.work_run_qemu_bmc
43
+ klass: works.packet.work_run_qemu_bmc.TaskClass
44
+ wait:
45
+ - work.task_build_qemu_rootfs
46
+ ignore_not_exist: true
47
+ wait:
48
+ - work.build.conan
49
+ - task_download_dependency
50
+ - name: work.create_interface_config
51
+ klass: bmcgo.tasks.task_create_interface_config
52
+ wait:
53
+ - work.task_build_rootfs_img
@@ -0,0 +1,45 @@
1
+ - remark: 版本构建
2
+ name: work.prepare_env
3
+ klass: bmcgo.tasks.task_prepare
4
+ subworks: []
5
+ wait: []
6
+ - name: work.build.download
7
+ subworks:
8
+ - name: task_download_buildtools
9
+ klass: bmcgo.tasks.task_download_buildtools
10
+ - name: task_download_dependency
11
+ klass: bmcgo.tasks.task_download_dependency
12
+ wait:
13
+ - work.prepare_env
14
+ - name: work.build.app
15
+ klass: bmcgo.tasks.task_build_conan
16
+ wait:
17
+ - work.build.download
18
+ - name: work.task_build_rootfs_img
19
+ klass: bmcgo.tasks.task_build_rootfs_img
20
+ subworks:
21
+ - name: work.task_hpm_envir_prepare
22
+ klass: bmcgo.tasks.task_hpm_envir_prepare
23
+ subworks:
24
+ - name: work.task_buildgppbin
25
+ klass: bmcgo.tasks.task_buildgppbin
26
+ subworks:
27
+ - name: work.task_buildhpm_ext4
28
+ klass: bmcgo.tasks.task_buildhpm_ext4
29
+ subworks:
30
+ - name: work.task_sign_and_pack_hpm
31
+ klass: bmcgo.tasks.task_sign_and_pack_hpm
32
+ subworks:
33
+ - name: work.task_packet_to_supporte
34
+ klass: bmcgo.tasks.task_packet_to_supporte
35
+ - name: work.task_build_qemu_rootfs
36
+ klass: works.packet.work_build_qemu_rootfs.TaskClass
37
+ # 当类不存在时不执行
38
+ ignore_not_exist: true
39
+ - name: works.packet.work_run_qemu_bmc
40
+ klass: works.packet.work_run_qemu_bmc.TaskClass
41
+ wait:
42
+ - work.task_build_qemu_rootfs
43
+ ignore_not_exist: true
44
+ wait:
45
+ - work.build.app
@@ -0,0 +1,11 @@
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.
11
+
@@ -0,0 +1,124 @@
1
+ # Copyright (c) 2024 Huawei Technologies Co., Ltd.
2
+ # openUBMC is licensed under Mulan PSL v2.
3
+ # You can use this software according to the terms and conditions of the Mulan PSL v2.
4
+ # You may obtain a copy of Mulan PSL v2 at:
5
+ # http://license.coscl.org.cn/MulanPSL2
6
+ # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
7
+ # EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
8
+ # MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
9
+ # See the Mulan PSL v2 for more details.
10
+ """
11
+ 功 能:下载并安装V2X的rtos/hcc工具
12
+ 修改记录:2024-08-29 创建
13
+ """
14
+ import os
15
+ import shutil
16
+
17
+ from bmcgo.tasks.task import Task
18
+ from bmcgo.utils.config import Config
19
+ from bmcgo import misc
20
+
21
+
22
+ class DownloadHmBuildTools(Task):
23
+ def __init__(self, config: Config):
24
+ super(DownloadHmBuildTools, self).__init__(config, "DownloadHmBuildTools")
25
+ self.dependency_file = os.path.realpath(
26
+ os.path.join(self.config.code_path, self.get_manufacture_config("base/dependency_buildtools"))
27
+ )
28
+ self.rtos_sdk_dir = f"{self.config.tools_path}/rtos-sdk-arm64-hm"
29
+ _, buildtool_config = self.get_profile_config()
30
+ self.standalone_toolchain = buildtool_config.get("standalone_toolchain", self.config.cross_compile_install_path)
31
+ self.sdkroot = buildtool_config.get("sdkroot", "/opt/hi1711sdk")
32
+ self.rtos_root = buildtool_config.get("rtos_root", f"/opt/{self.config.rtos_offering}")
33
+ self.sysroot = buildtool_config.get("sysroot", self.config.sysroot)
34
+ self.target_host = buildtool_config.get("target_host", self.config.cross_prefix)
35
+ self.dep_md5 = f"{self.rtos_root}/dependency.md5sum"
36
+ self.dep_md5_new = f"{self.tools.user_home}/dependency.md5sum.new"
37
+ self.skip_install = False
38
+
39
+ def download_tools(self):
40
+ self.info(f"移除下载路径: {self.rtos_sdk_dir}")
41
+ self.run_command(f"rm -rf {self.rtos_sdk_dir}", ignore_error=True, sudo=True)
42
+ self.info("开始下载依赖工具...")
43
+ partner_tools_dir = f"{os.path.expanduser('~')}/rtos_compiler"
44
+ if self.config.partner_mode:
45
+ self.info(f"从缓存目录{partner_tools_dir}复制编译器工具")
46
+ self.run_command(f"cp -rf {partner_tools_dir}/. {self.rtos_sdk_dir}")
47
+ self.info("下载依赖工具结束")
48
+
49
+ def check_rtos_sdk(self):
50
+ is_ubuntu = self.tools.is_ubuntu
51
+ self.chdir(self.rtos_sdk_dir)
52
+ self.info("安装 rpm 包")
53
+ self.info(f"删除目录 {self.rtos_root}")
54
+ self.run_command(f"rm -rf {self.rtos_root}", sudo=True)
55
+ for rpm in os.listdir("./"):
56
+ if not os.path.isfile(rpm) or not rpm.endswith(".rpm"):
57
+ continue
58
+ self.info("安装 {}".format(rpm))
59
+ if not is_ubuntu:
60
+ self.run_command("rpm -ivh {}".format(rpm), sudo=True)
61
+ else:
62
+ self.pipe_command(["rpm2cpio {}".format(rpm), "sudo cpio -id -D /"])
63
+
64
+ self.info(f"删除目录 {self.standalone_toolchain}")
65
+ self.run_command(f"rm -rf {self.standalone_toolchain}", sudo=True)
66
+ self.info("解压 hcc_arm64le")
67
+ self.run_command("tar -xzf hcc_arm64le.tar.gz -C /opt", sudo=True)
68
+
69
+ hm_tiny = "/opt/hcc_arm64le_hm_tiny"
70
+ self.info(f"删除目录 {hm_tiny}")
71
+ self.run_command(f"rm -rf {hm_tiny}", sudo=True)
72
+ self.info("解压 hcc_arm64le_hm_tiny")
73
+ self.run_command("tar -xzf hcc_arm64le_hm_tiny.tar.gz -C /opt", sudo=True)
74
+
75
+ self.info(f"删除目录 {self.sdkroot}")
76
+ self.run_command(f"rm -rf {self.sdkroot}", ignore_error=True, sudo=True)
77
+ self.run_command(f"mkdir -p {self.sdkroot}", ignore_error=True, sudo=True)
78
+ self.info("解压 hi1711sdk")
79
+ self.run_command(f"tar -xzf hi1711sdk.tar.gz -C {self.sdkroot} Module.symvers", sudo=True)
80
+ logname = os.getenv(misc.ENV_LOGNAME, None)
81
+ if logname and logname != "root":
82
+ self.run_command(f"chown {logname} {self.rtos_root} -R", sudo=True)
83
+ self.run_command(f"chown {logname} {self.sdkroot} -R", sudo=True)
84
+ self.run_command(f"chown {logname} {self.standalone_toolchain} -R", sudo=True)
85
+ self.run_command(f"chown {logname} {hm_tiny} -R", sudo=True)
86
+
87
+ self.chdir(self.config.code_path)
88
+
89
+ libstdcpp_install_path = os.path.join(self.sysroot, "usr")
90
+ os.makedirs(libstdcpp_install_path, exist_ok=True)
91
+
92
+ cross_compile_lib64 = os.path.join(self.standalone_toolchain, self.target_host, "lib64")
93
+ self.run_command(f"cp -rf {cross_compile_lib64} {libstdcpp_install_path}")
94
+
95
+ cmake_platform, _ = self.pipe_command(
96
+ ["find /usr/share -type d -wholename */Modules/Platform", "head -n 1"], sudo=True, capture_output=True
97
+ )
98
+ self.info(f"复制HongMeng.cmake到 {cmake_platform}")
99
+ hm_cmake = os.path.join(libstdcpp_install_path, "share/cmake/Modules/Platform/HongMeng.cmake")
100
+ self.run_command(f"cp -af {hm_cmake} {cmake_platform}", sudo=True)
101
+
102
+ self.run_command("cp -af {} {}".format(self.dep_md5_new, self.dep_md5))
103
+ # md5文件对齐其他分支
104
+ dep_md5_br = f"{self.tools.user_home}/dependency.md5sum"
105
+ self.run_command(f"cp -af {self.dep_md5_new} {dep_md5_br}")
106
+
107
+ def run(self):
108
+ self.pipe_command([f"md5sum {self.dependency_file}"], self.dep_md5_new)
109
+ if os.path.isfile(self.dep_md5):
110
+ with open(self.dep_md5, "r") as fp:
111
+ md5old = fp.read()
112
+ with open(self.dep_md5_new, "r") as fp:
113
+ md5new = fp.read()
114
+ if md5old == md5new:
115
+ self.info("版本匹配, 跳过安装")
116
+ self.skip_install = True
117
+ return
118
+ self.download_tools()
119
+
120
+ def install(self):
121
+ if self.skip_install:
122
+ return
123
+ # 检查rtos是否安装,未安装或版本不匹配时安装
124
+ self.check_rtos_sdk()
bmcgo/tasks/misc.py ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env python3
2
+ # coding: utf-8
3
+ # Copyright (c) 2025 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
+ SDK_PATH = "/opt/hi171x_sdk/"
13
+ MODULE_SYMVERS = "Module.symvers"
14
+ BUILD_TOOLS_SHA256_PATH = "/opt/buildtools.sha256"
15
+ SDK_SHA256_PATH = "/opt/sdk.sha256"