openubmc-bingo 0.5.277__py3-none-any.whl → 0.6.2__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 (53) hide show
  1. bmcgo/__init__.py +1 -1
  2. bmcgo/bmcgo_config.py +22 -10
  3. bmcgo/cli/cli.py +95 -39
  4. bmcgo/cli/config.conan2.yaml +9 -0
  5. bmcgo/codegen/lua/codegen.py +2 -2
  6. bmcgo/codegen/lua/script/gen_intf_rpc_json.py +15 -14
  7. bmcgo/component/analysis/analysis.py +8 -8
  8. bmcgo/component/analysis/intf_validation.py +23 -12
  9. bmcgo/component/build.py +76 -14
  10. bmcgo/component/component_dt_version_parse.py +3 -2
  11. bmcgo/component/component_helper.py +43 -15
  12. bmcgo/component/coverage/incremental_cov.py +2 -2
  13. bmcgo/component/deploy.py +68 -14
  14. bmcgo/component/gen.py +1 -1
  15. bmcgo/component/package_info.py +128 -38
  16. bmcgo/component/template/conanbase.py.mako +1 -0
  17. bmcgo/component/template_v2/conanbase.py.mako +383 -0
  18. bmcgo/component/template_v2/conanfile.deploy.py.mako +26 -0
  19. bmcgo/component/test.py +53 -20
  20. bmcgo/frame.py +7 -3
  21. bmcgo/functional/analysis.py +3 -2
  22. bmcgo/functional/check.py +10 -6
  23. bmcgo/functional/conan_index_build.py +96 -20
  24. bmcgo/functional/csr_build.py +1 -1
  25. bmcgo/functional/diff.py +1 -1
  26. bmcgo/functional/fetch.py +1 -1
  27. bmcgo/functional/full_component.py +32 -24
  28. bmcgo/functional/git_history.py +220 -0
  29. bmcgo/functional/maintain.py +55 -12
  30. bmcgo/functional/new.py +1 -1
  31. bmcgo/functional/schema_valid.py +2 -2
  32. bmcgo/logger.py +2 -3
  33. bmcgo/misc.py +130 -9
  34. bmcgo/tasks/conan/__init__.py +10 -0
  35. bmcgo/tasks/conan/conanfile.py +45 -0
  36. bmcgo/tasks/task.py +27 -4
  37. bmcgo/tasks/task_build_conan.py +425 -53
  38. bmcgo/tasks/task_buildgppbin.py +8 -2
  39. bmcgo/tasks/task_download_buildtools.py +76 -0
  40. bmcgo/tasks/task_download_dependency.py +1 -0
  41. bmcgo/tasks/task_hpm_envir_prepare.py +1 -1
  42. bmcgo/utils/build_conans.py +231 -0
  43. bmcgo/utils/component_post.py +6 -4
  44. bmcgo/utils/component_version_check.py +75 -16
  45. bmcgo/utils/config.py +76 -40
  46. bmcgo/utils/fetch_component_code.py +44 -25
  47. bmcgo/utils/tools.py +239 -117
  48. bmcgo/worker.py +2 -2
  49. {openubmc_bingo-0.5.277.dist-info → openubmc_bingo-0.6.2.dist-info}/METADATA +4 -2
  50. {openubmc_bingo-0.5.277.dist-info → openubmc_bingo-0.6.2.dist-info}/RECORD +53 -46
  51. {openubmc_bingo-0.5.277.dist-info → openubmc_bingo-0.6.2.dist-info}/WHEEL +0 -0
  52. {openubmc_bingo-0.5.277.dist-info → openubmc_bingo-0.6.2.dist-info}/entry_points.txt +0 -0
  53. {openubmc_bingo-0.5.277.dist-info → openubmc_bingo-0.6.2.dist-info}/top_level.txt +0 -0
bmcgo/component/build.py CHANGED
@@ -14,7 +14,8 @@ import os
14
14
  import shutil
