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
@@ -0,0 +1,26 @@
1
+ from conan import ConanFile
2
+
3
+
4
+ class DeployConan(ConanFile):
5
+ name = "${pkg.name}-deploy"
6
+ version = "0.0.1"
7
+ settings = "os", "compiler", "build_type", "arch"
8
+ license = "Mulan PSL v2"
9
+ requires = []
10
+
11
+ def export(self):
12
+ self.copy("manifest.yaml")
13
+
14
+ def requirements(self):
15
+ % for build_dep in dependencies:
16
+ self.requires("${build_dep}")
17
+ % endfor
18
+
19
+ def build(self):
20
+ pass
21
+
22
+ def package(self):
23
+ pass
24
+
25
+ def package_info(self):
26
+ pass
bmcgo/component/test.py CHANGED
@@ -58,19 +58,27 @@ class TestComp():
58
58
  # 参数检查
59
59
  dt_parser = ComponentDtVersionParse(parser=parser, args=args, serv_file=self.temp_service_json)
60
60
  dt_parser.chose_dt_mode()
61
- self.args, self.build_args = parser.parse_known_args(args)
61
+ if misc.conan_v1():
62
+ self.args, self.build_args = parser.parse_known_args(args)
63
+ self.build_args.append("-bt")
64
+ self.build_args.append("dt")
65
+ self.build_args.append("-r")
66
+ self.build_args.append(self.args.remote)
67
+ else:
68
+ self.args, _ = parser.parse_known_args(args)
69
+ self.build_args = args
70
+ self.build_args.append("-pr")
71
+ self.build_args.append("profile.dt.ini")
72
+ self.build_args.append("-test")
62
73
  if self.args.enable_luajit:
63
74
  self.build_args.append("-jit")
64
- self.build_args.append("-bt")
65
- self.build_args.append("dt")
66
- self.build_args.append("-r")
67
75
  self.build_args.append(self.args.remote)
68
76
  if self.args.coverage:
69
77
  self.build_args.append("-cov")
70
78
  if self.args.asan:
71
79
  self.build_args.append("-as")
72
80
 
73
- self.info = InfoComp(self.build_args, self.temp_service_json)
81
+ self.info = InfoComp(self.build_args, self.temp_service_json, self.bconfig.partner_mode, False)
74
82
  self.unit_test = self.args.unit_test
75
83
  self.integration_test = self.args.integration_test
76
84
  self.test_filter = self.args.test_filter
@@ -110,13 +118,13 @@ class TestComp():
110
118
  self.init_dt_result_dict()
111
119
 
112
120
  # 构建和部署对象
113
- self.build = BuildComp(bconfig, self.build_args, service_json=self.temp_service_json)
121
+ self.build = BuildComp(bconfig, self.build_args, service_json=self.temp_service_json, enable_upload=False)
114
122
  self.deploy = DeployComp(bconfig, self.build.info)
115
123
  self.current_app = self.build.info.name
116
124
 
117
125
  @staticmethod
118
126
  def arg_parser(add_help=False):
119
- pkg_parser = InfoComp.arg_parser()
127
+ pkg_parser = InfoComp.arg_parser(False, enable_upload=False)
120
128
  parser = argparse.ArgumentParser(description="Test component", parents=[pkg_parser], add_help=add_help)
121
129
  parser.add_argument("-ut", "--unit_test", help="Enable unit test", action=misc.STORE_TRUE)
122
130
  parser.add_argument("-it", "--integration_test", help="Enable integration test", action=misc.STORE_TRUE)
@@ -264,8 +272,11 @@ class TestComp():
264
272
  log.error("依赖格式错误, 获取到: %s", dep)
265
273
  elif not self.is_common_dep(conan, dt_common_deps):
266
274
  # 写入组件配置的非DT公共依赖
267
- if "@" not in conan:
268
- write_dep = prefix + '"' + conan + uc_code + '"' + "\n"
275
+ if misc.conan_v1():
276
+ if "@" not in conan:
277
+ write_dep = prefix + '"' + conan + uc_code + '"' + "\n"
278
+ else:
279
+ write_dep = prefix + '"' + conan + '"' + "\n"
269
280
  else:
