openubmc-bingo 0.6.25__py3-none-any.whl → 0.6.28__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.25'
12
+ __version__ = '0.6.28'
@@ -25,6 +25,7 @@ import time
25
25
  import subprocess
26
26
  import random
27
27
  import pathlib
28
+ from tempfile import NamedTemporaryFile
28
29
  from multiprocessing import Process, Queue
29
30
  from copy import deepcopy
30
31
  from collections import Counter
@@ -699,6 +700,34 @@ class TaskClass(Task):
699
700
  options += " -o */*:gcov=True"
700
701
  return options
701
702
 
703
+ def clean_folder_not_exist_packages(self):
704
+ """
705
+ 检查缓存的所有包路径是否存在,不存在的删除对应的包
706
+ 缓解"folder must exist"错误
707
+ """
708
+ tmp = NamedTemporaryFile(suffix=".json")
709
+ cmd = f"conan list -f json '*/*@*/*#*:*' --out-file={tmp.name}"
710
+ self.run_command(cmd)
711
+ with open(tmp.name, "r") as fd:
712
+ cache = json.load(fd)
713
+ for name, recipe in cache.get("Local Cache", {}).items():
714
+ for rrid, revision in recipe.get("revisions", {}).items():
715
+ for pid, _ in revision.get("packages", {}).items():
716
+ cmd = f"conan cache path {name}#{rrid}:{pid}"
717
+ result = self.run_command(cmd, capture_output=True, ignore_error=True)
718
+ ret_code = result.returncode
719
+ path = result.stdout.strip()
720
+ if ret_code != 0 or not os.path.isdir(path):
721
+ cmd = f"conan remove {name}#{rrid}:{pid} -c"
722
+ self.run_command(cmd)
723
+ cmd = f"conan cache path {name}#{rrid}"
724
+ result = self.run_command(cmd, capture_output=True, ignore_error=True)
725
+ ret_code = result.returncode
726
+ path = result.stdout.strip()
727
+ if ret_code != 0 or not os.path.isdir(path):
728
+ cmd = f"conan remove {name}#{rrid} -c"
729
+ self.run_command(cmd)
730
+
702
731
  def install_openubmc_v2(self):
703
732
  profile_file = os.path.join(self.tools.conan_profiles_dir, self.config.profile)
704
733
  if not os.path.isfile(profile_file):
@@ -716,12 +745,17 @@ class TaskClass(Task):
716
745
  self.success(f"start build dependency packages of {self.config.board_name}")
717
746
  if self.skip_install_comp:
718
747
  return
719
- bcp = BuildConans(self.graphfile, self.lockfile, base_cmd, self.config.from_source, self.config.log_path)
720
- bcp.build()
721
-
748
+ if self.config.from_source:
749
+ """
750
+ 多进程并行构建组件
751
+ conan原生不支持多组件并行构建,BuildConans会尝试构建所有组件但忽略构建失败
752
+ """
753
+ bcp = BuildConans(self.graphfile, self.lockfile, base_cmd, self.config.from_source, self.config.log_path)
754
+ bcp.build()
755
+ self.clean_folder_not_exist_packages()
722
756
  cmd = f"conan create . {base_cmd} --build=missing"
723
757
  self.info(f"start build {self.config.board_name}: {cmd}")
724
- self.run_command(cmd, capture_output=False)
758
+ self.run_command(cmd)
725
759
 
726
760
  # 检查使用到的组件是否都在单板目录 manifest.yml 中配置了
727
761
  self.component_check.run()
@@ -839,6 +873,8 @@ class TaskClass(Task):
839
873
  os.makedirs(inner_path, exist_ok=True)
840
874
  self.run_command(f'cp -f {self.lockfile} {os.path.join(inner_path, f"package_{self.config.board_name}.lock")}')
841
875
  self.run_command(f'cp -f {self.lockfile} {os.path.join(self.config.output_path, f"package.lock")}')
876
+ if misc.conan_v2():
877
+ self.run_command(f'cp -f {self.graphfile} {os.path.join(self.config.output_path, f"graph.info")}')
842
878
 
843
879
  def copy_components(self, comps: list, profile):
844
880
  # 优先处理rootfs
