openubmc-bingo 0.6.45__py3-none-any.whl → 0.6.99__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.
Files changed (96) hide show
  1. bmcgo/__init__.py +1 -1
  2. bmcgo/bmcgo.py +9 -3
  3. bmcgo/bmcgo_config.py +16 -0
  4. bmcgo/cli/cli.py +72 -21
  5. bmcgo/codegen/__init__.py +1 -1
  6. bmcgo/codegen/lua/codegen.py +2 -2
  7. bmcgo/codegen/lua/script/check_intfs.py +1 -0
  8. bmcgo/codegen/lua/script/dto/options.py +1 -0
  9. bmcgo/codegen/lua/script/gen_db_json.py +4 -3
  10. bmcgo/codegen/lua/script/gen_rpc_msg_json.py +78 -11
  11. bmcgo/codegen/lua/script/model_consistency_check.py +1 -1
  12. bmcgo/codegen/lua/script/render_utils/db_lua.py +5 -6
  13. bmcgo/codegen/lua/script/render_utils/model_lua.py +5 -1
  14. bmcgo/codegen/lua/script/template.py +5 -0
  15. bmcgo/codegen/lua/script/utils.py +50 -8
  16. bmcgo/codegen/lua/templates/apps/Makefile +2 -2
  17. bmcgo/codegen/lua/templates/apps/client.lua.mako +1 -1
  18. bmcgo/codegen/lua/templates/apps/model.lua.mako +4 -3
  19. bmcgo/codegen/lua/templates/apps/service.lua.mako +1 -1
  20. bmcgo/codegen/lua/templates/apps/utils/mdb_intf.lua.mako +4 -0
  21. bmcgo/codegen/lua/templates/new_app_v2/CMakeLists.txt.mako +26 -0
  22. bmcgo/codegen/lua/templates/new_app_v2/conanfile.py.mako +9 -0
  23. bmcgo/codegen/lua/v1/script/render_utils/db_lua.py +5 -6
  24. bmcgo/codegen/lua/v1/script/render_utils/model_lua.py +13 -1
  25. bmcgo/codegen/lua/v1/templates/apps/client.lua.mako +1 -1
  26. bmcgo/codegen/lua/v1/templates/apps/local_db.lua.mako +0 -4
  27. bmcgo/codegen/lua/v1/templates/apps/message.lua.mako +3 -0
  28. bmcgo/codegen/lua/v1/templates/apps/model.lua.mako +3 -0
  29. bmcgo/codegen/lua/v1/templates/apps/utils/mdb_intf.lua.mako +6 -4
  30. bmcgo/component/analysis/analysis.py +9 -4
  31. bmcgo/component/analysis/dep-rules.json +20 -8
  32. bmcgo/component/analysis/dep_node.py +2 -0
  33. bmcgo/component/analysis/intf_validation.py +8 -7
  34. bmcgo/component/analysis/sr_validation.py +5 -4
  35. bmcgo/component/busctl_log_parse/busctl_log_parser.py +809 -0
  36. bmcgo/component/busctl_log_parse/mock_data_save.py +170 -0
  37. bmcgo/component/busctl_log_parse/test_data_save.py +49 -0
  38. bmcgo/component/component_helper.py +29 -0
  39. bmcgo/component/coverage/incremental_cov.py +5 -0
  40. bmcgo/component/fixture/__init__.py +29 -0
  41. bmcgo/component/fixture/auto_case_generator.py +490 -0
  42. bmcgo/component/fixture/busctl_type_converter.py +1081 -0
  43. bmcgo/component/fixture/common_config.py +15 -0
  44. bmcgo/component/fixture/dbus_gateway.py +669 -0
  45. bmcgo/component/fixture/dbus_library.py +250 -0
  46. bmcgo/component/fixture/dbus_mock_utils.py +514 -0
  47. bmcgo/component/fixture/dbus_response_handler.py +138 -0
  48. bmcgo/component/fixture/dbus_signature.py +110 -0
  49. bmcgo/component/template_v2/conanbase.py.mako +1 -5
  50. bmcgo/component/test.py +69 -10
  51. bmcgo/error_analyzer/__init__.py +0 -0
  52. bmcgo/error_analyzer/case_matcher.py +114 -0
  53. bmcgo/error_analyzer/log_parser.py +128 -0
  54. bmcgo/error_analyzer/unified_error_analyzer.py +359 -0
  55. bmcgo/error_cases/cases.yml +59 -0
  56. bmcgo/error_cases/cases_template_valid.json +71 -0
  57. bmcgo/error_cases/conanfile.py +58 -0
  58. bmcgo/frame.py +0 -4
  59. bmcgo/functional/analysis.py +18 -12
  60. bmcgo/functional/bmc_studio_action.py +21 -10
  61. bmcgo/functional/check.py +86 -42
  62. bmcgo/functional/conan_index_build.py +1 -1
  63. bmcgo/functional/config.py +22 -18
  64. bmcgo/functional/csr_build.py +63 -34
  65. bmcgo/functional/deploy.py +4 -3
  66. bmcgo/functional/diff.py +51 -34
  67. bmcgo/functional/full_component.py +16 -5
  68. bmcgo/functional/hpm_signer.py +484 -0
  69. bmcgo/functional/new.py +8 -2
  70. bmcgo/functional/schema_valid.py +111 -15
  71. bmcgo/functional/upgrade.py +6 -6
  72. bmcgo/misc.py +1 -0
  73. bmcgo/tasks/task_build_conan.py +27 -6
  74. bmcgo/tasks/task_build_rootfs_img.py +120 -83
  75. bmcgo/tasks/task_buildgppbin.py +30 -13
  76. bmcgo/tasks/task_buildhpm_ext4.py +5 -3
  77. bmcgo/tasks/task_download_buildtools.py +20 -11
  78. bmcgo/tasks/task_download_dependency.py +29 -20
  79. bmcgo/tasks/task_hpm_envir_prepare.py +32 -53
  80. bmcgo/tasks/task_packet_to_supporte.py +12 -4
  81. bmcgo/tasks/task_prepare.py +1 -1
  82. bmcgo/tasks/task_sign_and_pack_hpm.py +15 -7
  83. bmcgo/utils/component_version_check.py +4 -4
  84. bmcgo/utils/config.py +3 -0
  85. bmcgo/utils/fetch_component_code.py +148 -17
  86. bmcgo/utils/install_manager.py +2 -2
  87. bmcgo/utils/installations/base_installer.py +10 -27
  88. bmcgo/utils/installations/install_plans/studio.yml +3 -0
  89. bmcgo/utils/mapping_config_patch.py +5 -4
  90. bmcgo/utils/tools.py +49 -7
  91. {openubmc_bingo-0.6.45.dist-info → openubmc_bingo-0.6.99.dist-info}/METADATA +1 -1
  92. {openubmc_bingo-0.6.45.dist-info → openubmc_bingo-0.6.99.dist-info}/RECORD +95 -74
  93. bmcgo/tasks/download_buildtools_hm.py +0 -124
  94. {openubmc_bingo-0.6.45.dist-info → openubmc_bingo-0.6.99.dist-info}/WHEEL +0 -0
  95. {openubmc_bingo-0.6.45.dist-info → openubmc_bingo-0.6.99.dist-info}/entry_points.txt +0 -0
  96. {openubmc_bingo-0.6.45.dist-info → openubmc_bingo-0.6.99.dist-info}/top_level.txt +0 -0