270
281
  write_dep = prefix + '"' + conan + '"' + "\n"
271
282
  mf_file.write(write_dep)
@@ -275,7 +286,10 @@ class TestComp():
275
286
  self.build.run()
276
287
  os.chdir(self.folder)
277
288
  # 部署被测组件及其依赖到temp/rootfs目录
278
- self.deploy.run()
289
+ if misc.conan_v1():
290
+ self.deploy.run()
291
+ else:
292
+ self.deploy.run()
279
293
  os.chdir(self.folder)
280
294
 
281
295
  def coverage_config(self, project_root, cov_path, app):
@@ -606,17 +620,36 @@ class TestComp():
606
620
  stat.S_IWUSR | stat.S_IRUSR), 'w') as file:
607
621
  file.write(self.info.package)
608
622
 
623
+ def get_gcda_path(self, ):
624
+ package_path = f"{self.info.name}/{self.info.version}@{self.info.user}/{self.info.stage}"
625
+ ret = self.tools.run_command(f"conan list {package_path}#latest:* -f json", capture_output=True).stdout.strip()
626
+ revisions_path = json.loads(ret)["Local Cache"][package_path]["revisions"]
627
+ revisions = next(iter(revisions_path.keys()), None)
628
+ if not revisions:
629
+ raise ValueError("No revision IDs found")
630
+ packages = next(iter(revisions_path[revisions]["packages"].keys()), None)
631
+ if not packages:
632
+ raise ValueError("No packages IDs found")
633
+ build_path = self.tools.run_command(f"conan cache path {package_path}#{revisions}:{packages} --folder build",
634
+ capture_output=True).stdout.strip()
635
+ return build_path
636
+
609
637
  def generate_gcov(self):
610
- if not self.test_by_conan:
611
- if not os.path.exists("src/lualib-src"):
612
- return
613
- package_path = os.path.join(self.temp_path, "package_info")
614
- with open(package_path, "r") as file:
615
- lines = file.readlines()
616
- package_path = lines[0].replace("@", "/")
638
+ if misc.conan_v1():
639
+ if not self.test_by_conan:
640
+ if not os.path.exists("src/lualib-src"):
641
+ return
642
+ package_path = os.path.join(self.temp_path, "package_info")
643
+ with open(package_path, "r") as file:
644
+ lines = file.readlines()
645
+ package_path = lines[0].replace("@", "/")
646
+ else:
647
+ package_path = self.info.package.replace("@", "/")
648
+ base_dir = "%s/.conan/data/%s" % (os.path.expanduser('~'), package_path)
649
+ gcda_dir = base_dir
617
650
  else:
618
- package_path = self.info.package.replace("@", "/")
619
- base_dir = "%s/.conan/data/%s" % (os.path.expanduser('~'), package_path)
651
+ base_dir = self.folder
652
+ gcda_dir = self.get_gcda_path()
620
653
  gcov_path = os.path.join(self.cov_path, "gcov")
621
654
  if not os.path.exists(gcov_path):
622
655
  os.makedirs(gcov_path)
@@ -630,7 +663,7 @@ class TestComp():
630
663
  "--base-directory",
631
664
  base_dir,
632
665
  "--directory",
633
- base_dir,
666
+ gcda_dir,
634
667
  "--capture",
635
668
  "--output-file",
636
669
  info_file,
bmcgo/frame.py CHANGED
@@ -135,8 +135,12 @@ class Frame(object):
135
135
  parser = argparse.ArgumentParser(description="build target")
136
136
  parser.add_argument("-cp", "--conan_package", help="软件包名, 示例: kmc/21.1.2.B001", default="")
137
137
  parser.add_argument("-uci", "--upload_package", help="是否上传软件包", action=misc.STORE_TRUE)