@@ -990,9 +1026,7 @@ class TaskClass(Task):
990
1026
  for name, node in self.graph_nodes.items():
991
1027
  if node.package_folder.startswith(self.conan_install):
992
1028
  continue
993
- cust = os.path.join(node.package_folder, "include", "customization.py")
994
- if not os.path.isfile(cust):
995
- continue
1029
+
996
1030
  comp_dir = os.path.join(self.conan_install, name)
997
1031
  shutil.copytree(node.package_folder, comp_dir)
998
1032
 
@@ -1090,8 +1124,8 @@ class TaskClass(Task):
1090
1124
  self.run_command(cmd)
1091
1125
  cmd = f"cp temp/.deploy/luajit/usr/lib64/liblua.so {conan_bin}"
1092
1126
  self.run_command(cmd)
1093
- if os.path.isfile("temp/.deploy/luajit/usr/bin/jit"):
1094
- cmd = f"cp -r temp/.deploy/luajit/usr/bin/jit {conan_bin}"
1127
+ if os.path.isdir("temp/.deploy/luajit/usr/bin/jit"):
1128
+ cmd = f"cp -rf temp/.deploy/luajit/usr/bin/jit {conan_bin}"
1095
1129
  self.run_command(cmd)
1096
1130
  self.link(luac, luac_back)
1097
1131
  # 仅在覆盖率使能场景下,对luac进行打桩
@@ -37,8 +37,6 @@ class GraphNode():
37
37
  self.pkg = self.ref.split("#")[0] + "-" + self.context
38
38
  self.is_host = self.context == "host"
39
39
  self.building = False
40
- binary = node.get("binary")
41
- self.binary_exist = (binary in ["Cache"])
42
40
  self.builded = False
43
41
 
44
42
  @property
@@ -79,7 +77,6 @@ class BuildConans(object):
79
77
  skip = True
80
78
  continue
81
79
  self.cmd += f"{arg} "
82
- self.exception = None
83
80
  self.force_build = force_build
84
81
  self.log_dir = log_dir
85
82
  if not os.path.isdir(log_dir):
@@ -93,45 +90,35 @@ class BuildConans(object):
93
90
  cmd += f" --build=missing -f json --lockfile={self.lockfile}"
94
91
  if self.force_build:
95
92
  cmd += f" --build=\"{node.name}/*\""
96
- try:
97
- # 最多重试5次
98
- for i in range(1, 5):
99
- logfile = f"{self.log_dir}/conan_build_{node.name}.log"
100
- log.debug(f">>>> {cmd}")
101
- log.info(f">>>> build {node.ref} start, logfile: {logfile}")
102
- with os.fdopen(os.open(logfile, os.O_RDWR | os.O_CREAT, stat.S_IWUSR | stat.S_IRUSR), "a+") as f:
103
- real_cmd = shlex.split(cmd)
104
- pipe = subprocess.Popen(real_cmd, stdout=f, stderr=f)
105
- start_time = time.time()
106
- while True:
107
- if pipe.poll() is not None:
108
- break
109
- # 1800秒超时
110
- if time.time() - start_time > 1800:
111
- pipe.kill()
112
- raise errors.BmcGoException(f"================== {node.name} 构建超时 ==================")
113
- time.sleep(1)
114
- if pipe.returncode != 0:
115
- # 首次增量构建失败时切换到源码构建模式
116
- if i == 1 and not self.force_build:
117
- cmd += f" --build=\"{node.name}/*\""
118
- continue
119
-
120
- f.seek(0)
121
- conan_log = f.read()
122
- # conan的缓存数据库不支持并发访问,会概率性存在数据库锁错误,当前通过重试解决
123
- if "sqlite3.OperationalError: database is locked" in conan_log:
124
- log.info("rebuild because database is locked")
125
- continue
126
- log.error(f"================== {node.name} 构建失败日志起始位置 ==================")
127
- log.error(conan_log)
128
- log.error(f"================== {node.name} 构建失败日志结束位置 ==================")
129
- raise errors.BmcGoException(f"================== {node.name} 构建失败 ==================")
130
- else:
131
- break
132
- log.success(f"<<<< build {node.ref} finished")
133
- except Exception as e:
134
- self.exception = e
93
+ logfile = f"{self.log_dir}/conan_build_{node.name}.log"
94
+ logfd = os.fdopen(os.open(logfile, os.O_RDWR | os.O_CREAT, stat.S_IWUSR | stat.S_IRUSR), "a+")
95
+ # 最多重试3次
96
+ max_cnt = 3
97
+ for i in range(0, max_cnt):
98
+ log.debug(f">>>> {cmd}")
99
+ log.info(f">>>> build {node.ref} start, logfile: {logfile}")
100
+ real_cmd = shlex.split(cmd)
101
+ pipe = subprocess.Popen(real_cmd, stdout=logfd, stderr=logfd)
102
+ start_time = time.time()
103
+ while True:
104
+ if pipe.poll() is not None:
105
+ break
106
+ # 1800秒超时
107
+ if time.time() - start_time > 1800:
108
+ pipe.kill()
109
+ log.info(f"================== {node.name} 构建超时 ==================")
110
+ self.queue.put(node)
111
+ return
112
+ time.sleep(1)
113
+ if pipe.returncode != 0:
114
+ log.info(f"<<<< build {node.ref} not ok")
115
+ # 首次增量构建失败时切换到源码构建模式
116
+ if i == 0 and not self.force_build:
117
+ cmd += f" --build=\"{node.name}/*\""
118
+ continue
119
+ else:
120
+ break
121
+ log.success(f"<<<< build {node.ref} finished")
135
122
  self.queue.put(node)