15
15
  import subprocess
16
16
  import stat
17
- import pathlib
17
+ from tempfile import NamedTemporaryFile
18
+ import yaml
18
19
 
19
20
  from mako.lookup import TemplateLookup
20
21
 
@@ -26,7 +27,9 @@ from bmcgo.errors import BmcGoException
26
27
  from bmcgo.component.package_info import InfoComp
27
28
  from bmcgo.component.component_helper import ComponentHelper
28
29
  from bmcgo import misc
30
+ from bmcgo import errors
29
31
  from bmcgo.utils.json_validator import JSONValidator
32
+ from bmcgo.component.gen import GenComp
30
33
 
31
34
  log = Logger()
32
35
  tool = Tools()
@@ -35,12 +38,14 @@ cwd_script = os.path.split(os.path.realpath(__file__))[0]
35
38
 
36
39
 
37
40
  class BuildComp():
38
- def __init__(self, bconfig: BmcgoConfig, args=None, gen_conanbase=True, service_json="mds/service.json"):
41
+ def __init__(self, bconfig: BmcgoConfig, args=None, gen_conanbase=True,
42
+ service_json="mds/service.json", enable_upload=True):
39
43
  self.init_common_params(bconfig)
40
- self.info: InfoComp = InfoComp(args, service_json, self.bconfig.partner_mode)
44
+ self.info: InfoComp = InfoComp(args, service_json, self.bconfig.partner_mode, enable_upload)
41
45
  self.set_remote_url()
42
46
  self.gen_conanbase(gen_conanbase, service_json)
43
47
  self.gen_log()
48
+ self.graph_file = NamedTemporaryFile(suffix=".graph.json")
44
49
 
45
50
  @staticmethod
46
51
  def get_remote_urls():
@@ -66,10 +71,17 @@ class BuildComp():
66
71
  os.environ["LUA_PATH"] = f"{conan_bin}/?.lua"
67
72
 
68
73
  def gen_conanbase(self, gen_conanbase, service_json):
69
- lookup = TemplateLookup(directories=os.path.join(cwd_script, "template"))
74
+ if misc.conan_v1():
75
+ lookup = TemplateLookup(directories=os.path.join(cwd_script, "template"))
76
+ else:
77
+ lookup = TemplateLookup(directories=os.path.join(cwd_script, "template_v2"))
70
78
  if gen_conanbase:
71
79
  template = lookup.get_template("conanbase.py.mako")
72
- language = ComponentHelper.get_language(service_json=service_json, allow_non_service_json=True)
80
+ language = self.info.language
81
+ if language == "c" and misc.conan_v2():
82
+ args = ["-s", service_json]
83
+ gen = GenComp(args)
84
+ gen.run(self.info.codegen_base_version)
73
85
  conanbase = template.render(lookup=lookup, pkg=self.info, remote_url=self.remote_url,
74
86
  codegen_version=self.info.codegen_base_version,
75
87
  language=language)
@@ -79,7 +91,7 @@ class BuildComp():
79
91
  file_handler.close()
80
92
 
81
93
  def gen_log(self):
82
- self.log_file = os.path.join("/tmp", self.info.name + ".log")
94
+ self.log_file = os.path.join(misc.CACHE_DIR, self.info.name + ".log")
83
95
  file_handler = os.fdopen(os.open(self.log_file, os.O_WRONLY | os.O_CREAT | os.O_TRUNC,
84
96
  stat.S_IWUSR | stat.S_IRUSR), 'w')
85
97
  file_handler.close()
@@ -141,15 +153,36 @@ class BuildComp():
141
153
 
142
154
  def check_conan_profile(self):
143
155
  profile = os.path.join(tool.conan_profiles_dir, self.info.profile)
144
- luajit_profile = os.path.join(tool.conan_profiles_dir, "profile.luajit.ini")
145
156
  if not os.path.isfile(profile):
