test: support legacy plugin cleanup package layout

This commit is contained in:
Peter Steinberger
2026-05-02 15:35:36 +01:00
parent 57e4a12165
commit 9d5a0d4094
2 changed files with 28 additions and 11 deletions

View File

@@ -269,17 +269,26 @@ plugin_deps_cleanup_plugins() {
printf '%s\n' "${OPENCLAW_UPGRADE_SURVIVOR_PLUGIN_DEPS_CLEANUP_PLUGINS:-discord telegram}"
}
plugin_deps_cleanup_plugin_dirs() {
local plugin="$1"
printf '%s\n' \
"$(package_root)/dist/extensions/$plugin" \
"$(package_root)/extensions/$plugin"
}
legacy_plugin_dependency_probe_paths() {
local plugin="$1"
local plugin_dir
plugin_dir="$(package_root)/dist/extensions/$plugin"
while IFS= read -r plugin_dir; do
printf '%s\n' \
"$plugin_dir/node_modules" \
"$plugin_dir/.openclaw-runtime-deps.json" \
"$plugin_dir/.openclaw-runtime-deps-stamp.json" \
"$plugin_dir/.openclaw-runtime-deps-copy-upgrade-survivor" \
"$plugin_dir/.openclaw-install-stage-upgrade-survivor" \
"$plugin_dir/.openclaw-pnpm-store"
done < <(plugin_deps_cleanup_plugin_dirs "$plugin")
printf '%s\n' \
"$plugin_dir/node_modules" \
"$plugin_dir/.openclaw-runtime-deps.json" \
"$plugin_dir/.openclaw-runtime-deps-stamp.json" \
"$plugin_dir/.openclaw-runtime-deps-copy-upgrade-survivor" \
"$plugin_dir/.openclaw-install-stage-upgrade-survivor" \
"$plugin_dir/.openclaw-pnpm-store" \
"$(package_root)/.local/bundled-plugin-runtime-deps/$plugin-upgrade-survivor" \
"$OPENCLAW_STATE_DIR/.local/bundled-plugin-runtime-deps/$plugin-upgrade-survivor" \
"$OPENCLAW_STATE_DIR/plugin-runtime-deps/$plugin-upgrade-survivor"
@@ -297,10 +306,15 @@ seed_legacy_plugin_dependency_debris() {
local plugin
for plugin in $(plugin_deps_cleanup_plugins); do
local plugin_dir
plugin_dir="$(package_root)/dist/extensions/$plugin"
if [ ! -d "$plugin_dir" ]; then
continue
fi
plugin_dir=""
local candidate_dir
while IFS= read -r candidate_dir; do
if [ -d "$candidate_dir" ]; then
plugin_dir="$candidate_dir"
break
fi
done < <(plugin_deps_cleanup_plugin_dirs "$plugin")
[ -n "$plugin_dir" ] || continue
found=1
mkdir -p \
"$plugin_dir/node_modules/openclaw-upgrade-survivor-dep" \
@@ -330,6 +344,7 @@ seed_legacy_plugin_dependency_debris() {
if [ "$found" -ne 1 ]; then
echo "plugin-deps-cleanup scenario could not find a packaged Discord or Telegram plugin directory" >&2
find "$(package_root)/dist" -maxdepth 3 -type d 2>/dev/null >&2 || true
find "$(package_root)/extensions" -maxdepth 2 -type d 2>/dev/null >&2 || true
return 1
fi
}