136
123
 
137
124
  def build(self):
@@ -213,28 +200,25 @@ class BuildConans(object):
213
200
  continue
214
201
  if dep.builded:
215
202
  continue
216
- if not dep.binary_exist or self.force_build:
217
- # 当依赖的构建工具存在正在构建的组件时不能构建
218
- skip_build = False
219
- for _, build_dep in dep.build_packages.items():
220
- # 正在构建且未构建出制品时
221
- if build_dep.building and not build_dep.builded:
222
- skip_build = True
223
- break
224
- if skip_build:
225
- continue
226
- # 启动构建前将其依赖的构建工具置为正在构建
227
- for _, build_dep in dep.build_packages.items():
228
- build_dep.building = True
229
- tasks_cnt += 1
230
- thread = Thread(target=self.build_task, args=(dep, options,))
231
- thread.start()
203
+ # 当依赖的构建工具存在正在构建的组件时不能构建
204
+ skip_build = False
205
+ for _, build_dep in dep.build_packages.items():
206
+ # 正在构建且未构建出制品时
207
+ if build_dep.building and not build_dep.builded:
208
+ skip_build = True
209
+ break
210
+ if skip_build:
211
+ continue
212
+ # 启动构建前将其依赖的构建工具置为正在构建
213
+ for _, build_dep in dep.build_packages.items():
214
+ build_dep.building = True
215
+ tasks_cnt += 1
216
+ thread = Thread(target=self.build_task, args=(dep, options,))
217
+ thread.start()
232
218
  build_tasks[dep.name] = True
233
219
  if not tasks_cnt:
234
220
  return
235
221
  dep = self.queue.get()
236
- if not dep or self.exception:
237
- raise self.exception
238
222
  dep.builded = True
239
223
  build_tasks[dep.name] = False
240
224
  tasks_cnt -= 1
bmcgo/utils/tools.py CHANGED
@@ -77,6 +77,7 @@ class Tools():
77
77
  file_handle = os.fdopen(os.open(self.lock_file, os.O_WRONLY | os.O_CREAT,
78
78
  stat.S_IWUSR | stat.S_IRUSR), 'a')
79
79
  file_handle.close()
80
+ self.last_succ_remote = ""
80
81
 
81
82
  @property
82
83
  def user_home(self):
@@ -488,19 +489,20 @@ class Tools():
488
489
  return conan_remote_list
489
490
 
490
491
  def download_conan_recipes(self, conan_version, conan_remote_list):
491
- download_flag = False
492
492
  args = "--only-recipe" if misc.conan_v2() else "--recipe"
493
- for remote in conan_remote_list:
493
+ remote_list = conan_remote_list
494
+ if self.last_succ_remote:
495
+ remote_list.insert(0, self.last_succ_remote)
496
+ for remote in remote_list:
494
497
  # 重试3次