146
157
  raise BmcGoException(f"Profile文件{profile} 不存在,系统可能未初始化," +
147
- "请在manifest仓执行bingo build安装产品配套构建工具")
148
- if self.info.enable_luajit and not os.path.isfile(luajit_profile):
149
- raise BmcGoException(f"Profile文件{luajit_profile} 不存在,系统可能未初始化," +
150
- "请在manifest仓(2024.07.04之后的版本)执行bingo build安装产品配套构建工具")
158
+ f"请在manifest仓执行{misc.tool_name()} build安装产品配套构建工具")
159
+ if misc.conan_v1():
160
+ luajit_profile = os.path.join(tool.conan_profiles_dir, "profile.luajit.ini")
161
+ if self.info.enable_luajit and not os.path.isfile(luajit_profile):
162
+ raise BmcGoException(f"Profile文件{luajit_profile} 不存在,系统可能未初始化," +
163
+ "请在manifest仓(2024.07.04之后的版本)执行bingo build安装产品配套构建工具")
164
+
165
+ def upload_conan_v2(self):
166
+ cmd = f"conan cache path {self.info.package}"
167
+ ret = tool.run_command(cmd, capture_output=True)
168
+ recipe_path = ret.stdout.strip()
169
+ conandata = os.path.join(recipe_path, "conandata.yml")
170
+ with open(conandata, mode="r") as fp:
171
+ config_data = yaml.safe_load(fp)
172
+ cfg = config_data.get("sources", {}).get(self.info.version, {})
173
+ if not cfg:
174
+ raise errors.BmcGoException(f"conandata.yml不存在sources/{self.info.version}配置或配置为空")
175
+ if cfg.get("pwd"):
176
+ log.error("检查到错误的conandata.yml配置")
177
+ fp.seek(0, os.SEEK_SET)
178
+ log.error(fp.read())
179
+ raise errors.BmcGoException(f"组件目录存在脏数据或未推送到远程仓,禁止上传")
180
+
181
+ cmd = [misc.CONAN, "upload"]
182
+ cmd += ("%s -r %s --force" % (self.info.package, self.info.remote)).split()
183
+ tool.run_command(cmd, show_log=True)
151
184
 
152
- def upload(self):
185
+ def upload_conanv1(self):
153
186
  if not self.info.upload:
154
187
  return
155
188
  pkg = "%s/%s%s" % (self.info.name, self.info.version, self.info.channel)
@@ -172,7 +205,7 @@ class BuildComp():
172
205
  cmd += ("%s:%s -r %s --all" % (pkg, pkg_id, self.info.remote)).split()
173
206
  tool.run_command(cmd, show_log=True)
174
207
 
175
- def run(self):
208
+ def run_conan_v1(self):
176
209
  tool.clean_locks()
177
210
  self.check_conan_profile()
178
211
  self.check_luac()
@@ -184,11 +217,40 @@ class BuildComp():
184
217
  shutil.rmtree(cache_dir, ignore_errors=True)
185
218
  # 构建当前组件
186
219
  append = "%s %s -tf None" % (self.info.cmd_base, from_source)
220
+ if self.info.no_cache:
221
+ append += " -u"
187
222
  cmd = [misc.CONAN, "create"]
188
223
  cmd += append.split()
189
224
  tool.run_command(cmd, show_log=True)
190
225
  self._check_sr_validation(os.path.join(cache_dir, "package"))