@@ -24,6 +24,10 @@ from bmcgo import misc
24
24
 
25
25
 
26
26
  class TaskClass(Task):
27
+ def __init__(self, config, work_name=""):
28
+ super(TaskClass, self).__init__(config, work_name=work_name)
29
+ self.suffix = "BMC"
30
+
27
31
  def copy_files(self):
28
32
  rootca = os.path.join(self.config.work_out, misc.ROOTCA_DER)
29
33
  crl = os.path.join(self.config.work_out, misc.CMS_CRL)
@@ -79,16 +83,17 @@ class TaskClass(Task):
79
83
  else:
80
84
  pmode_file = ""
81
85
 
86
+ self.write_gpp_bin(pmode_file)
82
87
 
88
+ def write_gpp_bin(self, pmode_file):
83
89
  self.info(f"打包: {self.config.board_name}_gpp.bin")
84
- cmd = f"ls -al hpm_top_header Hi1711_boot_4096.bin {pmode_file}"
85
- cmd += "hpm_sub_header rootca.der rootfs_BMC.img.cms cms.crl rootfs_BMC.tar.gz"
90
+ files = f"hpm_top_header Hi1711_boot_4096.bin {pmode_file}"
91
+ files += f"hpm_sub_header rootca.der rootfs_{self.suffix}.img.cms cms.crl rootfs_{self.suffix}.tar.gz"
92
+ cmd = f"ls -al {files}"
86
93
  self.run_command(cmd, show_log=True)
