openubmc-bingo 0.6.59__py3-none-any.whl → 0.6.60__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.

bmcgo/__init__.py CHANGED
@@ -9,4 +9,4 @@
9
9
  # MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10
10
  # See the Mulan PSL v2 for more details.
11
11
 
12
- __version__ = '0.6.59'
12
+ __version__ = '0.6.60'
@@ -194,3 +194,13 @@ class ComponentHelper:
194
194
  stage = misc.StageEnum.STAGE_RC.value
195
195
  user_channel = f"@{misc.conan_user()}/{stage}"
196
196
  return user_channel
197
+
198
+ @staticmethod
199
+ def get_full_reference(components: List[str], stage: str):
200
+ user_channel = ComponentHelper.get_user_channel(stage)
201
+ full_reference_comps = []
202
+ for comp in components:
203
+ if "@" not in comp:
204
+ comp += user_channel
205
+ full_reference_comps.append(comp)
206
+ return full_reference_comps
bmcgo/component/test.py CHANGED
@@ -876,8 +876,19 @@ class TestComp():
876
876
 
877
877
  def check_folder(self):
878
878
  test_package_folder = os.path.join(self.folder, "test_package")
879
- test_folder = os.path.join(self.folder, "test")
880
- if os.path.isdir(test_folder) or os.path.isdir(test_package_folder):
879
+ ut_path = os.path.join(self.folder, "test", "unit")
880
+ it_path = os.path.join(self.folder, "test", "intergration")
881
+ fz_path = os.path.join(self.folder, "test", "fuzz")
882
+
883
+ has_dt_type = self.unit_test or self.integration_test or self.fuzz_test
884
+ if not has_dt_type:
885
+ self.unit_test = True
886
+ self.unit_test = os.path.isdir(ut_path) and self.unit_test
887
+ self.integration_test = os.path.isdir(it_path) and self.integration_test
888
+ self.fuzz_test = os.path.isdir(fz_path) and self.fuzz_test
889
+ has_dt_type = self.unit_test or self.integration_test or self.fuzz_test
890
+
891
+ if os.path.isdir(test_package_folder) or has_dt_type:
881
892
  return True
882
893
  return False
883
894
 