191
- self.upload()
226
+ if self.info.upload:
227
+ self.upload_conanv1()
228
+
229
+ def run_conan_v2(self):
230
+ self.check_conan_profile()
231
+ from_source = f"--build={self.info.name}/*"
232
+ if self.info.from_source:
233
+ from_source = "--build=*"
234
+ else:
235
+ from_source += " --build=missing"
236
+ # # 构建当前组件
237
+ args = "%s %s" % (self.info.cmd_base, from_source)
238
+ if self.info.no_cache:
239
+ args += " -u"
240
+ cmd = [misc.CONAN, "create", "--name", self.info.name, "--version", self.info.version]
241
+ args += f" -f json --out-file={self.graph_file.name}"
242
+ cmd += args.split()
243
+ tool.run_command(cmd, show_log=True)
244
+ package_folder = tool.get_package_folder_from_graph_file(self.graph_file.name, self.info.package)
245
+ self._check_sr_validation(package_folder)
246
+ if self.info.upload:
247
+ self.upload_conan_v2()
248
+
249
+ def run(self):
250
+ if misc.conan_v1():
251
+ self.run_conan_v1()
252
+ else:
253
+ self.run_conan_v2()
192
254
 
193
255
  def test(self):
194
256
  if os.path.isdir("test_package"):
@@ -200,7 +200,7 @@ class ManifestConfigParse:
200
200
  class ComponentDtVersionParse:
201
201
  """分析组件 dt 的依赖组件版本, 实现自动配置 service.json 文件, 达成 dt 构建门禁
202
202
  """