87
94
 
88
95
  target_path = f"{self.config.work_out}/{self.config.board_name}_gpp.bin"
89
- cmd = f"cat hpm_top_header Hi1711_boot_4096.bin {pmode_file}"
90
- cmd += "hpm_sub_header rootca.der rootfs_BMC.img.cms cms.crl rootfs_BMC.tar.gz"
91
- self.info("执行命令: " + cmd)
96
+ cmd = f"cat {files}"
92
97
  self.pipe_command([cmd], target_path)
93
98
 
94
99
  def run(self):
@@ -99,31 +104,37 @@ class TaskClass(Task):
99
104
  def move_dependency(self):
100
105
  # 移动到tools/build_tools目录中
101
106
  self.chdir(self.config.sdk_path)
107
+ if self.config.chip == "1711":
108
+ self.prepare_boot_1711()
109
+ else:
110
+ self.prepare_boot_1712()
111
+
112
+ def prepare_boot_1711(self):
102
113
  unsigned_boot = None
103
114
  for file in os.listdir("."):
104
115
  if re.match("^Hi1711_[0-9]{8}_[0-9a-f]{40}.tar.gz$", file) is None:
105
116
  continue
106
117
  unsigned_boot = file
107
118
  break
108
-
119
+
109
120
  if self.config.self_sign:
110
121
  if not unsigned_boot:
111
122
  raise errors.BmcGoException("打开了自签名模式但未找到待签名的uboot文件,构建失败")
112
- self.run_command(f"tar -xvf {file}")
123
+ self.run_command(f"tar -xvf {unsigned_boot}")
113
124
  # 解压uboot_debug未签名包
114
125
  os.makedirs("origin_uboot_debug")
115
126
  self.run_command(f"tar -xvf bin/original_bin/uboot_debug.tar.gz -C origin_uboot_debug")
116
- self.self_sign_uboot("origin_uboot_debug", ".", True)
127
+ self.self_sign_uboot_1711("origin_uboot_debug", ".", True)
117
128
  # 解压uboot未签名包
118
129
  os.makedirs("origin_uboot")
119
130
  self.run_command(f"tar -xvf bin/original_bin/uboot.tar.gz -C origin_uboot")
120
- self.self_sign_uboot("origin_uboot", ".", False)
121
- elif self.config.chip == "1711":
131
+ self.self_sign_uboot_1711("origin_uboot", ".", False)
132
+ else:
122
133
  self.run_command(f"dd if=Hi1711_boot_4096_pmode.bin of=Hi1711_boot_pmode.bin bs=1k count=1024 skip=768")
123
134
  self.run_command(f"dd if=Hi1711_boot_4096_pmode_debug.bin of=Hi1711_boot_pmode_debug.bin bs=1k " +
124
135
  "count=1024 skip=768")
125
136
 
126
- def self_sign_uboot(self, uboot_dir, output_dir, is_debug):
137
+ def self_sign_uboot_1711(self, uboot_dir, output_dir, is_debug):
127
138
  """签名uboot包"""
128
139
  cwd = os.getcwd()
129
140
  output_dir = os.path.realpath(output_dir)
@@ -137,9 +148,15 @@ class TaskClass(Task):
137
148
  self.signature("uboot.bin", "uboot.bin.cms", "cms.crl", "rootca.der")