138
- parser.add_argument("-o", "--options", help="组件特性配置, 示例: -o skynet:enable_luajit=True",
139
- action='append')
138
+ if misc.conan_v2():
139
+ parser.add_argument("-o", "--options", help="组件特性配置, 示例: -o skynet/*:enable_luajit=True",
140
+ action='append')
141
+ else:
142
+ parser.add_argument("-o", "--options", help="组件特性配置, 示例: -o skynet:enable_luajit=True",
143
+ action='append')
140
144
  self.conan_args, unknown_args = parser.parse_known_args(unknown_args)
141
145
  if self.conan_args is None or self.conan_args.conan_package == "":
142
146
  raise errors.BmcGoException("软件包选项为空, 请输入软件包选项!")
@@ -216,5 +220,5 @@ class Frame(object):
216
220
  shutil.rmtree(misc.CACHE_DIR)
217
221
  os.makedirs(misc.CACHE_DIR)
218
222
  os.chmod(misc.CACHE_DIR, 0o777)
219
- if shutil.which(misc.CONAN) is not None:
223
+ if shutil.which(misc.CONAN) is not None and misc.conan_v1():
220
224
  tool.run_command("conan remove --locks")
@@ -42,7 +42,8 @@ def if_available(bconfig: BmcgoConfig):
42
42
 
43
43
  class BmcgoCommand:
44
44
  def __init__(self, bconfig: BmcgoConfig, *args):
