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/component/gen.py ADDED
@@ -0,0 +1,169 @@
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 argparse
13
+ import json
14
+ import os
15
+ import re
16
+ import stat
17
+ from bmcgo.codegen.c.codegen import CodeGen as CodeGenC
18
+ from bmcgo.codegen.lua.codegen import CodeGen as CodeGenLua
19
+ from bmcgo.ipmigen.ipmigen import IpmiGen
20
+ from bmcgo.component.package_info import InfoComp
21
+ from bmcgo.codegen import __version__ as codegen_version
22
+ from bmcgo.logger import Logger
23
+ from bmcgo import misc
24
+ from bmcgo.component.component_helper import ComponentHelper
25
+
26
+ log = Logger("gen")
27
+
28
+ cwd = os.getcwd()
29
+ cwd_script = os.path.split(os.path.realpath(__file__))[0]
30
+
31
+
32
+ class ParameterError(OSError):
33
+ """参数错误"""
34
+
35
+
36
+ class SmartFormatter(argparse.HelpFormatter):
37
+ def _fill_text(self, text, width, indent):
38
+ import textwrap
39
+ text = textwrap.dedent(text)
40
+ return ''.join(indent + line for line in text.splitlines(True))
41
+
42
+
43
+ class GenComp():
44
+ def __init__(self, args):
45
+ self.args = args
46
+
47
+ @staticmethod
48
+ def update_conanbase(gen_version: int):
49
+ conanbase_path = os.path.join(cwd, "conanbase.py")
50
+ if not os.path.isfile(conanbase_path):
51
+ return
52
+ conanbase_file = os.fdopen(os.open(conanbase_path, os.O_RDWR, stat.S_IWUSR | stat.S_IRUSR), 'w+')
53
+ content = conanbase_file.read()
54
+ content = re.sub(r"_codegen_version *= *\S+", f"_codegen_version = {gen_version}", content)
55
+ conanbase_file.seek(0)
56
+ conanbase_file.truncate()
57
+ conanbase_file.write(content)
58
+ conanbase_file.close()
59
+
60
+ @staticmethod
61
+ def get_codegen_version(args, base_version: int):
62
+ if base_version != -1:
63
+ return base_version
64
+ if args.version != -1:
65
+ return int(args.version)
66
+ if not os.path.isfile(args.service_file):
67
+ return codegen_version
68
+ file_handler = open(args.service_file, "r")
69
+ service = json.load(file_handler)
70
+ file_handler.close()
71
+ _, version = InfoComp.get_codegen_policy(service)
72
+ return version
73
+
74
+ @staticmethod
75
+ def _gen_service(service_file, gen_version):
76
+ """
77
+ 代码自动生成.
78
+
79
+ 支持自动生成服务端和客户端C代码
80
+ """
81
+ file_handler = open(service_file, "r")
82
+ service = json.load(file_handler)
83
+ file_handler.close()
84
+ # 如果默认版本号为-1则使用service.json读取的版本号
85
+
86
+ codegen = CodeGenC(gen_version)
87
+ ipmigen = IpmiGen(gen_version)
88
+ codegen.gen_mds(service_file)
89
+ configs = service.get("codegen", [])
90
+ for cfg in configs:
91
+ file = cfg.get("file")
92
+ if file is None:
93
+ raise OSError("自动代码生成配置不正确, 缺少file元素指定描述文件")
94
+ if not os.path.isfile(file):
95
+ raise OSError(f"自动代码生成配置不正确, {file}不是一个文件")
96
+ tpye = cfg.get("type", "interface_xml")
97
+ output = cfg.get("output", ".")
98
+ if tpye == "interface_xml":
99
+ if not file.endswith(".xml"):
100
+ raise OSError(f"接口自动代码生成配置不正确, {file}的文件名不是以.xml结束")
101
+ codegen.gen(file, output)
102
+ elif tpye == "ipmi":
103
+ if not file.endswith(".json"):
104
+ raise OSError(f"IPMI自动代码生成配置不正确, {file}的文件名不是以.json结束")
105
+ ipmigen.gen(file, output)
106
+
107
+ def run(self, base_version=-1):
108
+ language = ComponentHelper.get_language().lower()
109
+ parser = argparse.ArgumentParser(description="代码自动生成.",
110
+ prog="bingo gen/当前只支持C和lua语言代码生成",
111
+ formatter_class=SmartFormatter)
112
+ parser.add_argument("-v", "--version", help="use specified version", type=int, default=-1)
113
+ parser.add_argument("-r", "--remote", help="conan remote, 如不设置则默认读取本地conan配置")
114
+
115
+ if language == "c":
116
+ self.generate_c_run(parser, base_version)
117
+ elif language == "lua":
118
+ self.generate_lua_run(parser, base_version)
119
+
120
+ def generate_lua_run(self, parser: argparse.ArgumentParser, base_version):
121
+ parser.add_argument("-s", "--service_file", help='Service file')
122
+ parser.add_argument("-w", "--with_template", help="generate with template", action=misc.STORE_TRUE)
123
+ args, _ = parser.parse_known_args(self.args)
124
+
125
+ if args.service_file is not None and not os.path.isfile(args.service_file):
126
+ raise FileNotFoundError(f"配置文件{args.service_file}不存在")
127
+ gen_version = self.get_codegen_version(args, base_version)
128
+ self.update_conanbase(gen_version)
129
+ codegen = CodeGenLua(cwd, gen_version, remote=args.remote)
130
+ codegen.gen(args)
131
+
132
+ def generate_c_run(self, parser: argparse.ArgumentParser, base_version):
133
+ group1 = parser.add_mutually_exclusive_group()
134
+ group1.add_argument("-s", "--service_file", help='Service file')
135
+ group1.add_argument("-i", "--interface", help='interface name, e.g.: com.kepler.upgrade')
136
+ group2 = parser.add_mutually_exclusive_group()
137
+ group2.add_argument("-d", "--directory", help='generate code directory', default=".")
138
+ parser.add_argument("-f", "--force", help='ignore the version configuration in the service.json file.',
139
+ action=misc.STORE_TRUE)
140
+
141
+ args, _ = parser.parse_known_args(self.args)
142
+ gen_version = self.get_codegen_version(args, base_version)
143
+ self.update_conanbase(gen_version)
144
+ if args.service_file is not None:
145
+ if not os.path.isfile(args.service_file):
146
+ raise FileNotFoundError(f"配置文件{args.service_file}不存在")
147
+ self._gen_service(args.service_file, gen_version)
148
+ return 0
149
+ if args.interface is None:
150
+ raise ParameterError("需要指定-s或-i参数")
151
+ xml_file = None
152
+ file = args.interface
153
+ if file.endswith("ipmi.json"):
154
+ ipmigen = IpmiGen(gen_version)
155
+ ipmigen.gen(file, args.directory)
156
+ return 0
157
+ if file.endswith(".xml") and os.path.isfile(file):
158
+ xml_file = file
159
+ else:
160
+ file += ".xml"
161
+ if os.path.isfile(file):
162
+ xml_file = file
163
+ if not xml_file:
164
+ raise FileNotFoundError(f"接口 {args.interface} 不存在")
165
+ if not os.path.isdir(args.directory):
166
+ raise NotADirectoryError(f"文件夹 {args.directory} 不存在")
167
+ codegen = CodeGenC(gen_version)
168
+ codegen.gen(xml_file, args.directory)
169
+ return 0
@@ -0,0 +1,236 @@
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 argparse
13
+ import datetime
14
+ import json
15
+ import os
16
+ import re
17
+ import configparser
18
+ from configparser import NoSectionError, NoOptionError
19
+ from typing import Tuple
20
+
21
+ from bmcgo.codegen import __version__ as codegen_version
22
+ from bmcgo.logger import Logger
23
+ from bmcgo.utils.tools import Tools
24
+ from bmcgo import misc
25
+ from bmcgo.component.component_helper import ComponentHelper
26
+
27
+ global log
28
+ log = Logger()
29
+
30
+ cwd = os.getcwd()
31
+ cwd_script = os.path.split(os.path.realpath(__file__))[0]
32
+
33
+
34
+ class CodegenVersionNotMatchError(OSError):
35
+ """版本号不满足要求"""
36
+
37
+
38
+ class CodegenPolicyError(OSError):
39
+ """代码自动生成策略配置错误"""
40
+
41
+
42
+ class InfoComp():
43
+ def __init__(self, args=None, service_json="mds/service.json", partner_mode=False):
44
+ parser = self.arg_parser(True, partner_mode)
45
+ self.parse_args(parser, args, service_json)
46
+
47
+ @staticmethod
48
+ def arg_parser(add_help=False, partner_mode=False):
49
+ stage_values = [member.value for member in misc.StageEnum]
50
+ parser = argparse.ArgumentParser(prog="bingo build", description="Build conan", add_help=add_help,
51
+ formatter_class=argparse.RawTextHelpFormatter)
52
+ parser.add_argument("-bt", "--build_type", default="debug", help="构建类型,可选:dt,debug,release\n默认:debug")
53
+ parser.add_argument(
54
+ "--stage",
55
+ help=f"组件包发布阶段, 可选: {stage_values}\n默认:{misc.StageEnum.STAGE_DEV.value}",
56
+ default=misc.StageEnum.STAGE_DEV.value
57
+ )
58
+ parser.add_argument("-u", "--upload", action=misc.STORE_TRUE, help="上传组件包到conan仓")
59
+ parser.add_argument(
60
+ "-r", "--remote", help=f"conan仓别名,请检查conan remote list查看已配置的conan仓"
61
+ )
62
+ parser.add_argument(
63
+ "-s",
64
+ "--from_source",
65
+ help=(
66
+ argparse.SUPPRESS
67
+ if partner_mode
68
+ else "Build from source, include dependency component"
69
+ ),
70
+ action=misc.STORE_TRUE,
71
+ )
72
+ parser.add_argument("-nc", "--no_cache",
73
+ help="不使用~/.conan/data目录下的缓存包(构建前删除缓存)", action=misc.STORE_FALSE)
74
+ parser.add_argument("-o", "--options", help="Define options values (host machine), e.g.: -o Pkg:with_qt=true",
75
+ action='append', default=[])
76
+ parser.add_argument(
77
+ "--user",
78
+ help=f"指定conan包的user字段,尝试从{misc.GLOBAL_CFG_FILE}文件读取conan.user字段,否则由程序管理",
79
+ default=None
80
+ )
81
+ parser.add_argument("-cov", "--coverage", help=argparse.SUPPRESS, action=misc.STORE_TRUE)
82
+ parser.add_argument(
83
+ "-as",
84
+ "--asan",
85
+ help=argparse.SUPPRESS if partner_mode else "Enable address sanitizer",
86
+ action=misc.STORE_TRUE,
87
+ )
88
+ parser.add_argument("-maint", "--maintain", help=argparse.SUPPRESS, action=misc.STORE_TRUE)
89
+ parser.add_argument(
90
+ "-pr",
91
+ "--profile",
92
+ help=argparse.SUPPRESS if partner_mode else Tools.get_profile_arg_help(),
93
+ default="",
94
+ )
95
+ parser.add_argument(
96
+ "-jit",
97
+ "--enable_luajit",
98
+ help=argparse.SUPPRESS if partner_mode else "Enable luajit",
99
+ action=misc.STORE_FALSE if partner_mode else misc.STORE_TRUE,
100
+ )
101
+ return parser
102
+
103
+ @staticmethod
104
+ def get_codegen_policy(service_data) -> Tuple[str, int]:
105
+ # 代码自动生成工具版本号检查
106
+ policy = ComponentHelper.get_config_value(service_data, "codegen_policy", {})
107
+ code_version = policy.get("version", ">=0")
108
+ if not isinstance(code_version, str):
109
+ code_version = str(code_version)
110
+ code_language = policy.get("language", "c")
111
+ if not re.fullmatch("^(>=)?[0-9]+$", code_version):
112
+ raise CodegenPolicyError("codegen_policy.version配置错误,需要满足如下要求 ^(>=)?[0-9]+$")
113
+ if code_language != "c":
114
+ raise CodegenPolicyError("codegen_policy.language当前只支持C语言$")
115
+ # 生成代码需要使用的自动生成工具基础版本号
116
+ if code_version.startswith(">="):
117
+ codegen_base_version = int(code_version[2:])
118
+ if codegen_base_version > codegen_version:
119
+ raise CodegenVersionNotMatchError("代码自动生成要求的版本号大于当前bmcgo工具提供的版本号,建议升级到最新版本")
120
+ codegen_base_version = codegen_version
121
+ else:
122
+ codegen_base_version = int(code_version)
123
+ return code_language, codegen_base_version
124
+
125
+ def parse_args(self, parser, args, service_json):
126
+ self.args, _ = parser.parse_known_args(args)
127
+ self.build_type = self.args.build_type
128
+ self.stage = self.args.stage
129
+ self.upload = self.args.upload
130
+ self.from_source = self.args.from_source
131
+ self.options = self.args.options
132
+ self.coverage = self.args.coverage
133
+ self.asan = self.args.asan
134
+ self.remote = self.args.remote
135
+ self.no_cache = self.args.no_cache and (not os.getenv('NOT_CLEAN_CONAN_CACHE') == 'True')
136
+ # 是否是维护模式
137
+ self.is_maintain = self.args.maintain
138
+ self.enable_luajit = self.args.enable_luajit
139
+ self.profile = Tools.get_conan_profile(self.args.profile, self.build_type, self.enable_luajit)
140
+
141
+ os.environ["ROOTFS_DIR"] = os.path.join(cwd, "temp")
142
+ stage_values = [member.value for member in misc.StageEnum]
143
+ if self.stage not in stage_values:
144
+ raise OSError(f"参数 stage 错误, 请从 {stage_values} 中选择")
145
+ # 构建阶段检查
146
+ build_types = ["dt", "debug", "release"]
147
+ if self.build_type not in build_types:
148
+ raise OSError("参数 build_type 错误, 请从 [debug, release, dt] 中选择")
149
+ if self.upload and not self.remote:
150
+ raise OSError("参数 remote 必填")
151
+
152
+ # 只有指定为pre时才增加prerelease编码
153
+ pre = ""
154
+ if self.stage == misc.StageEnum.STAGE_PRE:
155
+ self.stage = misc.StageEnum.STAGE_DEV
156
+ now = datetime.datetime.utcnow()
157
+ pre = "-pre." + now.strftime("%Y%m%d%H%M%S")
158
+
159
+ # 尝试从/etc/bmcgo.conf读取user配置
160
+ user = self._get_package_user()
161
+ self.channel = f"@{user}/{self.stage}"
162
+
163
+ self._parse_service_json(service_json, pre)
164
+ self._conan_define()
165
+
166
+ def get_dependencies(self, service_data, key):
167
+ dependencies = []
168
+ user_channel = ComponentHelper.get_user_channel(self.stage)
169
+ deps = ComponentHelper.get_config_value(service_data, key, [])
170
+ for dep in deps:
171
+ conan = dep.get(misc.CONAN)
172
+ if conan is None:
173
+ log.info("获取 conan 依赖失败, 跳过未知组件")
174
+ continue
175
+ if conan.find("@") > 0:
176
+ dependencies.append(conan)
177
+ else:
178
+ dependencies.append(conan + user_channel)
179
+ return dependencies
180
+
181
+ def _conan_define(self):
182
+ self.package = "%s/%s%s" % (self.name, self.version, self.channel)
183
+ profiles = [f"-pr:h {self.profile}"]
184
+ if self.build_type == "dt":
185
+ self.setting = "-s build_type=Dt"
186
+ else:
187
+ profiles.append("-pr:b profile.dt.ini")
188
+ if self.enable_luajit:
189
+ self.options.append("skynet:enable_luajit=True")
190
+ if self.build_type == "debug":
191
+ self.setting = "-s build_type=Debug"
192
+ else:
193
+ self.setting = "-s build_type=Release"
194
+ self.full_profile = " ".join(profiles)
195
+ self.cmd_base = ". %s %s %s " % (self.package, self.full_profile, self.setting)
196
+ if self.remote:
197
+ self.cmd_base += "-r %s " % self.remote
198
+ if self.options:
199
+ for option in self.options:
200
+ self.cmd_base += " -o " + option
201
+ if self.coverage:
202
+ self.cmd_base += f" -o {self.name}:gcov=True"
203
+ if self.asan:
204
+ self.cmd_base += f" -o {self.name}:asan=True"
205
+
206
+ def _get_package_user(self):
207
+ """ 尝试从/etc/bmcgo.conf读取user配置 """
208
+ user = self.args.user
209
+ try:
210
+ if user is None and os.access(misc.GLOBAL_CFG_FILE, os.R_OK):
211
+ conf = configparser.ConfigParser()
212
+ conf.read(misc.GLOBAL_CFG_FILE)
213
+ user = conf.get(misc.CONAN, "user")
214
+ except (NoSectionError, NoOptionError):
215
+ user = None
216
+ if user is None:
217
+ if self.stage == misc.StageEnum.STAGE_DEV.value:
218
+ user = misc.ConanUserEnum.CONAN_USER_DEV.value
219
+ else:
220
+ user = misc.ConanUserEnum.CONAN_USER_RELEASE.value
221
+ return user
222
+
223
+ def _parse_service_json(self, service_json: str, pre: str):
224
+ self.language = ComponentHelper.get_language(service_json=service_json)
225
+ with open(service_json, "r", encoding="UTF-8") as file_handler:
226
+ data = json.load(file_handler)
227
+ self.version = ComponentHelper.get_config_value(data, "version") + pre
228
+ self.name = data.get("name")
229
+ # 编译依赖
230
+ self.build_dependencies = self.get_dependencies(data, "dependencies/build")
231
+ # 开发者测试依赖
232
+ self.test_dependencies = self.get_dependencies(data, "dependencies/test")
233
+ self.design_options = ComponentHelper.get_config_value(data, "options", {})
234
+ self.package_type = ComponentHelper.get_config_value(data, "type", [])
235
+ self.package_info = ComponentHelper.get_config_value(data, "package_info")
236
+ self.code_language, self.codegen_base_version = self.get_codegen_policy(data)
@@ -0,0 +1,278 @@
1
+ import os
2
+ import stat
3
+ import urllib3
4
+ % if pkg.is_maintain:
5
+ import shutil
6
+ % endif
7
+ from conans import ConanFile, CMake
8
+ % if pkg.is_maintain:
9
+ from conans import tools
10
+ from conans.util.files import mkdir
11
+ from conan.tools.files import patch as apply_patch
12
+ from conans.errors import ConanException
13
+ % endif
14
+
15
+ urllib3.disable_warnings()
16
+
17
+ # 构建时由工具自动生成到业务仓,做为conanfile.py的基类参与组件构建
18
+ # 如需要调试,请修改模板文件(目录中存在python版本号、bmcgo集成开发环境应用名称,请适配):
19
+ # ~/.local/lib/python3.8/site-packages/bmcgo/component/template/conanbase.py.mako
20
+
21
+
22
+ class ConanBase(ConanFile):
23
+ name = "${pkg.name}"
24
+ % if not pkg.is_maintain:
25
+ version = "${pkg.version}"
26
+ % endif
27
+ settings = "os", "compiler", "build_type", "arch"
28
+ license = "Mulan PSL v2"
29
+ generators = "cmake"
30
+ language = "${language}"
31
+ _cmake = None
32
+ _codegen_version = ${codegen_version}
33
+ % if not pkg.is_maintain:
34
+ scm = {
35
+ "type": "git",
36
+ "url": "${remote_url}",
37
+ "revision": "auto"
38
+ }
39
+ % endif
40
+ options = {
41
+ "asan": [True, False],
42
+ "gcov": [True, False],
43
+ "manufacture": [True, False],
44
+ % for op, ctx in pkg.design_options.items():
45
+ "${op}": [${",".join(("\"" + i + "\"") if isinstance(i, str) else str(i) for i in ctx["option"])}],
46
+ % endfor
47
+ }
48
+ default_options = {
49
+ "asan": False,
50
+ "gcov": False,
51
+ "manufacture": False,
52
+ % for op, ctx in pkg.design_options.items():
53
+ "${op}": ${("\"" + ctx["default"] + "\"") if isinstance(ctx["default"], str) else str(ctx["default"])},
54
+ % endfor
55
+ }
56
+
57
+ def generate(self):
58
+ file_descriptor = os.open("conan_toolchain.cmake", os.O_RDWR | os.O_CREAT, stat.S_IWUSR | stat.S_IRUSR)
59
+ file_handler = os.fdopen(file_descriptor, "w")
60
+ file_handler.write("add_compile_definitions(\"_FORTIFY_SOURCE=2\")\n")
61
+ file_handler.close()
62
+
63
+ @property
64
+ def _source_subfolder(self):
65
+ return "source_subfolder"
66
+
67
+ @property
68
+ def _build_subfolder(self):
69
+ return "build_subfolder"
70
+
71
+ def export(self):
72
+ self.copy("mds/service.json")
73
+ self.copy("conanbase.py")
74
+
75
+ % if pkg.is_maintain:
76
+ def export_sources(self):
77
+ patches = self.conan_data.get("patches", {}).get(self.version, [])
78
+ for patch in patches:
79
+ patch_file = patch.get("patch_file")
80
+ if patch_file is None:
81
+ continue
82
+ # 与export_conandata_patches方法不同点:所有patches将从recipes_folder/../pacthes读取
83
+ src = os.path.join(self.recipe_folder, "..", patch_file)
84
+ dst = os.path.join(self.export_sources_folder, patch_file)
85
+ mkdir(os.path.dirname(dst))
86
+ shutil.copy2(src, dst)
87
+
88
+ def source(self):
89
+ git = tools.Git(verify_ssl=False)
90
+ git.clone(**self.conan_data["sources"][self.version])
91
+ % endif
92
+
93
+ % if len(pkg.build_dependencies) > 0 or len(pkg.test_dependencies) > 0:
94
+ def requirements(self):
95
+ uc = ""
96
+ if self.user and self.channel:
97
+ if self.channel == "dev":
98
+ uc = f"@{self.user}/rc"
99
+ else:
100
+ uc = f"@{self.user}/{self.channel}"
101
+ # 编译依赖
102
+ % for build_dep in pkg.build_dependencies:
103
+ % if "@" in build_dep:
104
+ self.requires("${build_dep}")
105
+ % else:
106
+ self.requires(f"${build_dep}{uc}")
107
+ % endif
108
+ % endfor
109
+
110
+ % endif
111
+
112
+ def _codegen(self):
113
+ from bmcgo.component.gen import GenComp
114
+ args = ["-s", "mds/service.json"]
115
+ gen = GenComp(args)
116
+ gen.run(self._codegen_version)
117
+
118
+ def _new_cmake(self):
119
+ return CMake(self)
120
+
121
+ def _configure_cmake(self):
122
+ if self._cmake:
123
+ return self._cmake
124
+ self._cmake = self._new_cmake()
125
+ self._cmake.definitions["BUILD_MANUFACTURE"] = self.options.manufacture
126
+ if self.settings.build_type == "Dt":
127
+ self._cmake.definitions["ENABLE_TEST"] = "ON"
128
+
129
+ % if len(pkg.design_options) > 0:
130
+ % for op, _ in pkg.design_options.items():
131
+ self._cmake.definitions["CONAN_DEFS_${op.upper()}"] = self.options.${op}
132
+ % endfor
133
+ % endif
134
+ # 向CMAKE传递版本号信息
135
+ version = self.version.split(".")
136
+ if len(version) >= 1:
137
+ self._cmake.definitions["PACKAGE_VERSION_MAJOR"] = version[0]
138
+ if len(version) >= 2:
139
+ self._cmake.definitions["PACKAGE_VERSION_MINOR"] = version[1]
140
+ if len(version) >= 3:
141
+ self._cmake.definitions["PACKAGE_VERSION_REVISION"] = version[2]
142
+ # 设置额外编译选项或者重定义CFLAGS CXXFLAGS,也可以设置其他开关
143
+ # 示例: os.environ['CFLAGS'] = f"{os.getenv('CFLAGS')} -fPIE"
144
+
145
+ if self.settings.arch == "armv8" or self.settings.arch == "x86_64":
146
+ self._cmake.definitions["CMAKE_INSTALL_LIBDIR"] = "usr/lib64"
147
+ else:
148
+ self._cmake.definitions["CMAKE_INSTALL_LIBDIR"] = "usr/lib"
149
+
150
+ if self.options.asan:
151
+ print("Enable asan flags")
152
+ flag = " -fsanitize=address -fsanitize-recover=address,all -fno-omit-frame-pointer -fno-stack-protector -O0"
153
+ os.environ['CFLAGS'] = os.getenv('CFLAGS') + flag
154
+ os.environ['CXXFLAGS'] = os.getenv('CXXFLAGS') + flag
155
+ if self.options.gcov:
156
+ print("Enable gcov flags")
157
+ os.environ['CFLAGS'] = f"{os.getenv('CFLAGS')} -ftest-coverage -fprofile-arcs"
158
+ os.environ['CXXFLAGS'] = f"{os.getenv('CXXFLAGS')} -ftest-coverage -fprofile-arcs"
159
+
160
+ # 配合generate添加宏定义
161
+ self._cmake.definitions["CMAKE_TOOLCHAIN_FILE"] = "conan_toolchain.cmake"
162
+ # rpath配置
163
+ self._cmake.definitions["CMAKE_SKIP_BUILD_RPATH"] = True
164
+ self._cmake.definitions["CMAKE_SKIP_RPATH"] = True
165
+ self._cmake.definitions["CMAKE_SKIP_INSTALL_RPATH"] = True
166
+ self._cmake.definitions["CMAKE_BUILD_WITH_INSTALL_RPATH"] = False
167
+ self._cmake.definitions["CMAKE_INSTALL_RPATH_USE_LINK_PATH"] = False
168
+ self._cmake.configure(args=["--no-warn-unused-cli"])
169
+ return self._cmake
170
+
171
+ % if pkg.is_maintain:
172
+ @staticmethod
173
+ def _get_patch_changed_files(patch_file):
174
+ files = {}
175
+ for line in open(patch_file):
176
+ if not line.startswith("diff --git"):
177
+ continue
178
+ line = line.strip()
179
+ chunk = line.split()
180
+ a_file = chunk[-2][2:]
181
+ b_file = chunk[-1][2:]
182
+ files[a_file] = b_file
183
+ return files
184
+
185
+ def _revise_renamed_files(self, changed_files):
186
+ for a_file, b_file in changed_files.items():
187
+ if a_file != b_file:
188
+ if a_file != "/dev/null" and b_file != "/dev/null":
189
+ os.rename(a_file, b_file)
190
+ cmd = f"git rm -f {a_file}"
191
+ self.run(cmd)
192
+ elif a_file != "/dev/null":
193
+ cmd = f"git rm -f {a_file}"
194
+ self.run(cmd)
195
+ continue
196
+ cmd = f"git add {b_file}"
197
+ self.run(cmd)
198
+
199
+ %endif
200
+ def build(self):
201
+ % if pkg.is_maintain:
202
+ for patch in self.conan_data.get("patches", {}).get(self.version, []):
203
+ patch_file = patch.get("patch_file")
204
+ if not patch_file:
205
+ continue
206
+ real_path = os.path.join(self.folders.base_source, patch_file)
207
+ print(f"Start patch file {patch_file}")
208
+ changed_files = self._get_patch_changed_files(real_path)
209
+ try:
210
+ apply_patch(self, patch_file=real_path)
211
+ self._revise_renamed_files(changed_files)
212
+ cmd = f"git commit -m \"{patch_file}\""
213
+ self.run(cmd)
214
+ except ConanException:
215
+ # 尝试还原文件修改
216
+ for a_file, b_file in changed_files.items():
217
+ cmd = f"git checkout -- {a_file}"
218
+ self.run(cmd, ignore_errors=True)
219
+ cmd = f"git checkout -- {b_file}"
220
+ self.run(cmd, ignore_errors=True)
221
+ cmd = "git am " + real_path
222
+ self.run(cmd)
223
+ % endif
224
+ if self.language != "c":
225
+ return
226
+ self._codegen()
227
+ cmake = self._configure_cmake()
228
+ cmake.build()
229
+
230
+ def package(self):
231
+ cmake = self._configure_cmake()
232
+ cmake.install()
233
+ if os.path.isfile("permissions.ini"):
234
+ self.copy("permissions.ini")
235
+ if os.path.isfile("mds/model.json"):
236
+ self.copy("model.json", src="mds", dst="include/mds")
237
+ if os.path.isfile("mds/service.json"):
238
+ self.copy("service.json", src="mds", dst="include/mds")
239
+ if os.path.isdir("build"):
240
+ self.copy("*", src="build", dst="include")
241
+ if os.path.isdir("mds"):
242
+ self.copy("*", src="mds", dst="usr/share/doc/openubmc/${pkg.name}/mds")
243
+ if os.path.isdir("docs"):
244
+ self.copy("*", src="docs", dst="usr/share/doc/openubmc/${pkg.name}/docs")
245
+ self.copy("*.md", dst="usr/share/doc/openubmc/${pkg.name}/docs")
246
+ self.copy("*.MD", dst="usr/share/doc/openubmc/${pkg.name}/docs")
247
+ if self.settings.build_type in ("Dt", ) and os.getenv('TRANSTOBIN') is None:
248
+ return
249
+ os.chdir(self.package_folder)
250
+ for root, dirs, files in os.walk("."):
251
+ for file in files:
252
+ if not file.endswith(".lua") or os.path.islink(file):
253
+ continue
254
+ file_path = os.path.join(root, file)
255
+ self.run(f"{os.path.expanduser('~')}/.conan/bin/luac -o {file_path} {file_path}")
256
+ self.run(f"{os.path.expanduser('~')}/.conan/bin/luac -s {file_path}")
257
+
258
+ def package_info(self):
259
+ if self.settings.arch == "armv8" or self.settings.arch == "x86_64":
260
+ self.cpp_info.libdirs = ["usr/lib64"]
261
+ self.env_info.LD_LIBRARY_PATH.append(os.path.join(self.package_folder, "usr/lib64"))
262
+ else:
263
+ self.cpp_info.libdirs = ["usr/lib"]
264
+ self.env_info.LD_LIBRARY_PATH.append(os.path.join(self.package_folder, "usr/lib"))
265
+ self.env_info.PATH.append(os.path.join(self.package_folder, "opt/bmc/apps/${pkg.name}"))
266
+ % if pkg.package_info is not None:
267
+ % if len(pkg.package_info.get("libs", [])) > 0:
268
+ self.cpp_info.libs = [${", ".join("\"" + i + "\"" for i in pkg.package_info["libs"])}]
269
+ % endif
270
+ % endif
271
+ % if "application" in pkg.package_type and pkg.package_info is not None:
272
+ % if len(pkg.package_info.get("bindirs", [])) > 0:
273
+ self.cpp_info.bindirs = [${", ".join("\"" + i + "\"" for i in pkg.package_info["bindirs"])}]
274
+ % for dir in pkg.package_info["bindirs"]:
275
+ self.env_info.PATH.append(os.path.join(self.package_folder, "${dir}"))
276
+ % endfor
277
+ % endif
278
+ % endif