138
149
  self.copy_gpp_headers_files()
139
150
  self.run_command("gpp_header uboot")
140
- self.run_command("make_uboot_img.sh 768")
141
- run_cmd = f"dd if=Hi1711_boot_4096.bin of={output_dir}/Hi1711_boot_pmode{debug_flag}.bin " \
151
+ self.run_command(f"make_uboot_img.sh {l0_kb_size}")
152
+ run_cmd = (
153
+ f"dd if=Hi1711_boot_4096.bin of={output_dir}/Hi1711_boot_pmode{debug_flag}.bin "
142
154
  f" bs=1K count=1024 skip={l0_kb_size}"
155
+ )
143
156
  self.run_command(run_cmd)
144
157
  self.run_command(f"cp Hi1711_boot_4096.bin {output_dir}/Hi1711_boot_4096{debug_flag}.bin")
145
158
  self.chdir(cwd)
159
+
160
+ def prepare_boot_1712(self):
161
+ # 打桩函数,不允许变更函数名,供扩展实现
162
+ pass
@@ -22,6 +22,8 @@ import os
22
22
  import stat
23
23
  import shutil
24
24
  import subprocess
25
+
26
+ from bmcgo import misc
25
27
  from bmcgo.tasks.task import Task
26
28
 
27
29
 
@@ -58,9 +60,9 @@ class TaskClass(Task):
58
60
  digest = self.get_manufacture_config("base/signature/hpm_digest", ["sha256"])
59
61
  with os.fdopen(os.open(filelist, os.O_WRONLY | os.O_CREAT | os.O_TRUNC,
60
62
  stat.S_IWUSR | stat.S_IRUSR), 'w') as f:
61
- f.write('Manifest Version: 1.0\n')
62
- f.write('Create By: openUBMC\n')
63
- f.write(f'Name: {hpm_file}\n')
63
+ f.write("Manifest Version: 1.0\n")
64
+ f.write(f"Create By: {misc.vendor()}\n")
65
+ f.write(f"Name: {hpm_file}\n")
64
66
  if "sha256" in digest:
65
67
  sha256sum = shutil.which("sha256sum")
66
68
  cmd = [sha256sum, hpm_file]
@@ -37,10 +37,10 @@ class DownloadDefaultBuildtools(Task):
37
37
  if self.config.partner_mode:
38
38
  self.info(f"从缓存目录{partner_tools_dir}复制编译器工具")
39
39
  self.run_command(f"cp -rf {partner_tools_dir}/. {self.rtos_sdk_dir}")
40
+ self.info("下载依赖工具结束")
40
41
 
41
- def install_buildtools(self):
42
+ def install_rtos(self):
42
43
  is_ubuntu = self.tools.is_ubuntu
43
- self.chdir(self.rtos_sdk_dir)
44
44
  self.info("删除目录 /opt/RTOS")
45
45
  self.run_command(f"rm -rf {BUILD_TOOLS_SHA256_PATH}", sudo=True)
46
46
  self.run_command("rm -rf /opt/RTOS", sudo=True)
@@ -54,36 +54,45 @@ class DownloadDefaultBuildtools(Task):
54
54
  else:
55
55
  self.pipe_command(["rpm2cpio {}".format(rpm), "sudo cpio -id -D /"])
56
56
 
57
+ def install_hcc(self):
57
58
  self.info("删除目录 /opt/hcc_arm64le")
58
59
  self.run_command("rm -rf /opt/hcc_arm64le", sudo=True)
59
60
  self.info("解压 hcc_arm64le")
60
61
  self.run_command("tar -xzf hcc_arm64le.tar.gz -C /opt", sudo=True)
61
62
 
63
+ def setup_path(self):
62
64
  logname = os.getenv(misc.ENV_LOGNAME, None)
63
65
  if logname and logname != "root":
64
66
  user_group = f"{os.getuid():{os.getgid()}}"
65
67
  self.run_command(f"chown {user_group} /opt/hcc_arm64le -R", sudo=True)
66
68
  self.run_command(f"chown {user_group} /opt/RTOS -R", sudo=True)
67
- self.chdir(self.config.code_path)
68
69
 
