Fix dependency util suggest calculate bug (#441)

* fix dependency util suggest calculate bug

* fix dependency util suggest calculate bug
This commit is contained in:
Jerry Ma 2024-05-06 14:23:32 +08:00 committed by GitHub
parent bde18054e5
commit 7416b8079b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -62,12 +62,17 @@ class DependencyUtil
if ($include_suggested_libs) {
foreach ($dep_list as $name => $obj) {
$del_list = [];
foreach ($obj['suggests'] as $id => $suggest) {
if (!str_starts_with($suggest, 'ext@')) {
$dep_list[$name]['depends'][] = $suggest;
array_splice($dep_list[$name]['suggests'], $id, 1);
$del_list[] = $id;
}
}
foreach ($del_list as $id) {
unset($dep_list[$name]['suggests'][$id]);
}
$dep_list[$name]['suggests'] = array_values($dep_list[$name]['suggests']);
}
}
@ -93,12 +98,17 @@ class DependencyUtil
if ($include_suggested_exts) {
// check every deps suggests contains ext@
foreach ($dep_list as $name => $obj) {
$del_list = [];
foreach ($obj['suggests'] as $id => $suggest) {
if (str_starts_with($suggest, 'ext@')) {
$dep_list[$name]['depends'][] = $suggest;
array_splice($dep_list[$name]['suggests'], $id, 1);
$del_list[] = $id;
}
}
foreach ($del_list as $id) {
unset($dep_list[$name]['suggests'][$id]);
}
$dep_list[$name]['suggests'] = array_values($dep_list[$name]['suggests']);
}
}
@ -106,12 +116,17 @@ class DependencyUtil
if ($include_suggested_libs) {
// check every deps suggests
foreach ($dep_list as $name => $obj) {
$del_list = [];
foreach ($obj['suggests'] as $id => $suggest) {
if (!str_starts_with($suggest, 'ext@')) {
$dep_list[$name]['depends'][] = $suggest;
array_splice($dep_list[$name]['suggests'], $id, 1);
$del_list[] = $id;
}
}
foreach ($del_list as $id) {
unset($dep_list[$name]['suggests'][$id]);
}
$dep_list[$name]['suggests'] = array_values($dep_list[$name]['suggests']);
}
}