495
498
  for _ in range(1, 3):
496
499
  try:
497
500
  self.run_command(f"conan download {conan_version} -r {remote} {args}", show_error_log=False)
498
- download_flag = True
499
- break
501
+ self.last_succ_remote = remote
502
+ return
500
503
  except Exception as e:
501
504
  self.log.info(f"Recipe not fount in {remote}: {conan_version}")
502
- if not download_flag:
503
- raise BmcGoException(f"Download {conan_version} failed")
505
+ raise BmcGoException(f"Download {conan_version} failed")
504
506
 
505
507
  def yaml_load_template(self, yaml_name: str, template: dict, need_validate=True):
506
508
  with open(yaml_name, "r", encoding="utf-8") as fp:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: openubmc-bingo
3
- Version: 0.6.25
3
+ Version: 0.6.28
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=UIcAX3HFWIv4SVR6dvGzKjsZ-Hcy6x6_GwpA6css2D4,562
1
+ bmcgo/__init__.py,sha256=Bl--4YJlK5Qc6SygOJsgAH2VC3x0DEF59ZLKHXVlTXc,562
2
2
  bmcgo/bmcgo.py,sha256=uD4TsfjrFB5aQPIS6WRUVc9ShXX-dSImY9ezkB13g1w,685
3
3
  bmcgo/bmcgo_config.py,sha256=-HZcTsnccE5wUsgGJ59kq8sDdu8feftIbpyoFvyvBhU,11264
4
4
  bmcgo/errors.py,sha256=QW1ndrJcJ2Ws7riOznPKVvZsNlrYk73eZol7w8gJTPU,3076
@@ -224,7 +224,7 @@ bmcgo/tasks/__init__.py,sha256=VapgzhPMmB7dzPIRohoVm1jjfVn_v97cYNCRmkxScaU,539
224
224
  bmcgo/tasks/download_buildtools_hm.py,sha256=f4UxStARc8Z8DnT_5O6ONajQ7P0sKyJ8brixr43fHVQ,5988
225
225
  bmcgo/tasks/misc.py,sha256=GK_bSDLGZW0FxywB2ICG1iIEz2y2QoCb1YQQk8SYOIA,711
226
226
  bmcgo/tasks/task.py,sha256=w8tdU5NwoUfVF4xKFvSzcCWCf0FGTBHJAToNLlP0p4w,18424
227
- bmcgo/tasks/task_build_conan.py,sha256=cpGFUgwzp2WmrZr9ISFdPUDO5kPuEWqJWTFFdL_1MLk,51173
227
+ bmcgo/tasks/task_build_conan.py,sha256=T16Jq77KVxxaHVzzTMj3TeFDFPXM7rlvW5f04BQdSiE,52919
228
228
  bmcgo/tasks/task_build_rootfs_img.py,sha256=JKEvldJnLWu2IdVSntuVowocQwdVtBQUpxzhplYauPI,29209
229
229
  bmcgo/tasks/task_build_wbd_up.py,sha256=X9-0Qqad-s3mGfJBMeBQvfZ99KlWcgaMluDr_zv6Z-o,3122
230
230
  bmcgo/tasks/task_buildgppbin.py,sha256=epBxxrYFPgoTzpBgPzSRXcUs-ia_BJWsLGflylEJS7I,6614
@@ -241,7 +241,7 @@ bmcgo/tasks/conan/conanfile.py,sha256=MI6c2QNKixrkA5Tx4i9EKw7bZ20GVDIKgkaMwNHQKc
241
241
  bmcgo/utils/__init__.py,sha256=BDXz8BcSlCkfo5UYt6j2rm89-HiYA1ZzfpFhy99MH-0,538
242
242
  bmcgo/utils/basic_enums.py,sha256=L5VtHtzSvs6duAnphgqDGXX80Wit3Y7DjMlpi9MCxyI,1348
243
243
  bmcgo/utils/buffer.py,sha256=t1SkWntWksboNFMPsltslwRdXZi3FAe8eV0JAAE7Vto,4004