70
+ def copy_sysroot_sdk(self):
69
71
  libstdcpp_install_path = f"{self.config.sysroot}/usr/"
70
72
  os.makedirs(libstdcpp_install_path, exist_ok=True)
71
73
  self.run_command(f"cp -rf {self.config.cross_compile_install_path}/{self.config.cross_prefix}/lib64/" +
72
74
  f" {libstdcpp_install_path}")
75
+
76
+ def install_buildtools(self):
77
+ # 检查rtos是否安装,未安装或版本不匹配时安装
78
+ self.skip_install = not self.check_need_install(self.rtos_sdk_dir, BUILD_TOOLS_SHA256_PATH,
79
+ self.buildtools_new_sha256)
80
+ if self.skip_install:
81
+ self.info("buildtools版本匹配,跳过安装")
82
+ return
83
+ self.chdir(self.rtos_sdk_dir)
84
+ self.install_rtos()
85
+ self.install_hcc()
86
+ self.setup_path()
87
+ self.chdir(self.config.code_path)
88
+ self.copy_sysroot_sdk()
73
89
  self.run_command("cp -af {} {}".format(self.buildtools_new_sha256, BUILD_TOOLS_SHA256_PATH), sudo=True)
74
90
  self.run_command("chmod a+r {}".format(BUILD_TOOLS_SHA256_PATH), sudo=True)
75
91
 
76
92
  def run(self):
77
93
  self.download_tools()
78
- self.info("下载依赖工具结束")
79
94
 
80
95
  def install(self):
81
- self.skip_install = not self.check_need_install(self.rtos_sdk_dir, BUILD_TOOLS_SHA256_PATH,
82
- self.buildtools_new_sha256)
83
- if self.skip_install:
84
- self.info("buildtools版本匹配,跳过安装")
85
- return
86
- # 检查rtos是否安装,未安装或版本不匹配时安装
87
96
  self.install_buildtools()
88
97
 
89
98
 
@@ -96,4 +105,4 @@ class TaskClass(Task):
96
105
  self.download_buildtools.run()
97
106
 
98
107
  def install(self):
99
- self.download_buildtools.install()
108
+ self.download_buildtools.install()
@@ -16,7 +16,6 @@
16
16
  修改记录:2021-10-11 创建