45
- parser = argparse.ArgumentParser(prog="bmcgo analysis", description="BMC package analysis", add_help=True,
45
+ parser = argparse.ArgumentParser(prog=f"{misc.tool_name()} analysis",
46
+ description="BMC package analysis", add_help=True,
46
47
  formatter_class=argparse.RawTextHelpFormatter)
47
48
  parser.add_argument("-r", "--remote", help="指定conan远端")
48
49
  parser.add_argument("--rebuild", dest="rebuild", help="rebuild the package before analysis",
@@ -50,7 +51,7 @@ class BmcgoCommand:
50
51
  parser.add_argument("--out_dir", dest="out_dir", help="analysis artifacts directory")
51
52
  parser.add_argument("--lock_file", dest="lock_file", help="manifest lock file path")
52
53
  parser.add_argument("-b", "--board_name", help="find supported boards in the manifest/build/product directory",
53
- default="openUBMC")
54
+ default=misc.boardname_default())
54
55
  pre_parsed_args, _ = parser.parse_known_args(*args)
55
56
 
56
57
  self.bconfig = bconfig
bmcgo/functional/check.py CHANGED
@@ -59,10 +59,11 @@ def if_available(bconfig: BmcgoConfig):
59
59
  class BmcgoCommand:
60
60
  def __init__(self, bconfig: BmcgoConfig, *args):
61
61
  self.bconfig = bconfig
62
- parser = argparse.ArgumentParser(prog="bmcgo check", description="语法正确性与模型一致性检查", add_help=True,
62
+ parser = argparse.ArgumentParser(prog=f"{misc.tool_name()} check", description="语法正确性与模型一致性检查", add_help=True,
63
63
  formatter_class=argparse.RawTextHelpFormatter)
64
- parser.add_argument("-b", "--board_name", help="指定单板获取配套全量源码,可选值为build/product目录下的单板名\n默认:openUBMC",
65
- default="openUBMC")
64
+ parser.add_argument("-b", "--board_name",
65
+ help="指定单板获取配套全量源码,可选值为build/product目录下的单板名\n默认:" + misc.boardname_default(),
66
+ default=misc.boardname_default())
66
67
  parser.add_argument("--stage", help="包类型,可选值为:rc(预发布包), stable(发布包)\n默认: stable", default="stable")
67
68
  parser.add_argument("-r", "--remote")
68
69
  parser.add_argument("-m", "--model", help=f"检查的模型,可选值为: {', '.join(MODEL_CHOICES)}\n默认: all",
@@ -87,14 +88,14 @@ class BmcgoCommand:
87
88
  @staticmethod
88
89
  def check_overdue(issue: dict):
89
90
  data = issue.get("deadline")
90
- if date is None:
91
+ if data is None:
91
92
  return False
92
93
  try:
93
94
  utc_8 = timezone(timedelta(hours=8))
94
95
  deadline = datetime.strptime(data, '%Y/%m/%d').replace(tzinfo=utc_8)
95
96
  return datetime.now(tz=utc_8) >= deadline + timedelta(days=1)
96
97
  except Exception as e:
97
- log.warning("日期 %s 解析失败:%s", date, e)
98
+ log.warning("日期 %s 解析失败:%s", data, e)
98
99
  return False
99
100
 
100
101
  @staticmethod
@@ -145,7 +146,10 @@ class BmcgoCommand:
145
146
  package = dep.get(misc.CONAN, "")
146
147
  comp_name = package.split("/")[0]
147
148
  if "@" not in package:
148
- package += f"@{misc.ConanUserEnum.CONAN_USER_RELEASE.value}/{misc.StageEnum.STAGE_RC.value}"
149
+ if misc.conan_v1():
150
+ package += f"@{misc.conan_user()}/{misc.StageEnum.STAGE_RC.value}"
151
+ else:
152
+ package += f"@{misc.conan_user()}/stable"
149
153
  self.packages[comp_name] = package
150
154
 
151
155
  def run(self):
@@ -11,11 +11,9 @@
11
11
  # MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
12
12
  # See the Mulan PSL v2 for more details.
13
13
  import os
14
- import pathlib
15
14
  import subprocess
16
- import shutil
17
- import stat
18
15
  import json
16
+ import re
19
17
  import yaml
20
18
 
21
19
  from bmcgo import errors
@@ -68,21 +66,31 @@ class BmcgoCommand:
68
66
  def __init__(self, bconfig: BmcgoConfig, *args):
69
67
  self.bconfig = bconfig
70
68
  parser = tool.create_common_parser("Conan Index Build")
69
+ parser.add_argument("--conan2", help="是否构建conan2.x版本的组件包", action=misc.STORE_TRUE)
71
70
  self.args, _ = parser.parse_known_args(*args)
71
+ self.conan2 = self.args.conan2
72
72
  self.path = ""
73
73
  self.version = ""
74
+ self.name = ""
75
+ self.user = ""
76
+ self.channel = ""
74
77
  self.conan_package = ""
75
78
  self.upload = False
76
79
  self.remote = None
77
80
  self.options = []
78
- self.stage = misc.StageEnum.STAGE_DEV.value
81
+ self.stage = self.args.stage
79
82
  self.enable_luajit = False
80
83
  self.from_source = False
81
84
  self.build_type = 'debug'
82
85
  self.asan = False
83
86
  self.profile = ''
87
+ self.recipe_folder = self.bconfig.conan_index.folder
88
+ if misc.conan_v2():
89
+ recipes2_folder = os.path.join(self.bconfig.conan_index.folder, "..", "recipes2")
90
+ recipes2_folder = os.path.realpath(recipes2_folder)
91
+ if os.path.isdir(recipes2_folder):
92
+ self.recipe_folder = recipes2_folder
84
93
  self.initialize()
85
- self.channel = f"@{misc.ConanUserEnum.CONAN_USER_DEV.value}/{self.stage}"
86
94
 
87
95
  @staticmethod
88
96
  def run_command(command, ignore_error=False, sudo=False, **kwargs):
@@ -109,13 +117,15 @@ class BmcgoCommand:
109
117
  os.environ["LUA_PATH"] = f"{conan_bin}/?.lua"
110
118
 
111
119
  def initialize(self):
120
+ if not self.args.conan_package:
121
+ msg = "构建参数错误,请指定有效的-cp参数,例:kmc/1.0.1 或 kmc/1.0.1@openubmc/stable"
122
+ raise errors.BmcGoException(msg)
112
123
  self.set_package(self.args.conan_package)
113
124
  self.upload = self.args.upload_package
114
125
  if self.args.remote:
115
126
  self.remote = self.args.remote
116
127
  if self.args.options:
117
128
  self.options = self.args.options
118
- self.stage = self.args.stage
119
129
  self.enable_luajit = self.args.enable_luajit
120
130
  self.from_source = self.args.from_source
121
131
  self.build_type = self.args.build_type
@@ -126,15 +136,25 @@ class BmcgoCommand:
126
136
 
127
137
  # 入参可以是huawei_secure_c/1.0.0样式
128
138
  def set_package(self, path: str):
129
- os.chdir(self.bconfig.conan_index.folder)
130
- split = path.split("/")
131
- if len(split) != 2:
132
- raise errors.BmcGoException(f"包名称({path})错误,例:kmc/1.0.1")
139
+ os.chdir(self.recipe_folder)
140
+ split = re.split('/|@', path)
141
+ if len(split) != 2 and len(split) != 4:
142
+ raise errors.BmcGoException(f"包名称({path})错误,例:kmc/1.0.1 或 kmc/1.0.1@openubmc/stable")
143
+ self.name = split[0].lower()
144
+ if len(split) == 2:
145
+ if self.stage == "dev":
146
+ self.user = misc.conan_user_dev()
147
+ else:
148
+ self.user = misc.conan_user()
149
+ self.channel = self.stage
150
+ else:
151
+ self.user = split[2]
152
+ self.channel = split[3]
133
153
 
134
154
  if not os.path.isdir(split[0]):
135
155
  raise errors.BmcGoException(f"包路径({split[0]})不存在,或不是文件夹")
136
156
 
137
- config_yaml = os.path.join(self.bconfig.conan_index.folder, split[0], "config.yml")
157
+ config_yaml = os.path.join(self.recipe_folder, split[0], "config.yml")
138
158
  with open(config_yaml) as f:
139
159
  config_data = yaml.safe_load(f)
140
160
  config_data = config_data.get('versions', None)
@@ -148,18 +168,55 @@ class BmcgoCommand:
148
168
  raise errors.BmcGoException(f"Unkown folder, config.yml path: {config_yaml}, version: {split[1]}")
149
169
  self.path = "{}/{}".format(split[0], folder)
150
170
  self.version = split[1]
171
+ if misc.conan_v2():
172
+ self.version = self.version.lower()
173
+ # openubmcsdk采用的不是conandata.yml的方式,需特殊处理
174
+ if self.name == "openubmcsdk":
175
+ return
151
176
  if self.stage != "dev":
152
177
  self.tag_check()
153
178
 
154
- def run(self):
179
+ def run_v2(self):
180
+ log.info("Start build package")
181
+ if self.build_type == "debug":
182
+ setting = "-s build_type=Debug"
183
+ else:
184
+ setting = "-s build_type=Release"
185
+ options = " "
186
+ if self.asan:
187
+ options += f"-o {self.name}/*:asan=True"
188
+ for option in self.options:
189
+ options += f" -o {option}"
190
+
191
+ dt_stat = os.environ.get("BINGO_DT_RUN", "off")
192
+ show_log = True if dt_stat == "off" else False
193
+ pkg = self.name + "/" + self.version + "@" + self.user + "/" + self.channel
194
+ # openubmcsdk通过export发布,需特殊处理
195
+ if self.name == "openubmcsdk":
196
+ cmd = "conan export . --name {} --version {} --user {} --channel {}".format(
197
+ self.name, self.version, self.user, self.channel)
198
+ else:
199
+ append_cmd = f"-r {self.remote}" if self.remote else ""
200
+ cmd = "conan create . --name={} --version={} -pr={} {} {} {}".format(
201
+ self.name, self.version, self.profile, setting, append_cmd, options
202
+ )
203
+
204
+ cmd += " --user={} --channel={}".format(self.user, self.channel)
205
+ if self.from_source:
206
+ cmd += " --build=*"
207
+ else:
208
+ cmd += f" --build={self.name}/* --build=missing"
209
+ self.run_command(cmd, show_log=show_log)
210
+
211
+ if not self.upload:
212
+ return
213
+
214
+ cmd = "conan upload {} -r {}".format(pkg, self.remote)
215
+ self.run_command(cmd)
216
+ log.info("===>>>Upload package successfully, pkg: {}".format(pkg))
217
+
218
+ def run_v1(self):
155
219
  self.check_luac()
156
- if self.path == "" or self.version == "":
157
- raise errors.BmcGoException(f"Path({self.path}) or version({self.version}) error")
158
- os.chdir(self.bconfig.conan_index.folder)
159
- os.chdir(self.path)
160
- if self.stage != misc.StageEnum.STAGE_DEV.value:
161
- # rc和stable模式
162
- self.channel = f"@{tool.conan_user}/{self.stage}"
163
220
  log.info("Start build package")
164
221
  if self.build_type == "dt":
165
222
  setting = "-s build_type=Dt"
@@ -177,7 +234,7 @@ class BmcgoCommand:
177
234
 
178
235
  dt_stat = os.environ.get("BMCGO_DT_RUN", "off")
179
236
  show_log = True if dt_stat == "off" else False
180
- pkg = packake_name + "/" + self.version + self.channel
237
+ pkg = self.name + "/" + self.version + "@" + self.user + "/" + self.channel
181
238
  append_cmd = f"-r {self.remote}" if self.remote else ""
182
239
  cmd = "conan create . {} -pr={} -pr:b profile.dt.ini {} {} -tf None {}".format(
183
240
  pkg, self.profile, setting, append_cmd, options
@@ -187,11 +244,20 @@ class BmcgoCommand:
187
244
  cmd += " --build=*"
188
245
  else:
189
246
  cmd += " --build=missing"
247
+ # openubmcsdk通过export发布,需特殊处理
248
+ if self.name == "openubmcsdk":
249
+ cmd = "conan export . {}".format(pkg)
190
250
  self.run_command(cmd, show_log=show_log)
191
251
 
192
252
  if not self.upload:
193
253
  return
194
254
 
255
+ # openubmcsdk组件无conan info信息,需特殊处理
256
+ if self.name == "openubmcsdk":
257
+ cmd = "conan upload {} -r {}".format(pkg, self.remote)
258
+ self.run_command(cmd)
259
+ log.info("===>>>Upload package successfully, pkg: {}".format(pkg))
260
+ return
195
261
  cmd = "conan info {} -pr={} -j".format(pkg, self.profile)
196
262
  info_json = self.run_command(cmd, shell=True, capture_output=True).stdout
197
263
  for line in info_json.split("\n"):
@@ -206,6 +272,16 @@ class BmcgoCommand:
206
272
  self.run_command(cmd)
207
273
  log.info("===>>>Upload package successfully, pkg: {}:{}".format(pkg, i["id"]))
208
274
 
275
+ def run(self):
276
+ if self.path == "" or self.version == "":
277
+ raise errors.BmcGoException(f"Path({self.path}) or version({self.version}) error")
278
+
279
+ os.chdir(self.path)
280
+ if misc.conan_v1():
281
+ self.run_v1()
282
+ else:
283
+ self.run_v2()
284
+
209
285
  def tag_check(self):
210
286
  yaml_file = f"{self.path}/conandata.yml"
211
287
  if os.path.exists(yaml_file) is False:
@@ -46,7 +46,7 @@ cwd = os.getcwd()
46
46
 
47
47
  SR_UPGRADE = "SRUpgrade"
48
48
  TIANCHI = "bmc.dev.Board.TianChi"
49
- HPM_PACK_PATH = "/usr/share/bmcgo/csr_packet"
49
+ HPM_PACK_PATH = "/usr/share/bingo/csr_packet"
50
50
  EEPROM_SIZE_LIMIT_CONFIG = "/usr/share/bmcgo/schema/eepromSizeLimit.json"
51
51
 
52
52
  JSON_DATA_FORMAT = 0x01
bmcgo/functional/diff.py CHANGED
@@ -105,7 +105,7 @@ class BmcgoCommand:
105
105
  tempfile = NamedTemporaryFile()
106
106
  # 过滤只包含scm的信息, 并将其生成为字典对象
107
107
  ret = tools.run_command(f"conan info {version} --json {tempfile.name} \
108
- -r {misc.CONAN_REPO}", ignore_error=True, command_echo=False, capture_output=True)
108
+ -r {misc.conan_remote()}", ignore_error=True, command_echo=False, capture_output=True)
109
109
  file_handler = open(tempfile.name, "r")
110
110
  conan_comps = json.load(file_handler)
111
111
  version_msg = ""
bmcgo/functional/fetch.py CHANGED
@@ -163,7 +163,7 @@ framework、bmc_core、security、hardware、ras、energy、om、interface、pro
163
163
  stage = self.stage
164
164
  if stage != misc.StageEnum.STAGE_STABLE.value:
165
165
  stage = misc.StageEnum.STAGE_RC.value
166
- user_channel = f"@{tools.conan_user}/{stage}"
166
+ user_channel = f"@{misc.conan_user()}/{stage}"
167
167
  com_package[index] += user_channel
168
168
 
169
169
  def __load_config_json(self, stage):
@@ -23,8 +23,6 @@ import functools
23
23
  import random
24
24
  from concurrent.futures import ProcessPoolExecutor, Future
25
25
  from typing import List
26
-
27
- from conans.model.manifest import FileTreeManifest
28
26
  import yaml
29
27
 
30
28
  from bmcgo import misc
@@ -71,7 +69,7 @@ class BuildComponent:
71
69
  build_type: str,
72
70
  options: dict,
73
71
  code_path: str,
74
- remote=misc.CONAN_REPO,
72
+ remote=misc.conan_remote(),
75
73
  service_json="mds/service.json",
76
74
  upload=False,
77
75
  ):
@@ -90,12 +88,15 @@ class BuildComponent:
90
88
  def run(self):
91
89
  os.chdir(os.path.join(self.code_path, self.comp_name))
92
90
  for key, value in self.options.items():
93
- self.option_cmd = self.option_cmd + f" -o {self.comp_name}:{key}={value}"
91
+ if misc.conan_v2():
92
+ self.option_cmd = self.option_cmd + f" -o {self.comp_name}/*:{key}={value}"
93
+ else:
94
+ self.option_cmd = self.option_cmd + f" -o {self.comp_name}:{key}={value}"
94
95
  command = (
95
96
  f"--remote {self.remote} -nc --stage {self.stage} --build_type {self.build_type.lower()}"
96
97
  f" --profile {self.profile} {self.option_cmd}"
97
98
  )
98
- log.info(f"执行构建命令bingo build {command}")
99
+ log.info(f"执行构建命令{misc.tool_name()} build {command}")
99
100
  args = command.split()
100
101
  build = BuildComp(self.bconfig, args, service_json=self.service_json)
101
102
  # 恢复工作区为clean状态, 保证conan export时scm信息准确
@@ -112,7 +113,7 @@ class BmcgoCommand:
112
113
  def __init__(self, bconfig: BmcgoConfig, *args):
113
114
  parser = argparse.ArgumentParser(description="Fetch component source code and build all binaries.")
114
115
  parser.add_argument("-comp", "--component", help="软件包名, 示例: oms/1.2.6", required=True)
115
- parser.add_argument("-r", "--remote", help="远端仓库名称", default=misc.CONAN_REPO)
116
+ parser.add_argument("-r", "--remote", help="远端仓库名称", default=misc.conan_remote())
116
117
  parser.add_argument(
117
118
  "-p",
118
119
  "--path",
@@ -136,9 +137,11 @@ class BmcgoCommand:
136
137
  self.upload = parsed_args.upload
137
138
  self.config_file = parsed_args.config_file
138
139
  self.skip_fetch = parsed_args.skip_fetch
139
- self.profile_list = ["profile.dt.ini", "profile.luajit.ini"]
140
- self.stage_list = [STAGE_STABLE]
141
- self.built_type_list = [BUILD_TYPE_DT, BUILD_TYPE_DEBUG, BUILD_TYPE_RELEASE]
140
+ self.profile_list = ["profile.dt.ini"]
141
+ if misc.conan_v1():
142
+ self.profile_list.append("profile.luajit.ini")
143
+ self.stage_list = [misc.StageEnum.STAGE_STABLE]
144
+ self.built_type_list = [misc.BuildTypeEnum.DEBUG, misc.BuildTypeEnum.RELEASE]
142
145
  if parsed_args.build_type:
143
146
  self.built_type_list = parsed_args.build_type
144
147
  self.options_dict = {}
@@ -185,7 +188,7 @@ class BmcgoCommand:
185
188
 
186
189
  # 添加module_symver选项
187
190
  module_symvers_path = os.path.join(SDK_PATH, MODULE_SYMVERS)
188
- module_symver_key, module_symver_value = tool.get_module_symver_option(module_symvers_path)
191
+ module_symver_key, module_symver_value = tool.get_171x_module_symver_option(module_symvers_path)
189
192
  if module_symver_key in options_dict:
190
193
  options_dict[module_symver_key] = [module_symver_value]
191
194
  if config_file:
@@ -237,24 +240,28 @@ class BmcgoCommand:
237
240
  @staticmethod
238
241
  def _replace_dev_version(temp_service_json: str):
239
242
  version_parse = ComponentDtVersionParse(serv_file=temp_service_json)
240
- for pkg in version_parse.conan_list:
241
- component = pkg[misc.CONAN]
242
- if "@" not in component:
243
- continue
244
- comp_version, user_channel = component.split("@")
245
- if user_channel.endswith(STAGE_DEV):
246
- pkg[misc.CONAN] = f"{comp_version}{ComponentHelper.get_user_channel(STAGE_DEV)}"
247
-
243
+ if misc.conan_v1():
244
+ for pkg in version_parse.conan_list:
245
+ component = pkg[misc.CONAN]
246
+ if "@" not in component:
247
+ continue
248
+ comp_version, user_channel = component.split("@")
249
+ if user_channel.endswith(STAGE_DEV):
250
+ pkg[misc.CONAN] = f"{comp_version}{ComponentHelper.get_user_channel(STAGE_DEV)}"
248
251
  version_parse.write_to_serv_file()
249
252
 
250
253
  @functools.cached_property
251
254
  def _full_reference(self) -> str:
252
- comp_pkg = self.comp if "@" in self.comp else f"{self.comp}@{CONAN_USER}.release/{STAGE_STABLE}"
255
+ if misc.conan_v1():
256
+ comp_pkg = self.comp if "@" in self.comp else f"{self.comp}@{CONAN_USER}.release/{STAGE_STABLE}"
257
+ else:
258
+ comp_pkg = self.comp if "@" in self.comp else f"{self.comp}@{misc.conan_user()}/{STAGE_STABLE}"
253
259
  return comp_pkg
254
260
 
255
261
  @functools.cached_property
256
262
  def _is_self_developed(self) -> bool:
257
- tool.run_command(f"conan download {self._full_reference} --recipe -r {self.remote}")
263
+ args = "--only-recipe" if misc.conan_v2() else "--recipe"
264
+ tool.run_command(f"conan download {self._full_reference} {args} -r {self.remote}")
258
265
  comp_package_path = os.path.join(tool.conan_data, self.comp_name)
259
266
  ret = tool.run_command(f"find {comp_package_path} -name 'conanbase.py'", capture_output=True)
260
267
  return bool(ret.stdout)
@@ -348,10 +355,11 @@ class BmcgoCommand:
348
355
  random.shuffle(all_build_params)
349
356
  for build_args in all_build_params:
350
357
  profile, stage, build_type, *option_values = build_args
351
- if profile == "profile.dt.ini" and build_type.lower() != BUILD_TYPE_DT.lower():
352
- continue
353
- if profile != "profile.dt.ini" and build_type.lower() == BUILD_TYPE_DT.lower():
354
- continue
358
+ if misc.conan_v1():
359
+ if profile == "profile.dt.ini" and build_type.lower() != BUILD_TYPE_DT.lower():
360
+ continue
361
+ if profile != "profile.dt.ini" and build_type.lower() == BUILD_TYPE_DT.lower():
362
+ continue
355
363
  build_options = dict(zip(options_dict.keys(), option_values))
356
364
  task = BuildComponent(
357
365
  self.comp,