@@ -160,8 +160,36 @@ command_info: CommandInfo = CommandInfo(
160
160
  class BmcgoCommand:
161
161
  def __init__(self, bconfig: BmcgoConfig, *args):
162
162
  self.bconfig = bconfig
163
+ parser = self.get_arg_parser()
164
+ parsed_args, _ = parser.parse_known_args(*args)
165
+ self.csr_path = os.path.realpath(parsed_args.path)
166
+ self.single = parsed_args.single
167
+ self.oem_path = parsed_args.oem
168
+ self.output_path = os.path.realpath(parsed_args.output_path)
169
+ self.json = parsed_args.json
170
+ self.bin = parsed_args.bin
171
+ self.hpm = parsed_args.hpm
172
+ self.all = parsed_args.all
173
+ self.tar = parsed_args.tar
174
+ self.frud = parsed_args.frud
175
+ self.max_size_map = parsed_args.max_config
176
+ self.uid = parsed_args.uid
177
+ # 保留原始参数集,用于重写初始化函数扩展参数解析
178
+ self.parsed_args = parsed_args
179
+ self.work_dir = None
180
+ self.target_dir = None
181
+ self.eeprom_sign_strategy = None
182
+ self.hpm_sign_strategy = None
183
+ self.tmp_dir = None
184
+ self.merger = Merger(self.output_path)
185
+
186
+ @staticmethod
187
+ def get_arg_parser():
188
+ '''
189
+ 参数解析类扩展点,可重写此方法扩展自定义参数
190
+ '''
163
191
  parser = argparse.ArgumentParser(
164
- prog="bingo build_csr",
192
+ prog=f"{misc.tool_name()} build_csr",
165
193
  description="csr出包,支持单个CSR和批量CSR出包",
166
194
  add_help=True,
167
195
  formatter_class=argparse.RawTextHelpFormatter,
@@ -189,25 +217,7 @@ class BmcgoCommand:
189
217
  help="eeprom大小限制的json配置文件路径,无配置时默认限制为32k",
190
218
  default=EEPROM_SIZE_LIMIT_CONFIG
191
219
  )
192
- parsed_args, _ = parser.parse_known_args(*args)
193
- self.csr_path = os.path.realpath(parsed_args.path)
194
- self.single = parsed_args.single
195
- self.oem_path = parsed_args.oem
196
- self.output_path = os.path.realpath(parsed_args.output_path)
197
- self.json = parsed_args.json
198
- self.bin = parsed_args.bin
199
- self.hpm = parsed_args.hpm
200
- self.all = parsed_args.all
201
- self.tar = parsed_args.tar
202
- self.frud = parsed_args.frud
203
- self.max_size_map = parsed_args.max_config
204
- self.uid = parsed_args.uid
205
- self.work_dir = None
206
- self.target_dir = None
207
- self.eeprom_sign_strategy = None
208
- self.hpm_sign_strategy = None
209
- self.tmp_dir = None
210
- self.merger = Merger(self.output_path)
220
+ return parser
211
221
 
212
222
  @staticmethod
213
223
  def get_oem_data(dir_path: str, comp_name: str):
@@ -269,7 +279,7 @@ class BmcgoCommand:
269
279
  self.get_hpm_sign_strategy()
270
280
 
271
281
  def make_sr_binary(self, options: SrMakeOptions, hpm_temp_dir: str, max_size: int):
272
- eeprom_build_controller = EepromBuild(self.bconfig, options, self.work_dir, self.eeprom_sign_strategy)
282
+ eeprom_build_controller = self._get_eeprom_builder(options)
273
283
  eeprom_data = eeprom_build_controller.build_eeprom()
274
284
  if len(eeprom_data) > max_size * 1024 - 40:
275
285
  raise errors.BmcGoException(f"Eeprom二进制文件大小超过限制: {options.comp_name}")
@@ -293,6 +303,8 @@ class BmcgoCommand:
293
303
  with open(binary_files[0], 'wb') as f:
294
304
  f.write(eeprom_data)
295
305
  for binary_file in binary_files[1:]:
306
+ if binary_file == binary_files[0]:
307
+ continue
296
308
  shutil.copy(binary_files[0], binary_file)
297
309
 
298
310
  def run(self):
@@ -325,12 +337,11 @@ class BmcgoCommand:
325
337
  hpm_file = os.path.join(self.target_dir, f"{sr_make_options_list[0].comp_name}.hpm")
326
338
  else:
327
339
  hpm_file = os.path.join(self.target_dir, f"CSR-{get_timestamp()}.hpm")
328
- params = (self.bconfig, hpm_file, self.work_dir, self.hpm_sign_strategy)
329
- hpm_package = HpmBuild(*params)
340
+ hpm_package = self._get_hpm_builder(hpm_file)
330
341
  log.info("开始执行hpm包构建任务...")
331
342
  hpm_package.run()
332
343
  if self.single or self.frud or self.tar:
333
- output_file = os.path.join(self.output_path, f"bingo-{get_timestamp()}.tar.gz")
344
+ output_file = os.path.join(self.output_path, f"{misc.tool_name()}-{get_timestamp()}.tar.gz")
334
345
  tar_command = ['tar', '-czf', output_file, "-C", self.target_dir, "."]
335
346
  try:
336
347
  result = subprocess.run(tar_command, check=True)
@@ -340,12 +351,11 @@ class BmcgoCommand:
340
351
  else:
341
352
  output_hpm_file = os.path.join(self.output_path, os.path.basename(hpm_file))
342
353
  shutil.copy(hpm_file, output_hpm_file)
354
+ log.info(f"成功创建hpm包{os.path.basename(output_hpm_file)}")
343
355
  log.info("构建成功!")
344
356
  finally:
345
- if os.path.exists(self.work_dir):
346
- shutil.rmtree(self.work_dir)
347
- if os.path.exists(self.tmp_dir):
348
- shutil.rmtree(self.tmp_dir)
357
+ shutil.rmtree(self.work_dir, ignore_errors=True)
358
+ shutil.rmtree(self.tmp_dir, ignore_errors=True)
349
359
 
350
360
  def check_args(self):
351
361
  has_single_need_arg = self.bin or self.json or self.hpm or self.all
@@ -442,6 +452,19 @@ class BmcgoCommand:
442
452
  else:
443
453
  return False
444
454
 
455
+ def _get_hpm_builder(self, hpm_file: str):
456
+ '''
457
+ Hpm包构造器扩展点
458
+ '''
459
+ params = (self.bconfig, hpm_file, self.work_dir, self.hpm_sign_strategy)
460
+ return HpmBuild(*params)
461
+
462
+ def _get_eeprom_builder(self, option: SrMakeOptions):
463
+ '''
464
+ Eeprom内容构造器扩展点
465
+ '''
466
+ return EepromBuild(self.bconfig, option, self.work_dir, self.eeprom_sign_strategy)
467
+
445
468
 
446
469
  class EepromBuild:
447
470
  def __init__(self, bconfig, options, work_dir, strategy):
@@ -623,7 +646,7 @@ class EepromBuild:
623
646
  # 创建数字签名域数据
624
647
  def sign_eeprom(self, un_sign_data: bytearray):
625
648
  if self.strategy == SignatureTypeEnum.DEFAULT:
626
- return self.get_eeprom_default_sign()
649
+ return self._get_eeprom_default_sign(un_sign_data)
627
650
  elif not (self.strategy == SignatureTypeEnum.SERVER_SIGN or
628
651
  self.strategy == SignatureTypeEnum.SELF_SIGN):
629
652
  raise errors.BmcGoException("Invalid signing strategy.")
@@ -642,9 +665,6 @@ class EepromBuild:
642
665
  if os.path.exists(tmp_sign_path):
643
666
  shutil.rmtree(tmp_sign_path)
644
667
  return self.build_sign(sign_data)
645
-
646
- def get_eeprom_default_sign(self):
647
- return bytearray(self.sign_len)
648
668
 
649
669
  def get_eeprom_self_sign(self, un_sign_data):
650
670
  signing_key = self.load_key()
@@ -765,6 +785,9 @@ class EepromBuild:
765
785
  # 12. CRC32 校验和(4字节)
766
786
  eeprom_header_buf.put_uint32(self.get_crc32_check_sum(eeprom_header_buf.array()))
767
787
  return eeprom_header_buf.array()
788
+
789
+ def _get_eeprom_default_sign(self, _):
790
+ return bytearray(self.sign_len)
768
791
 
769
792
 
770
793
  class EepromHeader:
@@ -814,6 +837,7 @@ class HpmBuild:
814
837
 
815
838
  @staticmethod
816
839
  def sign_hpm_default():
840
+ log.info("未配置签名策略,跳过hpm包签名...")
817
841
  cms_file = os.path.realpath("image.filelist.cms")
818
842
  tool.pipe_command([f"echo 'cms placeholder'"], out_file=cms_file)
819
843
  crl_file = os.path.realpath("crldata.crl")
@@ -852,14 +876,13 @@ class HpmBuild:
852
876
  # 对hpm包进行签名
853
877
  def sign_hpm(self):
854
878
  if self.strategy == SignatureTypeEnum.DEFAULT:
855
- log.info("未配置签名策略,跳过hpm包签名...")
856
879
  self.sign_hpm_default()
857
880
  elif self.strategy == SignatureTypeEnum.SELF_SIGN or\
858
881
  self.strategy == SignatureTypeEnum.SERVER_SIGN:
859
882
  # 生成.filelist文件
860
883
  tool.run_command(f"cms_sign_hpm.sh 1 {self.hpm_name}", command_echo=False)
861
884
  shutil.copy("devkit.filelist", "image.filelist")
862
- SignGenerator(self.bconfig, self.strategy, "image.filelist").sign_generate()
885
+ self._get_generator().sign_generate()
863
886
  else:
864
887
  raise errors.BmcGoException("Invalid signing strategy.")
865
888
 
@@ -879,6 +902,12 @@ class HpmBuild:
879
902
  self.sign_hpm()
880
903
  self.rebuild_hpm()
881
904
 
905
+ def _get_generator(self):
906
+ '''
907
+ 签名工具扩展点
908
+ '''
909
+ return SignGenerator(self.bconfig, self.strategy, "image.filelist")
910
+
882
911
 
883
912
  class SignGenerator:
884
913
  def __init__(self, bconfig: BmcgoConfig, sign_strategy: str, unsigned_file: str):
@@ -25,8 +25,7 @@ class TaskClass(Task):
25
25
  def __init__(self, config: Config, work_name=""):
26
26
  super().__init__(config, work_name)
27
27
 
28
- def version_xml_update(self, hpm_name, version_name):
29
- version_file = os.path.join(self.config.board_path, version_name)
28
+ def version_xml_update(self, hpm_name, version_file):
30
29
  if not os.path.exists(version_file):
31
30
  return
32
31
  srv_tree = ET.parse(version_file)
@@ -44,6 +43,14 @@ class TaskClass(Task):
44
43
  srv_root.find(PACKAGE).find('Size').text = str(os.path.getsize(hpm_name))
45
44
  srv_tree.write(version_file)
46
45
 
46
+ # 打桩函数,函数名不允许变更
47
+ def package_mib(self, build_path, zip_name, target_dir):
48
+ pass
49
+
50
+ # 打桩函数,函数名不允许变更
51
+ def write_ingredient(self, build_path):
52
+ pass
53
+
47
54
  def run(self):
48
55
  if self.config.manufacture_code is not None:
49
56
  self.info(f"编码为 {self.config.manufacture_code} 为 togdp 编码, 跳过构建 tosupporte 包")
@@ -70,8 +77,9 @@ class TaskClass(Task):
70
77
  self.chdir(build_path)
71
78
  # 复制所需文件
72
79
  files = self.get_manufacture_config(supporte_config + "/files")
73
- self.version_xml_update(f"{self.config.work_out}/rootfs_{self.config.board_name}.hpm", "version.xml")
74
80
  self.copy_manifest_files(files)
81
+ self.version_xml_update(f"{self.config.work_out}/rootfs_{self.config.board_name}.hpm", "version.xml")
82
+ self.write_ingredient(build_path)
75
83
 
76
84
  # 由于tosupporte解压后没有文件夹
77
85
  cmd = "zip -1 -rq {} .".format(zip_name)
@@ -82,6 +90,6 @@ class TaskClass(Task):
82
90
  os.makedirs(target_dir, exist_ok=True)
83
91
  # 硬链接文件目标目录
84
92
  self.link(zip_name, os.path.join(target_dir, zip_name))
85
-
93
+ self.package_mib(build_path, zip_name, target_dir)
86
94
  self.chdir(self.config.temp_path)
87
95
  shutil.rmtree(build_path, ignore_errors=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openubmc-bingo
3
- Version: 0.6.59
3
+ Version: 0.6.60
4
4
  Summary: Tools provided by openubmc
5
5
  Home-page: https://openubmc.cn
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,4 +1,4 @@
1
- bmcgo/__init__.py,sha256=WCeuHxskNJNexpFQY1v5EHAl1f6ysPef-7lxsGm9TfE,562
1
+ bmcgo/__init__.py,sha256=ny0a2iUY34db1tjNvG7JQ4o8ANmHJBphk9ou-Ry9Yk0,562
2
2
  bmcgo/bmcgo.py,sha256=uD4TsfjrFB5aQPIS6WRUVc9ShXX-dSImY9ezkB13g1w,685
3
3
  bmcgo/bmcgo_config.py,sha256=-KYhC3jNqWkCWu6YkyxDZlyC3floXIHaibGpmyB6YWQ,11873
4
4
  bmcgo/errors.py,sha256=QW1ndrJcJ2Ws7riOznPKVvZsNlrYk73eZol7w8gJTPU,3076
@@ -170,11 +170,11 @@ bmcgo/codegen/lua/v1/templates/apps/utils/mdb_obj.lua.mako,sha256=oCzx2u3bjvCdNK
170
170
  bmcgo/component/__init__.py,sha256=BDXz8BcSlCkfo5UYt6j2rm89-HiYA1ZzfpFhy99MH-0,538
171
171
  bmcgo/component/build.py,sha256=zEtX3IG43z-EC8frpuRRH8zx2KjVuA1LlLnhDgErhqE,12920
172
172
  bmcgo/component/component_dt_version_parse.py,sha256=-Rt6i2fZrmYNZGoMqB21D_T9fC7fhhtUFIFvdPsMICM,14188
173
- bmcgo/component/component_helper.py,sha256=rNwfhagfz6E3BjKERq9oOPLRfeKQlqhLojb6oJLXcEA,7933
173
+ bmcgo/component/component_helper.py,sha256=gB2N3eRH8gmWbYBHAV-ejD4bEhk71ZVeuXi46z_mLuU,8294
174
174
  bmcgo/component/deploy.py,sha256=Iy5CsiolKS1h5jDg13nYkfy6--BtbBZ8FLou2oVuoLQ,6544
175
175
  bmcgo/component/gen.py,sha256=lhPe_VV08CDFSydSLCX7IC5m8obNvYZSSzIp9o84nd0,7248
176
176
  bmcgo/component/package_info.py,sha256=pYgubJ-564JXQmEaSlYfGnoVgrNlY3O5jJP1vxZe-Qc,14844
177
- bmcgo/component/test.py,sha256=Kpg5fmcJ-F2lDlHsKTBXjhB00T-IOr5QWGfHsRXVgA0,45260
177
+ bmcgo/component/test.py,sha256=fJ1dHj69ZDVl5deo4YoJgIdQwTpByn5owWH0xuHdnhw,45816
178
178
  bmcgo/component/analysis/analysis.py,sha256=oc5m6qGWZm6G3n8cVENs86DAWywMNuxTqhO5QIb9fX8,9363
179
179
  bmcgo/component/analysis/build_deps.py,sha256=cyQh5D3R1syQfMJcNxEIKKSJGanPMNRFPGlJRitDAa0,7324
180
180
  bmcgo/component/analysis/data_deps.py,sha256=lDCVZ1B56pOW3BApCroujEaak4I07tN9mDOWruhuDkc,16431
@@ -198,7 +198,7 @@ bmcgo/functional/bmc_studio_action.py,sha256=Gg96UB8QtnhsaqSdMhXuS9fddzAFPhR6UYC
198
198
  bmcgo/functional/check.py,sha256=ReGN_8RRM6isX_r7XXEuHzkooh8pasky5_GpAml5d_g,8356
199
199
  bmcgo/functional/conan_index_build.py,sha256=Mp1fDpZVvecn5lUCsWZqq3mKSx9yu5pznQrDZr4Liuk,13443
200
200
  bmcgo/functional/config.py,sha256=ZQ-a9hegI0cV41iTo7t49ryBeUH4wPJ-qkVvWp8toV4,10824
201
- bmcgo/functional/csr_build.py,sha256=JTIvbjn08xvdo7aUhKW4giwPayojyIeQolT14SuwJRo,41146
201
+ bmcgo/functional/csr_build.py,sha256=k6vEWuhrmTXTndMQX-RF6v9S7So-Gi4WWjoUYzh5IVA,42046
202
202
  bmcgo/functional/deploy.py,sha256=2NsxCpoZjL4jTyRpbIp20-EKKbQkQe-Hsm20uxHK2Xc,10677
203
203
  bmcgo/functional/diff.py,sha256=ygxeVFUwUX2a6zg8nWlxIchh_-ajtKpvAqLb8INe6YE,10562
204
204
  bmcgo/functional/fetch.py,sha256=hkuHDKyrfbEhvnLbZ8-funhXTkSrCY27WFnYBJFRJMY,10768
@@ -233,7 +233,7 @@ bmcgo/tasks/task_create_interface_config.py,sha256=rkFRGLrUgYCics-n1CKwCoQscU2Ba
233
233
  bmcgo/tasks/task_download_buildtools.py,sha256=QZpsrm2eaoJ0z5PkdSuHXg1n7L9qPz2s3XAVCnQi-hA,4292
234
234
  bmcgo/tasks/task_download_dependency.py,sha256=2AW4awv_njlTrKy11ygKWekFBXLyS18FLcws8cVXGz0,3169
235
235
  bmcgo/tasks/task_hpm_envir_prepare.py,sha256=Jkt5tu04NUpSuiKG1Iaei8fUloWYhwHwdXehj4PLwMA,4244
236
- bmcgo/tasks/task_packet_to_supporte.py,sha256=eaNtri3YQfXFBnceM1-2C_6AgMgrGxEj4xKXTgNRPH8,4100
236
+ bmcgo/tasks/task_packet_to_supporte.py,sha256=5VSnC9typxiShCxt8YWWyBVojJ6MaXvgPHiIf6bObuA,4351
237
237
  bmcgo/tasks/task_prepare.py,sha256=K1cb_3lhclRkCYa2wgp5E2FMOd3pC7VHBnm_4L_nrRE,6704
238
238
  bmcgo/tasks/task_sign_and_pack_hpm.py,sha256=dLXTea5zfYg9UwYzhpl6o3eYd4Zg3vyB5GED4QcTvT0,2238
239
239
  bmcgo/tasks/conan/__init__.py,sha256=BDXz8BcSlCkfo5UYt6j2rm89-HiYA1ZzfpFhy99MH-0,538
@@ -264,8 +264,8 @@ bmcgo/utils/installations/install_plans/qemu.yml,sha256=lT7aKag60QUH6hTGFKa3hGRq
264
264
  bmcgo/utils/installations/install_plans/studio.yml,sha256=AEspVgsVAnmUdvqZYNCb7SPoUEq_0i61dfpauyguLa4,229
265
265
  bmcgo/utils/installations/installers/apt_installer.py,sha256=nPaCb4cobSi9InN_aHsEPtQ0k4FgsCUWE5_VgBPvcRE,3769
266
266
  bmcgo/utils/installations/installers/pip_installer.py,sha256=dDdios1EQ7fzt90r02pZeoM3jCmjslLzkSvzd2hgRVM,3241
267
- openubmc_bingo-0.6.59.dist-info/METADATA,sha256=42XLTEus73YQ00Rv-MmfEwoY7Cvt8ji1fMOB86l1g3A,1010
268
- openubmc_bingo-0.6.59.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
269
- openubmc_bingo-0.6.59.dist-info/entry_points.txt,sha256=UUoUP-vAWTgg9vEYbRwYqOBHgpRtkngdzMPb-ocz90g,42
270
- openubmc_bingo-0.6.59.dist-info/top_level.txt,sha256=9AcvCAt1nZcOgMsGt6T07mg2Bgtdet-3mHTwg91axgI,6
271
- openubmc_bingo-0.6.59.dist-info/RECORD,,
267
+ openubmc_bingo-0.6.60.dist-info/METADATA,sha256=p7RBW5UNu1H48Mblh12ZVoQ_wMv18WmnLNjqcaTV-hg,1010
268
+ openubmc_bingo-0.6.60.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
269
+ openubmc_bingo-0.6.60.dist-info/entry_points.txt,sha256=UUoUP-vAWTgg9vEYbRwYqOBHgpRtkngdzMPb-ocz90g,42
270
+ openubmc_bingo-0.6.60.dist-info/top_level.txt,sha256=9AcvCAt1nZcOgMsGt6T07mg2Bgtdet-3mHTwg91axgI,6
271
+ openubmc_bingo-0.6.60.dist-info/RECORD,,