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
@@ -0,0 +1,222 @@
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 json
13
+ import os
14
+ import shutil
15
+ import subprocess
16
+ import stat
17
+ import pathlib
18
+
19
+ from mako.lookup import TemplateLookup
20
+
21
+ from bmcgo.codegen.c.helper import Helper
22
+ from bmcgo.logger import Logger
23
+ from bmcgo.utils.tools import Tools
24
+ from bmcgo.bmcgo_config import BmcgoConfig
25
+ from bmcgo.errors import BmcGoException
26
+ from bmcgo.component.package_info import InfoComp
27
+ from bmcgo.component.component_helper import ComponentHelper
28
+ from bmcgo import misc
29
+
30
+ log = Logger()
31
+ tool = Tools()
32
+
33
+ cwd_script = os.path.split(os.path.realpath(__file__))[0]
34
+
35
+
36
+ class BuildComp():
37
+ def __init__(self, bconfig: BmcgoConfig, args=None, gen_conanbase=True, service_json="mds/service.json"):
38
+ self.init_common_params(bconfig)
39
+ self.info: InfoComp = InfoComp(args, service_json, self.bconfig.partner_mode)
40
+ self.set_remote_url()
41
+ self.gen_conanbase(gen_conanbase, service_json)
42
+ self.gen_log()
43
+
44
+ @staticmethod
45
+ def get_remote_urls():
46
+ """ Get remote url regardless of the cloned directory """
47
+ git_cmd = Helper.get_git_path()
48
+ cmd = [git_cmd, "remote", "-v"]
49
+ process = subprocess.run(cmd, check=True, capture_output=True)
50
+ return process.stdout.decode("UTF-8").strip().split("\n")
51
+
52
+ def gen_conanbase(self, gen_conanbase, service_json):
53
+ lookup = TemplateLookup(directories=os.path.join(cwd_script, "template"))
54
+ if gen_conanbase:
55
+ template = lookup.get_template("conanbase.py.mako")
56
+ language = ComponentHelper.get_language(service_json=service_json, allow_non_service_json=True)
57
+ conanbase = template.render(lookup=lookup, pkg=self.info, remote_url=self.remote_url,
58
+ codegen_version=self.info.codegen_base_version,
59
+ language=language)
60
+ file_handler = os.fdopen(os.open("conanbase.py", os.O_WRONLY | os.O_CREAT | os.O_TRUNC,
61
+ stat.S_IWUSR | stat.S_IRUSR), 'w')
62
+ file_handler.write(conanbase)
63
+ file_handler.close()
64
+
65
+ def gen_log(self):
66
+ self.log_file = os.path.join("/tmp", self.info.name + ".log")
67
+ file_handler = os.fdopen(os.open(self.log_file, os.O_WRONLY | os.O_CREAT | os.O_TRUNC,
68
+ stat.S_IWUSR | stat.S_IRUSR), 'w')
69
+ file_handler.close()
70
+
71
+ def init_common_params(self, bconfig: BmcgoConfig):
72
+ self.bconfig = bconfig
73
+ self.folder = bconfig.component.folder
74
+ os.chdir(self.folder)
75
+
76
+ def set_remote_url(self):
77
+ # 上传模式必须有一个地址
78
+ if self.info.upload:
79
+ self.remote_url = self.get_remote_url(False)
80
+ else:
81
+ self.remote_url = self.get_remote_url(True)
82
+ log.info("仓库地址为: %s", self.remote_url)
83
+
84
+ def get_remote_url(self, get_first=True):
85
+ """ Get remote url regardless of the cloned directory """
86
+ output_lines = self.get_remote_urls()
87
+ repos = []
88
+ for line in output_lines:
89
+ if line.find("(push)") > 0:
90
+ repos.append(line)
91
+ log.debug("获取仓库列表:")
92
+ log.debug(repos)
93
+ if len(repos) == 0:
94
+ return ""
95
+ repo_id = 0
96
+ if len(repos) > 1 and not get_first:
97
+ log.info("仓库列表:")
98
+ for repo in repos:
99
+ chunk = repo.split(maxsplit=1)
100
+ log.info("仓库基本信息: %s %s %s", repo_id, chunk[0], chunk[1])
101
+ repo_id += 1
102
+ message = input("请选择要使用的仓库地址:")
103
+ repo_id = int(message, 10)
104
+ if repo_id > len(repos):
105
+ raise OSError("未知的仓库, 退出, 请确认仓库!")
106
+
107
+ http_proto = "https://"
108
+ repo = repos[repo_id]
109
+ url = repo.split()[1]
110
+ # 如果以https://开头,直接返回
111
+ if url.startswith(http_proto):
112
+ return url
113
+ # 去掉URL的协议部分,转换为https
114
+ url = url.split("@", 1)[1]
115
+ # 无端口的,直接转为https://
116
+ if not url.find(":") > 0:
117
+ return http_proto + url
118
+ chunk = url.split(":", 1)
119
+ # 如果以端口启始的,删除2222端口号
120
+ if chunk[1].startswith("2222/"):
121
+ return http_proto + chunk[0] + "/" + chunk[1].split("/", 1)[1]
122
+ if chunk[1].startswith("/"):
123
+ return http_proto + chunk[0] + chunk[1]
124
+ return http_proto + chunk[0] + "/" + chunk[1]
125
+
126
+ def install_luac(self):
127
+ conan_bin = os.path.join(os.path.expanduser('~'), ".conan", "bin")
128
+ # 设置PLD_LIBRARY_PATH环境变量,luajit运行时需要加载so动态库
129
+ ld_library_path = conan_bin + ":" + os.environ.get("LD_LIBRARY_PATH", "")
130
+ os.environ["LD_LIBRARY_PATH"] = ld_library_path
131
+ # 设置PATH环境变量,luajit无需指定全路径
132
+ path = conan_bin + ":" + os.environ.get("PATH", "")
133
+ os.environ["PATH"] = path
134
+ os.environ["LUA_PATH"] = f"{conan_bin}/?.lua"
135
+
136
+ # 待安装的luajit版本
137
+ channel = f"@{Tools().conan_user}/{misc.StageEnum.STAGE_STABLE.value}"
138
+ luajit_pkg = f"luajit/2.1.0.B012{channel}"
139
+ luajit_flag = luajit_pkg.split("@")[0].replace("/", "_")
140
+ luajit_flag = os.path.join(conan_bin, luajit_flag)
141
+
142
+ # 使能luajit时需要安装luajit
143
+ luac_path = os.path.join(conan_bin, "luajit")
144
+ # luajit版本一致且luac/luajit存在时赋权即可
145
+ if os.path.isfile(luajit_flag) and os.path.exists(luac_path):
146
+ os.chmod(luac_path, stat.S_IRWXU)
147
+ return
148
+ Tools.clean_conan_bin(conan_bin)
149
+ # 其它情况都尝试安装luajit
150
+ cmd = [misc.CONAN, "install", luajit_pkg]
151
+ cmd += ("-pr profile.dt.ini -if=temp/.deploy -g deploy").split()
152
+ if self.info.remote:
153
+ cmd += ["-r", self.info.remote]
154
+ Helper.run(cmd)
155
+ cmd = ["cp", "temp/.deploy/luajit/usr/bin/luajit", f"{conan_bin}"]
156
+ Helper.run(cmd)
157
+ cmd = ["cp", "temp/.deploy/luajit/usr/lib64/liblua.so", f"{conan_bin}"]
158
+ Helper.run(cmd)
159
+ cmd = ["cp", "-r", "temp/.deploy/luajit/usr/bin/jit", f"{conan_bin}"]
160
+ Helper.run(cmd)
161
+ os.chmod(luac_path, stat.S_IRWXU)
162
+ luajit2luac = shutil.which("luajit2luac.sh")
163
+ cmd = ["cp", luajit2luac, f"{conan_bin}/luac"]
164
+ Helper.run(cmd)
165
+ pathlib.Path(luajit_flag).touch(exist_ok=True)
166
+
167
+ def check_conan_profile(self):
168
+ profile = os.path.join(tool.conan_profiles_dir, self.info.profile)
169
+ luajit_profile = os.path.join(tool.conan_profiles_dir, "profile.luajit.ini")
170
+ if not os.path.isfile(profile):
171
+ raise BmcGoException(f"Profile文件{profile} 不存在,系统可能未初始化," +
172
+ "请在manifest仓执行bingo build安装产品配套构建工具")
173
+ if self.info.enable_luajit and not os.path.isfile(luajit_profile):
174
+ raise BmcGoException(f"Profile文件{luajit_profile} 不存在,系统可能未初始化," +
175
+ "请在manifest仓(2024.07.04之后的版本)执行bingo build安装产品配套构建工具")
176
+
177
+ def upload(self):
178
+ if not self.info.upload:
179
+ return
180
+ pkg = "%s/%s%s" % (self.info.name, self.info.version, self.info.channel)
181
+ cmd = [misc.CONAN, "info"]
182
+ cmd += ("%s %s -s build_type=%s -j" % (pkg, self.info.full_profile, self.info.build_type.capitalize())).split()
183
+ lines = subprocess.run(cmd, capture_output=True, check=True).stdout.decode("utf-8").split("\n")
184
+ conan_info = None
185
+ for line in lines:
186
+ if line.startswith("[{"):
187
+ conan_info = json.loads(line)
188
+ break
189
+ pkg_id = None
190
+ for item in conan_info:
191
+ if item["reference"] == pkg:
192
+ pkg_id = item["id"]
193
+ break
194
+ if pkg_id is None:
195
+ raise OSError(f"获取包版本配置无效, 包名: {pkg}")
196
+ cmd = [misc.CONAN, "upload"]
197
+ cmd += ("%s:%s -r %s --all" % (pkg, pkg_id, self.info.remote)).split()
198
+ tool.run_command(cmd, show_log=True)
199
+
200
+ def run(self):
201
+ self.check_conan_profile()
202
+ self.install_luac()
203
+ tool.clean_locks()
204
+ from_source = "--build=missing"
205
+ if self.info.from_source:
206
+ from_source = "--build"
207
+ cache_dir = os.path.join(os.path.expanduser("~/.conan/data"), self.info.package.replace("@", "/"))
208
+ if self.info.no_cache:
209
+ shutil.rmtree(cache_dir, ignore_errors=True)
210
+ # 构建当前组件
211
+ append = "%s %s -tf None" % (self.info.cmd_base, from_source)
212
+ cmd = [misc.CONAN, "create"]
213
+ cmd += append.split()
214
+ tool.run_command(cmd, show_log=True)
215
+ self.upload()
216
+
217
+ def test(self):
218
+ if os.path.isdir("test_package"):
219
+ cmd = [misc.CONAN, "create"]
220
+ cmd += self.info.cmd_base.split()
221
+ cmd += ["-tf", "test_package"]
222
+ Helper.run(cmd)
@@ -0,0 +1,348 @@
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
+ # descritption: 解析service.json配置文件,生成不同的组件版本service.json配置文件
13
+ import os
14
+ import json
15
+ import logging
16
+ import stat
17
+ import re
18
+ import argparse
19
+
20
+ from bmcgo.component.package_info import InfoComp
21
+ from bmcgo.component.component_helper import ComponentHelper
22
+ from bmcgo.logger import Logger
23
+ from bmcgo import misc
24
+
25
+ log = Logger("ComponentDtVersionParse", logging.INFO)
26
+
27
+
28
+ class Function:
29
+ """这边只提供功能模块,做单一解析
30
+ """
31
+ @classmethod
32
+ def is_opensource(cls, version_str: str):
33
+ """检查组件是否是开源软件
34
+
35
+ Args:
36
+ version_str (str): 配置的组件conan版本
37
+
38
+ Returns:
39
+ bool: 是开源软件返回True
40
+ """
41
+ version_str_list = re.split('/|@', version_str)
42
+ # 如果没有方括号,那么则是静态或者开源
43
+ if '[' not in version_str_list[1]:
44
+ # 如果没有查到数字三段, 则认为为开源
45
+ if re.fullmatch("\d+\.\d+\.\d", version_str_list[1]) is None:
46
+ return True
47
+ # 是三段式, 判定为自研
48
+ else:
49
+ return False
50
+ # 有方括号一律认定为自研
51
+ else:
52
+ return False
53
+
54
+ @classmethod
55
+ def get_key_value(cls, search_dict: dict, key: str):
56
+ """获取字典的键的值
57
+
58
+ Args:
59
+ key (str): 使用"a/b/c"形式可逐级取值, 失败则返回None
60
+
61
+ Returns:
62
+ _type_: 返回值为键的值
63
+ """
64
+ if search_dict is None:
65
+ return search_dict
66
+ value = search_dict
67
+ for sub_key in key.split("/"):
68
+ value = value.get(sub_key, None)
69
+ if value is None:
70
+ return value
71
+ return value
72
+
73
+ @classmethod
74
+ def limit_check(cls, str_input: str):
75
+ """检查字符串是否有上下限
76
+
77
+ Args:
78
+ str_input (str): 被检查字符串
79
+
80
+ Returns:
81
+ bool: 是否匹配上
82
+ """
83
+ if '<' not in str_input and '>' not in str_input:
84
+ return True, "为静态版本或者开源软件"
85
+ elif '<' not in str_input:
86
+ return False, "没有上限"
87
+ elif '>' not in str_input:
88
+ return False, "没有下限"
89
+ else:
90
+ return True, "上下限均已配置"
91
+
92
+ @classmethod
93
+ def get_minimum_version(cls, component_conf_str: str):
94
+ """
95
+ 获取组件最低的版本配置
96
+
97
+ Args:
98
+ component_conf_str (str): 组件版本配置字符串
99
+
100
+ Returns:
101
+ str: 组件最低版本配置字符串
102
+ """
103
+ if cls.is_opensource(component_conf_str) is False:
104
+ component_conf_list = re.split('/|@', component_conf_str)
105
+ version_conf_list = component_conf_list[1].strip('[]').split(',')
106
+ version = []
107
+ for version_conf in version_conf_list:
108
+ if ">=" in version_conf:
109
+ # 去掉下限的范围符号, 只保留固定版本号
110
+ version.append(version_conf.strip(' >='))
111
+ elif "<=" in version_conf:
112
+ continue
113
+ else:
114
+ # 其他内容保留
115
+ version.append(version_conf)
116
+ component_conf_list[1] = ','.join(version)
117
+ # 有些除了版本, 还有其他配置的, 外面的方括号加回去
118
+ if len(version) > 1:
119
+ component_conf_list[1] = f"[{component_conf_list[1]}]"
120
+ # 由于之前将所有的符号给拆了,这里将符号加上
121
+ k = 1
122
+ for i in range(len(component_conf_list) - 1):
123
+ component_conf_list[i + k:i + k] = ['/', '@', '/'][i]
124
+ k = k + 1
125
+ component_conf_str = ''.join(component_conf_list)
126
+ return component_conf_str
127
+
128
+ @classmethod
129
+ def get_version_replace(cls, component_service: str, manifest_subsys: str, use_patch_range=False):
130
+ """使用manifest_subsys的静态组件版本 替换掉 组件配置的组件版本
131
+
132
+ Args:
133
+ component_service (str): 组件配置的组件版本
134
+ manifest_subsys (str): manifest仓配置的组件版本
135
+
136
+ Returns:
137
+ _type_: 返回替换完成的组件版本
138
+ """
139
+ service_version_list = re.split('/|@', component_service)
140
+ manifest_version = re.split('/|@', manifest_subsys)[1]
141
+
142
+ if use_patch_range and not Function.is_opensource(manifest_subsys):
143
+ # 三段式版本组件修改为补丁范围版本 [>=x.y.z <x.y+1.0]
144
+ major, minor, _ = manifest_version.split(".")
145
+ uppper_verison = f"{major}.{int(minor) + 1}.0"
146
+
147
+ service_version_list[1] = f"[>={manifest_version} <{uppper_verison}]"
148
+ else:
149
+ service_version_list[1] = manifest_version
150
+ # 由于之前将所有的符号给拆了,这里将符号加上
151
+ k = 1
152
+ for i in range(len(service_version_list) - 1):
153
+ service_version_list[i + k:i + k] = ['/', '@', '/'][i]
154
+ k = k + 1
155
+ return ''.join(service_version_list)
156
+
157
+ @classmethod
158
+ def find_key(cls, key, dictionary):
159
+ """在字典中查找相同key值并返回key值组成的列表
160
+
161
+ Args:
162
+ key (_type_): 要查找的key值
163
+ dictionary (_type_): 被查找的字典
164
+
165
+ Returns:
166
+ _type_: key的值组成的列表
167
+ """
168
+ results = []
169
+ for k, v in dictionary.items():
170
+ if k == key:
171
+ results.append(v)
172
+ elif isinstance(v, dict):
173
+ results.extend(cls.find_key(key, v))
174
+ return results
175
+
176
+
177
+ class ManifestConfigParse:
178
+ """获取 manifest 目录下的所有组件版本配置
179
+ """
180
+ def __init__(self, package_info_file: str):
181
+ """初始化 package_info 仓路径
182
+
183
+ Args:
184
+ package_info_file (str): package_info 路径
185
+ """
186
+ self.package_info_file = package_info_file
187
+
188
+ def get_version_dict(self):
189
+ """获取主干仓的 package_info 所有组件版本配置
190
+
191
+ Returns:
192
+ dict: 返回所有组件配置的字典
193
+ """
194
+ with open(self.package_info_file, mode="r") as fp:
195
+ package_info_list = fp.readlines()
196
+ package_info_dict = {package.strip('\n').split('/')[0]:package.strip('\n') for package in package_info_list}
197
+ return package_info_dict
198
+
199
+
200
+ class ComponentDtVersionParse:
201
+ """分析组件 dt 的依赖组件版本, 实现自动配置 service.json 文件, 达成 dt 构建门禁
202
+ """
203
+ def __init__(self, parser=None, serv_file="mds/service.json", args=None):
204
+ """初始化,读取配置
205
+
206
+ Args:
207
+ serv_file (str): 配置文件路径
208
+ """
209
+ if not parser:
210
+ parser = argparse.ArgumentParser(description="component dt different version")
211
+ parser.add_argument("--minimum", "-m", action=misc.STORE_TRUE, help="获取dt构建的最小版本")
212
+ parser.add_argument("--package_info", "-pi", default=None, help="package_info 文件路径, 使用manifest配套版本dt构建, \
213
+ 此文件在manifest构建时会在inner目录生成")
214
+ parsed_args, _ = parser.parse_known_args(args)
215
+ self.minimum = parsed_args.minimum
216
+ self.package_info = parsed_args.package_info
217
+
218
+ # 读取service.json配置文件
219
+ self.serv_file = serv_file
220
+ with open(self.serv_file, "r") as mds_conf_fp:
221
+ self.mds_conf = json.load(mds_conf_fp)
222
+ mds_conf_fp.close()
223
+ # 生成dt与build的依赖列表, 检查时如果发现问题, 直接报出组件名, 不分类
224
+ conan_dt_list = Function.get_key_value(self.mds_conf, "dependencies/test") or []
225
+ conan_build_list = Function.get_key_value(self.mds_conf, "dependencies/build") or []
226
+ # 根据配置文件,已确定为列表,有告警,无需使用list转化,影响效率
227
+ self.conan_list = conan_dt_list + conan_build_list
228
+
229
+ def write_to_serv_file(self):
230
+ """写入到对象的 service.json 文件
231
+ """
232
+ with os.fdopen(os.open(self.serv_file, flags=os.O_WRONLY, \
233
+ mode=stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH), "w") as mds_conf_fp:
234
+ mds_conf_fp.seek(0)
235
+ mds_conf_fp.truncate()
236
+ json.dump(self.mds_conf, mds_conf_fp, indent=4, ensure_ascii=False)
237
+ mds_conf_fp.close()
238
+
239
+ def component_limit_check(self):
240
+ """上下限检查
241
+
242
+ Args:
243
+ check_char (str): '>'表示检查下限, '<'表示检查上限
244
+
245
+ Raises:
246
+ AttributeError: 配置错误
247
+ """
248
+ # 默认情况下, 检查通过
249
+ log.info("开始上下限检查")
250
+ check_result = True
251
+ for conan in self.conan_list:
252
+ check, msg = Function.limit_check(conan[misc.CONAN])
253
+ if check is False:
254
+ log.error(f"组件 {conan[misc.CONAN]} {msg}")
255
+ check_result = False
256
+ else:
257
+ log.debug(f"组件 {conan[misc.CONAN]} {msg}")
258
+ # 检查失败, 报错
259
+ if check_result is False:
260
+ raise AttributeError("上下限检查失败")
261
+ else:
262
+ log.info("上下限检查通过")
263
+
264
+ def minimum_version_config(self):
265
+ """获取 service.json 的最小配置版本
266
+ """
267
+ # 列表逐个取最小版本
268
+ for version_conf in self.conan_list:
269
+ version_conf[misc.CONAN] = Function.get_minimum_version(version_conf[misc.CONAN])
270
+ self.write_to_serv_file()
271
+
272
+ def manifest_version_revise(self, package_info_file: str, use_patch_range=False):
273
+ """将 package_info 的组件版本配置到 service.json 文件中
274
+
275
+ Args:
276
+ package_info (str): package_info 路径
277
+ """
278
+ manifest_config_dict = ManifestConfigParse(package_info_file).get_version_dict()
279
+ check_fail_list = []
280
+ test_component = ["dtframeforlua", "test_data"]
281
+ for component in self.conan_list:
282
+ component_name = component[misc.CONAN].split('/')[0]
283
+ component_version = component[misc.CONAN]
284
+ if component_name in manifest_config_dict:
285
+ component[misc.CONAN] = Function.get_version_replace(
286
+ component_version,
287
+ manifest_config_dict[component_name],
288
+ use_patch_range,
289
+ )
290
+ elif component_name in test_component:
291
+ continue
292
+ else:
293
+ check_fail_list.append(component_name)
294
+ if len(check_fail_list) > 0:
295
+ raise AttributeError(f"组件 {check_fail_list} 不在 manifest 仓的 subsys 配置中")
296
+ self.write_to_serv_file()
297
+
298
+ def manifest_full_version_dt(self, comp_info: InfoComp, package_info_file: str):
299
+ """将service.json的依赖组件的所有间接依赖组件根据package_info的组件版本也配置到service.json文件中"""
300
+ manifest_config_dict = ManifestConfigParse(package_info_file).get_version_dict()
301
+
302
+ def get_full_pkg_dependencies(mds_conan_list, root_dependencies):
303
+ # 获取当前组件service.json中的组件及版本
304
+ mds_conan_dependencies = [dep[misc.CONAN] for dep in mds_conan_list]
305
+ mds_pkgs = [dep.split("/")[0] for dep in mds_conan_dependencies]
306
+ # 通过当前组件的依赖组件完整路径xx/v@user/channel获取间接依赖
307
+ all_dependencies = ComponentHelper.get_all_dependencies(root_dependencies, comp_info.remote)
308
+ dependencies = set(root_dependencies)
309
+ for dependency in all_dependencies:
310
+ component_name = dependency.split("/")[0]
311
+ comp = manifest_config_dict.get(component_name, None)
312
+ if comp and component_name not in mds_pkgs:
313
+ dependencies.add(comp)
314
+
315
+ full_pkg_dependencies = []
316
+ for package in dependencies:
317
+ if not (package.endswith(f"/{misc.StageEnum.STAGE_STABLE.value}") \
318
+ or (package in mds_conan_dependencies)):
319
+ package = package.split("@")[0]
320
+ full_pkg_dependencies.append({misc.CONAN: package})
321
+ return full_pkg_dependencies
322
+
323
+ conan_build_list = Function.get_key_value(self.mds_conf, "dependencies/build") or []
324
+ mds_conf_build = get_full_pkg_dependencies(conan_build_list, comp_info.build_dependencies)
325
+ self.mds_conf["dependencies"]["build"] = mds_conf_build
326
+
327
+ conan_test_list = Function.get_key_value(self.mds_conf, "dependencies/test") or []
328
+ mds_conf_test = get_full_pkg_dependencies(conan_test_list, comp_info.test_dependencies)
329
+ self.mds_conf["dependencies"]["test"] = mds_conf_test
330
+ self.write_to_serv_file()
331
+
332
+ def chose_dt_mode(self):
333
+ if self.minimum is True:
334
+ self.minimum_version_config()
335
+ elif self.package_info is not None:
336
+ self.manifest_version_revise(self.package_info)
337
+ comp_info = InfoComp([], self.serv_file)
338
+ self.manifest_full_version_dt(comp_info, self.package_info)
339
+ else:
340
+ log.info("没有启动组件版本分析")
341
+
342
+
343
+ if __name__ == "__main__":
344
+ _parser = argparse.ArgumentParser()
345
+ _parser.add_argument("--service_json")
346
+ _parsed_args, argv = _parser.parse_known_args()
347
+ self_test = ComponentDtVersionParse(serv_file=_parsed_args.service_json, args=argv)
348
+ self_test.chose_dt_mode()
@@ -0,0 +1,114 @@
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
+ import os
13
+ import time
14
+ import json
15
+ import re
16
+ from typing import List
17
+ from multiprocessing import Process
18
+ from tempfile import NamedTemporaryFile
19
+
20
+ from bmcgo.utils.tools import Tools
21
+ from bmcgo.bmcgo_config import misc
22
+ from bmcgo.errors import BmcGoException
23
+
24
+ STAGE_DEV = "dev"
25
+ STAGE_PRE = "pre"
26
+ STAGE_RC = "rc"
27
+ STAGE_STABLE = "stable"
28
+
29
+ BUILD_TYPE_DT = "DT"
30
+ BUILD_TYPE_DEBUG = "Debug"
31
+ BUILD_TYPE_RELEASE = "Release"
32
+
33
+
34
+ class DownloadComponentRecipe(Process):
35
+ def __init__(self, tools: Tools, comp, remote_list: list):
36
+ super().__init__()
37
+ self.comp = comp
38
+ self.tools = tools
39
+ self.remote_list = remote_list
40
+
41
+ def run(self):
42
+ dep_path = os.path.join(self.tools.conan_data, self.comp.replace("@", "/"))
43
+ if os.path.isdir(dep_path):
44
+ return
45
+ self.tools.download_conan_recipes(self.comp, self.remote_list)
46
+
47
+
48
+ class ComponentHelper:
49
+ CONAN_PAKCAGE_RE = r"^[^@|/]+/[^@|/]+@[^@|/]+/(rc|stable|dev)$"
50
+
51
+ @staticmethod
52
+ def get_language(service_json="mds/service.json", allow_non_service_json=False):
53
+ if not os.path.isfile(service_json):
54
+ if allow_non_service_json:
55
+ return "lua"
56
+ raise RuntimeError(f"{service_json}文件不存在")
57
+ with open(service_json, "r", encoding="UTF-8") as service_fp:
58
+ content = json.load(service_fp)
59
+ return content.get("language", "lua")
60
+
61
+ @staticmethod
62
+ def get_config_value(json_data, key: str, default=None):
63
+ for sub_key in key.split("/"):
64
+ json_data = json_data.get(sub_key, None)
65
+ if json_data is None:
66
+ return default
67
+ return json_data
68
+
69
+ @staticmethod
70
+ def download_recipes(depdencies: List[str], tools: Tools, remote_list):
71
+ pools = []
72
+ for dep in depdencies:
73
+ task = DownloadComponentRecipe(tools, dep, remote_list)
74
+ task.start()
75
+ pools.append(task)
76
+
77
+ while pools:
78
+ time.sleep(0.1)
79
+ for pool in pools.copy():
80
+ if pool.is_alive():
81
+ continue
82
+ if pool.exitcode is not None and pool.exitcode != 0:
83
+ raise BmcGoException(f"下载组件 ({pool.comp}) 的构建配方(recipe)失败, 退出码: {pool.exitcode}")
84
+ pools.remove(pool)
85
+
86
+ @staticmethod
87
+ def get_all_dependencies(components: List[str], remote) -> List[str]:
88
+ """获取给定的多个组件com/x.yz@user/channel的直接及间接依赖的所有组件及版本。"""
89
+ tools = Tools()
90
+ dependencies = set()
91
+ tempfile = NamedTemporaryFile()
92
+ for comp in components:
93
+ if not re.match(ComponentHelper.CONAN_PAKCAGE_RE, comp):
94
+ raise BmcGoException(f"组件 {comp} 不符合正则 {ComponentHelper.CONAN_PAKCAGE_RE}")
95
+ cmd = f'conan info "{comp}" --remote {remote} --json {tempfile.name}'
96
+ tools.run_command(cmd)
97
+
98
+ file_handler = open(tempfile.name, "r")
99
+ conan_comps = json.load(file_handler)
100
+ for conan_comp in conan_comps:
101
+ comp_ref = conan_comp.get("reference", "")
102
+ if not comp_ref or comp_ref == comp:
103
+ continue
104
+ dependencies.add(comp_ref)
105
+ file_handler.close()
106
+
107
+ return list(dependencies)
108
+
109
+ @staticmethod
110
+ def get_user_channel(stage: str):
111
+ if stage == misc.StageEnum.STAGE_DEV.value:
112
+ stage = misc.StageEnum.STAGE_RC.value
113
+ user_channel = f"@{Tools().conan_user}/{stage}"
114
+ return user_channel