openubmc-bingo 0.6.73__py3-none-any.whl → 0.6.74__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 +1 -1
- bmcgo/utils/fetch_component_code.py +67 -24
- {openubmc_bingo-0.6.73.dist-info → openubmc_bingo-0.6.74.dist-info}/METADATA +1 -1
- {openubmc_bingo-0.6.73.dist-info → openubmc_bingo-0.6.74.dist-info}/RECORD +7 -7
- {openubmc_bingo-0.6.73.dist-info → openubmc_bingo-0.6.74.dist-info}/WHEEL +0 -0
- {openubmc_bingo-0.6.73.dist-info → openubmc_bingo-0.6.74.dist-info}/entry_points.txt +0 -0
- {openubmc_bingo-0.6.73.dist-info → openubmc_bingo-0.6.74.dist-info}/top_level.txt +0 -0
bmcgo/__init__.py
CHANGED
|
@@ -15,7 +15,7 @@ import os
|
|
|
15
15
|
import re
|
|
16
16
|
import shutil
|
|
17
17
|
import subprocess
|
|
18
|
-
from multiprocessing import Pool
|
|
18
|
+
from multiprocessing import Pool, Manager # <-- 导入 Manager
|
|
19
19
|
import patch_ng
|
|
20
20
|
import yaml
|
|
21
21
|
from git import Repo, exc
|
|
@@ -48,6 +48,10 @@ class FetchComponentCode:
|
|
|
48
48
|
f" -r {misc.conan_remote()} --only None 2>/dev/null"
|
|
49
49
|
if misc.conan_v2():
|
|
50
50
|
cmd = f"conan graph info --requires='{version_range}' --filter {component_name}"
|
|
51
|
+
|
|
52
|
+
# !! 注意:resolve_version_range 也需要加锁,因为它会访问 conan 缓存
|
|
53
|
+
# 但由于它在 run() 的主进程中串行调用,所以暂时安全。
|
|
54
|
+
# 如果未来您也想并发化这一步,也必须加锁。
|
|
51
55
|
ret, output = subprocess.getstatusoutput(cmd)
|
|
52
56
|
output = output.strip()
|
|
53
57
|
if ret != 0 or not output:
|
|
@@ -202,14 +206,19 @@ class FetchComponentCode:
|
|
|
202
206
|
|
|
203
207
|
process_count = min(len(packages_to_fetch), os.cpu_count())
|
|
204
208
|
log.info("创建 %u 个进程拉取代码", process_count)
|
|
209
|
+
|
|
210
|
+
# --- 修改:创建并传递锁 ---
|
|
211
|
+
manager = Manager()
|
|
212
|
+
conan_lock = manager.Lock()
|
|
205
213
|
pool = Pool(processes=process_count)
|
|
206
214
|
for component_name, conan_version in packages_to_fetch.items():
|
|
207
|
-
pool.apply_async(func=self.update_component_code,
|
|
215
|
+
pool.apply_async(func=self.update_component_code,
|
|
216
|
+
args=(component_name, conan_version, conan_lock), # <-- 传递锁
|
|
208
217
|
error_callback=process_err_cb)
|
|
209
218
|
pool.close()
|
|
210
219
|
pool.join()
|
|
211
220
|
|
|
212
|
-
def update_component_code(self, component_name, conan_version):
|
|
221
|
+
def update_component_code(self, component_name, conan_version, conan_lock): # <-- 接收锁
|
|
213
222
|
"""
|
|
214
223
|
update component code by conan version
|
|
215
224
|
"""
|
|
@@ -220,9 +229,12 @@ class FetchComponentCode:
|
|
|
220
229
|
version_split = re.split(r'[/, @]', conan_version)
|
|
221
230
|
conan_dir = os.path.join(os.path.expanduser('~'), '.conan/data/', *version_split, 'export')
|
|
222
231
|
conandata = os.path.join(conan_dir, 'conandata.yml')
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
232
|
+
|
|
233
|
+
with conan_lock: # <-- 在 conan 操作上加锁
|
|
234
|
+
if not os.path.exists(conan_dir):
|
|
235
|
+
conan_remote_list = tools.get_conan_remote_list(self.remote)
|
|
236
|
+
tools.download_conan_recipes(conan_version, conan_remote_list)
|
|
237
|
+
|
|
226
238
|
if os.path.exists(conandata):
|
|
227
239
|
self.__update_component_code_by_conandata(version_split[0], version_split[1], conandata)
|
|
228
240
|
return
|
|
@@ -234,10 +246,12 @@ class FetchComponentCode:
|
|
|
234
246
|
return
|
|
235
247
|
log.error("conandata(%s) 和 conanfile(%s) 都没有找到", conandata, conanfile)
|
|
236
248
|
else:
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
249
|
+
path_cmd_info = None
|
|
250
|
+
with conan_lock: # <-- 在 conan 操作上加锁
|
|
251
|
+
conan_remote_list = tools.get_conan_remote_list(self.remote)
|
|
252
|
+
tools.download_conan_recipes(conan_version, conan_remote_list)
|
|
253
|
+
path_cmd = f"conan cache path {conan_version}"
|
|
254
|
+
path_cmd_info = Tools().run_command(path_cmd, capture_output=True)
|
|
241
255
|
|
|
242
256
|
version_split = re.split(r'[/, @]', conan_version)
|
|
243
257
|
conan_dir = path_cmd_info.stdout.strip()
|
|
@@ -249,21 +263,50 @@ class FetchComponentCode:
|
|
|
249
263
|
log.error("conandata(%s) 没有找到", conandata)
|
|
250
264
|
log.info("更新组件 %s 代码到 %s 失败, 无法获取到 conan 信息", component_name,
|
|
251
265
|
conan_version)
|
|
252
|
-
except exc.
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
266
|
+
except exc.GitError as exp:
|
|
267
|
+
log.warning("Git 操作失败 (组件: %s): %s。 尝试MDS修补...", component_name, exp)
|
|
268
|
+
command_result = None
|
|
269
|
+
stdout = ""
|
|
270
|
+
stderr = ""
|
|
271
|
+
|
|
272
|
+
with conan_lock: # <-- 在 conan install 上加锁
|
|
273
|
+
cmd = f"conan install --requires={conan_version} -r openubmc_dev\
|
|
274
|
+
--build=missing -pr profile.ini --format=json --output-folder=tmp"
|
|
275
|
+
command_result = Tools().run_command(cmd, capture_output=True, ignore_error=True)
|
|
276
|
+
stdout = command_result.stdout.strip()
|
|
277
|
+
stderr = command_result.stderr.strip()
|
|
278
|
+
|
|
279
|
+
# --- 健壮的错误检查 ---
|
|
280
|
+
if command_result.returncode != 0 or not stdout:
|
|
281
|
+
log.error("MDS修补失败: 'conan install' 命令执行错误 (组件: %s)。", component_name)
|
|
282
|
+
log.error("Conan STDOUT: %s", stdout)
|
|
283
|
+
log.error("Conan STDERR: %s", stderr)
|
|
284
|
+
raise exp # 重新抛出原始的GitError,因为后备方案失败了
|
|
285
|
+
|
|
286
|
+
try:
|
|
287
|
+
result = json.loads(stdout)
|
|
288
|
+
except json.JSONDecodeError as json_err:
|
|
289
|
+
log.error("MDS修补失败: 'conan install' 未返回有效的JSON (组件: %s)。", component_name)
|
|
290
|
+
log.error("Conan STDOUT: %s", stdout)
|
|
291
|
+
log.error("JSON 错误: %s", json_err)
|
|
292
|
+
raise RuntimeError(f"MDS修补失败: JSON解析错误 (组件: {component_name})") from json_err
|
|
293
|
+
|
|
294
|
+
nodes = result.get("graph", {}).get("nodes", {})
|
|
295
|
+
# --- 检查结束 ---
|
|
296
|
+
|
|
258
297
|
for node in nodes.values():
|
|
259
|
-
if node.get("ref").startswith(conan_version):
|
|
298
|
+
if node.get("ref") and node.get("ref").startswith(conan_version):
|
|
260
299
|
package_folder = node.get("package_folder")
|
|
261
|
-
if
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
300
|
+
if package_folder:
|
|
301
|
+
if os.path.exists(f"{package_folder}/include/mds"):
|
|
302
|
+
src = f"{package_folder}/include/mds"
|
|
303
|
+
dest = os.path.abspath(f"{component_name}/mds")
|
|
304
|
+
shutil.copytree(src, dest, dirs_exist_ok=True)
|
|
305
|
+
log.info("将组件 %s 复制到 %s.", component_name, f"{component_name}/mds")
|
|
306
|
+
else:
|
|
307
|
+
log.warning("MDS修补: 节点 %s 没有 'package_folder'。", node.get("ref"))
|
|
308
|
+
|
|
266
309
|
shutil.rmtree(f"{self.target_dir}/tmp", ignore_errors=True)
|
|
267
310
|
except Exception as exp:
|
|
268
|
-
log.error("
|
|
269
|
-
log.error("
|
|
311
|
+
log.error("工作状态错误 (组件: %s): %s", component_name, exp) # 增加组件名
|
|
312
|
+
log.error("更新组件 %s 代码到 %s 失败", component_name, conan_version)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
bmcgo/__init__.py,sha256=
|
|
1
|
+
bmcgo/__init__.py,sha256=yr-QyjX3oYzKiHkvrCjDmfp2vg2JtI2RiAVMPqHSPRQ,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
|
|
@@ -245,7 +245,7 @@ bmcgo/utils/combine_json_schemas.py,sha256=08JrAlLeo_JgUqzYcZNgSwJZPLfjbWVJ4esPP
|
|
|
245
245
|
bmcgo/utils/component_post.py,sha256=rTSMv36geI6rbm6ZFQenZfG0mn1nVPpdJqn7g8bYtKA,2330
|
|
246
246
|
bmcgo/utils/component_version_check.py,sha256=ukc-H-A4ljkOShzVtkYWL0oTIYwxgDIZtP-fPqqHnRY,6274
|
|
247
247
|
bmcgo/utils/config.py,sha256=BoNx8U8VjnHrC-lFXIhp6Ex8f02kZgUS-mTkRxi_SYM,51141
|
|
248
|
-
bmcgo/utils/fetch_component_code.py,sha256=
|
|
248
|
+
bmcgo/utils/fetch_component_code.py,sha256=ESo8gBpW_0BTVOJ-HTqm2GH2A9dnQ3eQEomPZw2sgcU,14599
|
|
249
249
|
bmcgo/utils/install_manager.py,sha256=Ag7tcTbhBfc6aTe5FOiET-8koq8_iY38Sozmi3dquio,4919
|
|
250
250
|
bmcgo/utils/json_validator.py,sha256=_k5wU78wfYGrzvSDaqOEtT4otgKUjquVhZNpVf2PW_c,7524
|
|
251
251
|
bmcgo/utils/mapping_config_patch.py,sha256=ersqH5AmDvSfrOLbsNs3mfBxLQ3AUbJlCAjjtO6dMDk,16909
|
|
@@ -263,8 +263,8 @@ bmcgo/utils/installations/install_plans/qemu.yml,sha256=lT7aKag60QUH6hTGFKa3hGRq
|
|
|
263
263
|
bmcgo/utils/installations/install_plans/studio.yml,sha256=AEspVgsVAnmUdvqZYNCb7SPoUEq_0i61dfpauyguLa4,229
|
|
264
264
|
bmcgo/utils/installations/installers/apt_installer.py,sha256=nPaCb4cobSi9InN_aHsEPtQ0k4FgsCUWE5_VgBPvcRE,3769
|
|
265
265
|
bmcgo/utils/installations/installers/pip_installer.py,sha256=dDdios1EQ7fzt90r02pZeoM3jCmjslLzkSvzd2hgRVM,3241
|
|
266
|
-
openubmc_bingo-0.6.
|
|
267
|
-
openubmc_bingo-0.6.
|
|
268
|
-
openubmc_bingo-0.6.
|
|
269
|
-
openubmc_bingo-0.6.
|
|
270
|
-
openubmc_bingo-0.6.
|
|
266
|
+
openubmc_bingo-0.6.74.dist-info/METADATA,sha256=eDgP0VlpyDbnaIoqHHBcZf1CJ14HGZTwhsNf_UvEwdg,1010
|
|
267
|
+
openubmc_bingo-0.6.74.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
268
|
+
openubmc_bingo-0.6.74.dist-info/entry_points.txt,sha256=UUoUP-vAWTgg9vEYbRwYqOBHgpRtkngdzMPb-ocz90g,42
|
|
269
|
+
openubmc_bingo-0.6.74.dist-info/top_level.txt,sha256=9AcvCAt1nZcOgMsGt6T07mg2Bgtdet-3mHTwg91axgI,6
|
|
270
|
+
openubmc_bingo-0.6.74.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|