17
17
  '''
18
18
  import os
19
- import re
20
19
  import shutil
21
20
 
22
21
  from bmcgo.tasks.task import Task
@@ -32,42 +31,52 @@ class TaskClass(Task):
32
31
  self.skip_install = False
33
32
 
34
33
  def download_dependency(self):
35
- self.info('开始下载依赖组件 ...')
34
+ self.info("开始下载sdk ...")
35
+ self.info(f"移除本地目录{self.sdk_dir}")
36
+ self.run_command(f"rm -rf {self.sdk_dir}", sudo=True)
36
37
  partner_sdk_dir = f"{os.path.expanduser('~')}/sdk"
37
38
  self.info(f"从缓存目录{partner_sdk_dir}复制sdk和rtos二进制文件")
38
39
  self.run_command(f"cp -rf {partner_sdk_dir}/. {self.sdk_dir}")
40
+ self.info("下载sdk结束")
39
41
 
40
- def move_dependency(self):
41
- # 移动到tools/build_tools目录中
42
+ def prepare_dependency(self):
43
+ # 移动到构建目录中
42
44
  if os.path.isdir(self.config.sdk_path):
43
45
  shutil.rmtree(self.config.sdk_path)
44
46
  self.run_command(f"cp -rf {self.sdk_dir} {self.config.sdk_path}")
45
- self.info("移动依赖组件结束")
46
- self.chdir(self.config.sdk_path)
47
- for file in os.listdir("."):
48
- if re.match("^Hi1711_[0-9]{8}_[0-9a-f]{40}.tar.gz$", file) is None:
49
- continue
50
- self.run_command(f"tar -xvf {file}")
51
- break
52
- if self.skip_install:
53
- self.info("sdk版本匹配")
54
- return
55
- old_sdk_dir = "/opt/hi1711sdk"
47
+ self.info("移动sdk结束")
48
+
49
+ def clear_path(self, old_sdk_path):
56
50
  self.run_command(f"rm -rf {SDK_SHA256_PATH}", sudo=True)
57
51
  self.run_command(f"rm -rf {SDK_PATH}", sudo=True)
58
- self.run_command(f"rm -rf {old_sdk_dir}", sudo=True)
52
+ self.run_command(f"rm -rf {old_sdk_path}", sudo=True)
53
+
54
+ def unzip_sdk(self):
55
+ self.info("开始解压sdk ...")
59
56
  self.run_command(f"mkdir -p {SDK_PATH}", ignore_error=True, sudo=True)
60
57
  self.run_command(f"tar -xzf hi1711sdk.tar.gz -C {SDK_PATH} {MODULE_SYMVERS}", sudo=True)
58
+
59
+ def setup_path(self, old_sdk_path):
61
60
  logname = os.getenv(misc.ENV_LOGNAME, None)
62
61
  if logname and logname != "root":
63
62
  user_group = f"{os.getuid():{os.getgid()}}"
64
63
  self.run_command(f"chown {user_group} {SDK_PATH} -R", sudo=True)
65
- self.run_command(f"ln -s {SDK_PATH} {old_sdk_dir}", sudo=True)
64
+ self.run_command(f"ln -s {SDK_PATH} {old_sdk_path}", sudo=True)
66
65
  self.run_command("cp -af {} {}".format(self.sdk_new_sha256, SDK_SHA256_PATH), sudo=True)
67
66
  self.run_command("chmod a+r {}".format(SDK_SHA256_PATH), sudo=True)
68
67
 
68
+ def install_dependency(self):
69
+ self.chdir(self.config.sdk_path)
70
+ self.skip_install = not self.check_need_install(self.sdk_dir, SDK_SHA256_PATH, self.sdk_new_sha256)
71
+ if self.skip_install:
72
+ self.info("sdk版本匹配,跳过安装")
73
+ return
74
+ old_sdk_dir = "/opt/hi1711sdk"
75
+ self.clear_path(old_sdk_dir)
76
+ self.unzip_sdk()
77
+ self.setup_path(old_sdk_dir)
78
+
69
79
  def run(self):
70
80
  self.download_dependency()
71
- self.info('下载依赖组件结束')
72
- self.skip_install = not self.check_need_install(self.sdk_dir, SDK_SHA256_PATH, self.sdk_new_sha256)
73
- self.move_dependency()
81
+ self.prepare_dependency()
82
+ self.install_dependency()
@@ -13,42 +13,11 @@ import os
13
13
  import subprocess
14
14
  import time
15
15
  from multiprocessing import Process
16
+
16
17
  from bmcgo.tasks.task import Task
17
18
  from bmcgo import errors
18
19
 
19
20
 
20
- class SignProcess(Process):
21
- def __init__(self, work: Task):
22
- super().__init__()
23
- self.work = work
24
- self.config = self.work.config
25
-
26
- def run(self):
27
- self.work.work_name = "sign_rootfs_image"
28
- self.work.chdir(self.config.build_path)
29
- if self.config.self_sign:
30
- self.work.signature(f"{self.config.work_out}/rootfs_BMC.img",
31
- f"{self.config.work_out}/rootfs_BMC.img.cms",
32
- f"{self.config.work_out}/cms.crl",
33
- f"{self.config.work_out}/rootca.der")
34
- else:
35
- out_file = f"{self.config.work_out}/rootfs_BMC.img.cms"
36
- self.work.tools.pipe_command([f"echo 'cms placeholder'"], out_file=out_file)
37
-
38
-
39
- class TarImageProcess(Process):
40
- def __init__(self, work):
41
- super().__init__()
42
- self.work: Task = work
43
- self.config = self.work.config
44
-
45
- def run(self):
46
- self.work.work_name = "tar_rootfs_image"
47
- self.work.chdir(self.config.work_out)
48
- self.work.run_command("tar --format=gnu --exclude BMC_rootfs.tar.gz -czf rootfs_BMC.tar.gz rootfs_BMC.img")
49
- self.work.success("tar BMC_rootfs.tar.gz successfully")
50
-
51
-
52
21
  class TaskClass(Task):
53
22
  skip_post_hpm = False
54
23
 
@@ -94,26 +63,36 @@ class TaskClass(Task):
94
63
  f"sed -i \"/^Version=/s/{curr_ver}/{ver}/g\" update.cfg")
95
64
  self.run_command("chmod +x . -R")
96
65
 
97
- def run(self):
98
- # 创建签名进程
99
- sign = SignProcess(self)
100
- sign.start()
66
+ def sign_img(self):
67
+ if self.config.self_sign:
68
+ self.self_sign()
69
+ else:
70
+ self.online_sign()
71
+
72
+ # 自签名函数,继承类可扩展,不能变更方法名,重要!!!
73
+ def self_sign(self):
74
+ self.signature(
75
+ f"{self.config.work_out}/rootfs_BMC.img",
76
+ f"{self.config.work_out}/rootfs_BMC.img.cms",
77
+ f"{self.config.work_out}/cms.crl",
78
+ f"{self.config.work_out}/rootca.der",
79
+ )
80
+
81
+ # 在线签名函数,继承类可扩展,不能变更方法名,重要!!!
82
+ def online_sign(self):
83
+ # bingo无需在线签名逻辑,仅占位满足后续流程即可
84
+ out_file = f"{self.config.work_out}/rootfs_BMC.img.cms"
85
+ self.pipe_command([f"echo 'cms placeholder'"], out_file=out_file)
86
+
87
+ def tar_img(self):
88
+ self.run_command("tar --format=gnu --exclude BMC_rootfs.tar.gz -czf rootfs_BMC.tar.gz rootfs_BMC.img")
89
+ self.success("tar BMC_rootfs.tar.gz successfully")
101
90
 
91
+ def run(self):
92
+ # 签名
93
+ self.chdir(self.config.build_path)
94
+ self.sign_img()
102
95
  self.prepare_hpm()
103
-
104
- # 创建压缩进程
105
- tar = TarImageProcess(self)
106
- tar.start()
107
- while True:
108
- if not sign.is_alive():
109
- if sign.exitcode is not None and sign.exitcode != 0:
110
- raise errors.BmcGoException(f"签名进程发生错误, 返回值: {sign.exitcode}")
111
- break
112
- time.sleep(0.1)
113
- while True:
114
- if not tar.is_alive():
115
- if tar.exitcode is not None and tar.exitcode != 0:
116
- raise errors.BmcGoException(f"打包进程发生错误, 返回值: {tar.exitcode}")
117
- break
118
- time.sleep(0.1)
119
-
96
+ # 压缩
97
+ self.chdir(self.config.work_out)
98
+ self.tar_img()
@@ -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)
@@ -142,7 +142,7 @@ class TaskClass(Task):
142
142
 
143
143
  self.log.debug(f"copy {tmp}/hpm_tools/. -> {home_path}")
144
144
  self.run_command(f"chmod -R +x {tmp}/hpm_tools")
145
- self.run_command(f"cp -rf {tmp}/hpm_tools/. /usr/local/bin/", sudo=True)
145
+ self.run_command(f"cp -rf {tmp}/hpm_tools/. /usr/bin/", sudo=True)
146
146
 
147
147
  self.log.info(f"安装 bmc_sdk 完成!")
148
148
 
@@ -18,14 +18,9 @@ class TaskClass(Task):
18
18
  def sign_hpms(self):
19
19
  self.chdir(self.config.work_out)
20
20
  if self.config.self_sign:
21
- self.chdir(self.config.work_out)
22
- # 复制预置的ca, crl作为签名文件,并复制cms
23
- self.signature(f"rootfs_{self.config.board_name}.filelist",
24
- f"rootfs_{self.config.board_name}.filelist.cms",
25
- "cms.crl", "rootca.der")
21
+ self._self_sign()
26
22
  else:
27
- self.run_command(f"touch {self.config.work_out}/rootfs_{self.config.board_name}.filelist.cms")
28
- self.run_command(f"cp {self.config.board_path}/cms.crl {self.config.work_out}/cms.crl")
23
+ self._online_sign()
29
24
  self.chdir(self.config.work_out)
30
25
 
31
26
  # 生成的文件为rootfs_{board_name}.hpm.signed
@@ -40,3 +35,16 @@ class TaskClass(Task):
40
35
 
41
36
  def run(self):
42
37
  self.sign_hpms()
38
+
39
+ def _self_sign(self):
40
+ # 复制预置的ca, crl作为签名文件,并复制cms
41
+ self.signature(f"rootfs_{self.config.board_name}.filelist",
42
+ f"rootfs_{self.config.board_name}.filelist.cms",
43
+ "cms.crl", "rootca.der")
44
+
45
+ # 在线签名逻辑,生成对应的crl和cms文件
46
+ # 此函数供继承类重写,不允许更改函数名,重要!!!
47
+ def _online_sign(self):
48
+ # bingo不实现在线签名逻辑,这里创建空文件满足后续流程
49
+ self.run_command(f"touch {self.config.work_out}/rootfs_{self.config.board_name}.filelist.cms")
50
+ self.run_command(f"cp {self.config.board_path}/cms.crl {self.config.work_out}/cms.crl")
@@ -94,7 +94,7 @@ class ComponentVersionCheck:
94
94
  def get_dict(self):
95
95
  self.openubmc_folder()
96
96
  self.manifest_dict = self.generate_manifest_dict()
97
- self.ibmc_lock_dict = self.generate_ibmc_lock_dict()
97
+ self.ibmc_lock_dict = self.generate_bmc_lock_dict()
98
98
 
99
99
  def generate_manifest_dict(self) -> dict:
100
100
  """根据 manifest.yml(conan目录) 配置生成 组件名: 组件配置 的字典
@@ -106,8 +106,8 @@ class ComponentVersionCheck:
106
106
  manifest_dict = {x[misc.CONAN].split('/')[0]: x[misc.CONAN].split('@')[0] for x in dependency_list}
107
107
  return manifest_dict
108
108
 
109
- def generate_ibmc_lock_dict(self) -> dict:
110
- """根据 ibmc.lock 配置生成 组件名: 组件配置 的字典
109
+ def generate_bmc_lock_dict(self) -> dict:
110
+ """根据 bmc.lock 配置生成 组件名: 组件配置 的字典
111
111
 
112
112
  Returns:
113
113
  dict: 返回 组件名: 组件配置 的字典
@@ -116,7 +116,7 @@ class ComponentVersionCheck:
116
116
  component_list = self.ibmc_lock["graph_lock"]["nodes"]
117
117
  ibmc_lock_dict = {x["ref"].split('/')[0]: x["ref"].split('@')[0]
118
118
  for x in [component_conf for _, component_conf in component_list.items()]}
119
- ibmc_lock_dict.pop("openubmc")
119
+ ibmc_lock_dict.pop(misc.community_name())
120
120
  else:
121
121
  component_list = self.ibmc_lock["requires"]
122
122
  ibmc_lock_dict = {x.split('/')[0]: x.split('@')[0] for x in component_list}
bmcgo/utils/config.py CHANGED
@@ -489,6 +489,7 @@ class Config:
489
489
  os.environ['PATH'] = os.environ["PATH"] + ":" + os.path.join(self.tools_path, "build_tools")
490
490
  # CI工程上库路径
491
491
  self.output_path = os.path.join(self.code_root, 'output')
492
+ self.mdb_output = os.path.join(self.output_path, "mdb")
492
493
 
493
494
  def init_conan_profile(self, profile: str):
494
495
  manifest_profile = self.get_manufacture_config("base/profile")
@@ -762,6 +763,8 @@ class Config:
762
763
 
763
764
  def merge_dependencies(self, dependencies, subsys_comps, base_deps):
764
765
  for com_package in dependencies:
766
+ if "overwrite" in com_package:
767
+ del com_package["overwrite"]
765
768
  com_package_split = com_package.get(misc.CONAN).split("/")
766
769
  if len(com_package_split) > 2:
767
770
  continue