203
- def __init__(self, parser=None, serv_file="mds/service.json", args=None):
203
+ def __init__(self, parser=None, serv_file="mds/service.json", args=None, exclude_dt=False):
204
204
  """初始化,读取配置
205
205
 
206
206
  Args:
@@ -221,7 +221,8 @@ class ComponentDtVersionParse:
221
221
  self.mds_conf = json.load(mds_conf_fp)
222
222
  mds_conf_fp.close()
223
223
  # 生成dt与build的依赖列表, 检查时如果发现问题, 直接报出组件名, 不分类
224
- conan_dt_list = Function.get_key_value(self.mds_conf, "dependencies/test") or []
224
+ if not exclude_dt:
225
+ conan_dt_list = Function.get_key_value(self.mds_conf, "dependencies/test") or []
225
226
  conan_build_list = Function.get_key_value(self.mds_conf, "dependencies/build") or []
226
227
  # 根据配置文件,已确定为列表,有告警,无需使用list转化,影响效率
227
228
  self.conan_list = conan_dt_list + conan_build_list
@@ -19,7 +19,7 @@ from tempfile import NamedTemporaryFile
19
19
  from packaging import version
20
20
 
21
21
  from bmcgo.utils.tools import Tools
22
- from bmcgo.bmcgo_config import misc
22
+ from bmcgo import misc
23
23
  from bmcgo.errors import BmcGoException
24
24
 
25
25
  STAGE_DEV = "dev"
@@ -40,9 +40,15 @@ class DownloadComponentRecipe(Process):
40
40
  self.remote_list = remote_list
41
41
 
42
42
  def run(self):
43
- dep_path = os.path.join(self.tools.conan_data, self.comp.replace("@", "/"))
44
- if os.path.isdir(dep_path):
45
- return
43
+ if misc.conan_v1():
44
+ dep_path = os.path.join(self.tools.conan_data, self.comp.replace("@", "/"))
45
+ if os.path.isdir(dep_path):
46
+ return
47
+ else:
48
+ cmd = f"conan cache path {self.comp}"
49
+ ret = self.tools.run_command(cmd, capture_output=True, ignore_error=True)
50
+ if ret.returncode == 0:
51
+ return
46
52
  self.tools.download_conan_recipes(self.comp, self.remote_list)
47
53
 
48
54
 
@@ -123,17 +129,26 @@ class ComponentHelper:
123
129
  @staticmethod
124
130
  def download_recipes(depdencies: List[str], tools: Tools, remote_list):
125
131
  pools = []
132
+ ignore_error = os.getenv("CLOUD_BUILD_IGNORE_ERROR")
126
133
  for dep in depdencies:
127
134
  task = DownloadComponentRecipe(tools, dep, remote_list)
128
135
  task.start()
129
136
  pools.append(task)
130
-
137
+ # 减少并发数,避免CI场景连接过多导致服务器无法处理导致的失败
138
+ while len(pools) > 4:
139
+ time.sleep(0.1)
140
+ for pool in pools.copy():
141
+ if pool.is_alive():
142
+ continue
143
+ if pool.exitcode is not None and pool.exitcode != 0 and not ignore_error:
144
+ tools.log.warning(f"下载组件 ({pool.comp}) 的构建配方(recipe)失败, 退出码: {pool.exitcode}")
145
+ pools.remove(pool)
131
146
  while pools:
132
147
  time.sleep(0.1)
133
148
  for pool in pools.copy():
134
149
  if pool.is_alive():
135
150
  continue
136
- if pool.exitcode is not None and pool.exitcode != 0:
151
+ if pool.exitcode is not None and pool.exitcode != 0 and not ignore_error:
137
152
  raise BmcGoException(f"下载组件 ({pool.comp}) 的构建配方(recipe)失败, 退出码: {pool.exitcode}")
138
153
  pools.remove(pool)
139
154
 
@@ -144,18 +159,31 @@ class ComponentHelper:
144
159
  dependencies = set()
145
160
  tempfile = NamedTemporaryFile()
146
161
  for comp in components:
147
- if not re.match(ComponentHelper.CONAN_PAKCAGE_RE, comp):
148
- raise BmcGoException(f"组件 {comp} 不符合正则 {ComponentHelper.CONAN_PAKCAGE_RE}")
149
- cmd = f'conan info "{comp}" --remote {remote} --json {tempfile.name}'
162
+ if misc.conan_v1():
163
+ if not re.match(ComponentHelper.CONAN_PAKCAGE_RE, comp):
164
+ raise BmcGoException(f"组件 {comp} 不符合正则 {ComponentHelper.CONAN_PAKCAGE_RE}")
165
+ cmd = f'conan info "{comp}" --remote {remote} --json {tempfile.name}'
166
+ else:
167
+ if not misc.conan_package_match(comp):
168
+ raise BmcGoException(f"组件 {comp} 不符合正则 {misc.CONAN_NAME_RESTR}")
169
+ cmd = f'conan graph info --requires="{comp}" --remote {remote} -f json --out-file={tempfile.name}'
150
170
  tools.run_command(cmd)
151
171
 
152
172
  file_handler = open(tempfile.name, "r")
153
173
  conan_comps = json.load(file_handler)
154
- for conan_comp in conan_comps:
155
- comp_ref = conan_comp.get("reference", "")
156
- if not comp_ref or comp_ref == comp:
157
- continue
158
- dependencies.add(comp_ref)
174
+ if misc.conan_v1():
175
+ for conan_comp in conan_comps:
176
+ comp_ref = conan_comp.get("reference", "")
177
+ if not comp_ref or comp_ref == comp:
178
+ continue
179
+ dependencies.add(comp_ref)
180
+ else:
181
+ deps = conan_comps.get("graph", {}).get("nodes", {}).get("0", {}).get("dependencies", {})
182
+ for _, conan_comp in deps.items():
183
+ comp_ref = conan_comp.get("ref", "")
184
+ if not comp_ref or comp_ref == comp:
185
+ continue
186
+ dependencies.add(comp_ref)
159
187
  file_handler.close()
160
188
 
161
189
  return list(dependencies)
@@ -164,5 +192,5 @@ class ComponentHelper:
164
192
  def get_user_channel(stage: str):
165
193
  if stage == misc.StageEnum.STAGE_DEV.value:
166
194
  stage = misc.StageEnum.STAGE_RC.value
167
- user_channel = f"@{Tools().conan_user}/{stage}"
195
+ user_channel = f"@{misc.conan_user()}/{stage}"
168
196
  return user_channel
@@ -85,9 +85,9 @@ class GcovHTMLParser(HTMLParser):
85
85
  for a in attrs:
86
86
  if a == ("class", "lineNum"):
87
87
  self.is_line_num = True
88
- if a == ("class", "lineNoCov"):
88
+ if a == ("class", "lineNoCov") or a == ("class", "tlaUNC"):
89
89
  self.uncovers.append(self.line_num)
90
- if a == ("class", "lineCov"):
90
+ if a == ("class", "lineCov") or a == ("class", "tlaGNC"):
91
91
  self.covers.append(self.line_num)
92
92
 
93
93
  def handle_data(self, data):
bmcgo/component/deploy.py CHANGED
@@ -12,6 +12,7 @@
12
12
  import os
13
13
  import shutil
14
14
  import stat
15
+ import json
15
16
  import yaml
16
17
 
17
18
  from mako.lookup import TemplateLookup
@@ -28,6 +29,24 @@ log = Logger("deploy")
28
29
  cwd_script = os.path.split(os.path.realpath(__file__))[0]
29
30
 
30
31
 
32
+ class GraphNode:
33
+ def __init__(self, node):
34
+ if not node:
35
+ self.name = None
36
+ self.package_folder = None
37
+ self.recipe_folder = None
38
+ self.package_id = None
39
+ self.ref = None
40
+ self.node = node
41
+ return
42
+ self.name = node.get("name")
43
+ self.package_folder = node.get("package_folder")
44
+ self.recipe_folder = node.get("recipe_folder")
45
+ self.package_id = node.get("package_id")
46
+ self.ref = node.get("ref")
47
+ self.node = node
48
+
49
+
31
50
  class DeployComp():
32
51
  def __init__(self, bconfig: BmcgoConfig, info: InfoComp = None):
33
52
  self.info: InfoComp = info
@@ -35,6 +54,19 @@ class DeployComp():
35
54
  self.folder = bconfig.component.folder
36
55
  os.chdir(self.folder)
37
56
  self.temp_path = os.path.join(self.folder, "temp")
57
+ self.graph_nodes: dict[str, GraphNode] = {}
58
+
59
+ @staticmethod
60
+ def copy_packages_v1(install_path, rootfs_path):
61
+ for sub_dir in os.listdir(install_path):
62
+ dir_path = os.path.join(install_path, sub_dir)
63
+ if os.path.isfile(dir_path):
64
+ os.unlink(dir_path)
65
+ continue
66
+ for file in os.listdir(dir_path):
67
+ source = os.path.join(dir_path, file)
68
+ cmd = ["/usr/bin/cp", "-arf", source, rootfs_path]
69
+ Helper.run(cmd)
38
70
 
39
71
  def get_dt_dependencies(self):
40
72
  user_channel = ComponentHelper.get_user_channel(self.info.stage)
@@ -61,12 +93,15 @@ class DeployComp():
61
93
  return dependencies
62
94
 
63
95
  def gen_conanfile(self):
64
- dependencies = [f"{self.info.name}/{self.info.version}{self.info.channel}"]
65
- if self.info.build_type == "dt":
96
+ dependencies = [self.info.package]
97
+ if self.info.test:
66
98
  dependencies += self.get_dt_dependencies()
67
99
 
68
100
  # 构建虚拟deploy组件,生成conanfile.py文件
69
- lookup = TemplateLookup(directories=os.path.join(cwd_script, "template"))
101
+ if misc.conan_v1():
102
+ lookup = TemplateLookup(directories=os.path.join(cwd_script, "template"))
103
+ else:
104
+ lookup = TemplateLookup(directories=os.path.join(cwd_script, "template_v2"))
70
105
  template = lookup.get_template("conanfile.deploy.py.mako")
71
106
  conanfile = template.render(lookup=lookup, pkg=self.info, dependencies=dependencies)
72
107
  file_handler = os.fdopen(os.open("conanfile.py", os.O_WRONLY | os.O_CREAT | os.O_TRUNC,
@@ -74,6 +109,25 @@ class DeployComp():
74
109
  file_handler.write(conanfile)
75
110
  file_handler.close()
76
111
 
112
+ def copy_packages_v2(self, graph_file, rootfs_path=None):
113
+ if not rootfs_path:
114
+ rootfs_path = self.temp_path
115
+ with open(graph_file, "r") as file_handler:
116
+ package_info = json.load(file_handler)
117
+ nodes: dict[str, dict] = package_info.get("graph", {}).get("nodes", {})
118
+ self.graph_nodes = {}
119
+ for _, node in nodes.items():
120
+ if node.get("context") != "host":
121
+ continue
122
+ gn = GraphNode(node)
123
+ self.graph_nodes[gn.name] = gn
124
+ if not gn.package_folder:
125
+ continue
126
+ for file in os.listdir(gn.package_folder):
127
+ source = os.path.join(gn.package_folder, file)
128
+ cmd = ["/usr/bin/cp", "-arf", source, rootfs_path]
129
+ Helper.run(cmd)
130
+
77
131
  def run(self):
78
132
  # 生成虚拟deploy组件,仅用于安装
79
133
  deploy_conan = os.path.join(self.temp_path, ".deploy")
@@ -86,8 +140,13 @@ class DeployComp():
86
140
  log.info("安装所有依赖到目录 %s", install_path)
87
141
  shutil.rmtree(install_path, ignore_errors=True)
88
142
  cmd = [misc.CONAN, "install"]
89
- append_cmd = ("%s -if=%s -g deploy" % (self.info.cmd_base, install_path))
90
- append_cmd = append_cmd.replace(self.info.package, self.info.channel)
143
+ graph_file = "package.info.json"
144
+ if misc.conan_v2():
145
+ append_cmd = ("%s -of=%s -d=full_deploy -f json --out-file=%s" %
146
+ (self.info.cmd_base, install_path, graph_file))
147
+ else:
148
+ append_cmd = ("%s -if=%s -g deploy" % (self.info.cmd_base, install_path))
149
+ append_cmd = append_cmd.replace(self.info.package, self.info.channel)
91
150
  cmd += append_cmd.split()
92
151
  cmd.append("--build=missing")
93
152
  log.success("运行部署命令: %s", " ".join(cmd))
@@ -96,13 +155,8 @@ class DeployComp():
96
155
  rootfs_path = self.temp_path
97
156
  log.info("复制所有依赖到目录 %s", rootfs_path)
98
157
  os.makedirs(rootfs_path, exist_ok=True)
99
- for sub_dir in os.listdir(install_path):
100
- dir_path = os.path.join(install_path, sub_dir)
101
- if os.path.isfile(dir_path):
102
- os.unlink(dir_path)
103
- continue
104
- for file in os.listdir(dir_path):
105
- source = os.path.join(dir_path, file)
106
- cmd = ["/usr/bin/cp", "-arf", source, rootfs_path]
107
- Helper.run(cmd)
158
+ if misc.conan_v2():
159
+ self.copy_packages_v2(graph_file, rootfs_path)
160
+ else:
161
+ self.copy_packages_v1(install_path, rootfs_path)
108
162
  shutil.rmtree(install_path, ignore_errors=True)
bmcgo/component/gen.py CHANGED
@@ -107,7 +107,7 @@ class GenComp():
107
107
  def run(self, base_version=-1):
108
108
  language = ComponentHelper.get_language().lower()
109
109
  parser = argparse.ArgumentParser(description="代码自动生成.",
110
- prog="bingo gen/当前只支持C和lua语言代码生成",
110
+ prog=f"{misc.tool_name()} gen/当前只支持C和lua语言代码生成",
111
111
  formatter_class=SmartFormatter)
112
112
  parser.add_argument("-v", "--version", help="use specified version", type=int, default=-1)
113
113
  parser.add_argument("-r", "--remote", help="conan remote, 如不设置则默认读取本地conan配置")