244
- bmcgo/utils/build_conans.py,sha256=3uGn9MWlW3d8WNKZQPs4rEd6E6KxP_eyqSxSlSQQG4o,10172
244
+ bmcgo/utils/build_conans.py,sha256=27aPzS7Q6e6xNlK9pkGgqJBe_pIs8YJHJXxqbaPoCN8,8920
245
245
  bmcgo/utils/combine_json_schemas.py,sha256=08JrAlLeo_JgUqzYcZNgSwJZPLfjbWVJ4esPPt9bPMY,7967
246
246
  bmcgo/utils/component_post.py,sha256=rTSMv36geI6rbm6ZFQenZfG0mn1nVPpdJqn7g8bYtKA,2330
247
247
  bmcgo/utils/component_version_check.py,sha256=nKfav7EnJ_JWfCvH_SiyhhIapGXUzhFs1QvLb58MPBs,6266
@@ -252,7 +252,7 @@ bmcgo/utils/json_validator.py,sha256=_k5wU78wfYGrzvSDaqOEtT4otgKUjquVhZNpVf2PW_c
252
252
  bmcgo/utils/mapping_config_patch.py,sha256=_gKfZnrvsLPgHn1yXhEJRVTAeuGpeGD9T-Pqyw5Ydys,16827
253
253
  bmcgo/utils/merge_csr.py,sha256=JNxHCfW1au84WQshdz0aQy8wMTEOHonjQT3s6LjlZN4,4580
254
254
  bmcgo/utils/perf_analysis.py,sha256=fh6lV9AAKVhpPkGPwAJ8EWfGfUoHjqGYQxrvc32Xiac,4767
255
- bmcgo/utils/tools.py,sha256=NrYd4bNzRiBGu7FklN6PT1gj-sdqUWB_lj11Q7TjI8Y,32480
255
+ bmcgo/utils/tools.py,sha256=dB7lX0jv-mE6pBalzm-VUZEnxPSbYkgC9soD_FAAnFg,32587
256
256
  bmcgo/utils/installations/README.md,sha256=hKXnFYmeHEuROFMFE-vzlGLSHg71bei5ZYwyYZphWNk,2
257
257
  bmcgo/utils/installations/__init__.py,sha256=BDXz8BcSlCkfo5UYt6j2rm89-HiYA1ZzfpFhy99MH-0,538
258
258
  bmcgo/utils/installations/base_installer.py,sha256=3UZiKWoa41ygRbLD3QsE2FTp-VFp79V0I53QLRIf4E8,5902
@@ -264,8 +264,8 @@ bmcgo/utils/installations/install_plans/qemu.yml,sha256=lT7aKag60QUH6hTGFKa3hGRq
264
264
  bmcgo/utils/installations/install_plans/studio.yml,sha256=APR3GM-3Q11LFfe8vh7t3LztDn4LLEpNHRUNjkaVekA,143
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.25.dist-info/METADATA,sha256=9npzn3E3oo6oiNlQGepfcjj0msWe2jDEmSlhBefEm5E,1010
268
- openubmc_bingo-0.6.25.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
269
- openubmc_bingo-0.6.25.dist-info/entry_points.txt,sha256=UUoUP-vAWTgg9vEYbRwYqOBHgpRtkngdzMPb-ocz90g,42
270
- openubmc_bingo-0.6.25.dist-info/top_level.txt,sha256=9AcvCAt1nZcOgMsGt6T07mg2Bgtdet-3mHTwg91axgI,6
271
- openubmc_bingo-0.6.25.dist-info/RECORD,,
267
+ openubmc_bingo-0.6.28.dist-info/METADATA,sha256=6BRrodkfgYypyYp9oglx1y6RHH78P2oX2TbdUXagHwk,1010
268
+ openubmc_bingo-0.6.28.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
269
+ openubmc_bingo-0.6.28.dist-info/entry_points.txt,sha256=UUoUP-vAWTgg9vEYbRwYqOBHgpRtkngdzMPb-ocz90g,42
270
+ openubmc_bingo-0.6.28.dist-info/top_level.txt,sha256=9AcvCAt1nZcOgMsGt6T07mg2Bgtdet-3mHTwg91axgI,6
271
+ openubmc_bingo-0.6.28.dist-info/RECORD,,