Reject invalid native protobuf cache

This commit is contained in:
root
2026-05-01 14:09:50 +00:00
parent fa0162eff2
commit dac5bbedc6
2 changed files with 18 additions and 0 deletions
+16
View File
@@ -65,6 +65,21 @@ ensure_native_protoc() {
require_path "$PROTOC" require_path "$PROTOC"
} }
remove_invalid_native_protobuf_cache() {
local archive
archive="$(find "$ROOT/depends/built/$HOST/native_protobuf" \
-name 'native_protobuf-*.tar.gz' -type f 2>/dev/null | sort | tail -n 1 || true)"
[[ -n "$archive" ]] || return 0
if tar -tzf "$archive" ./bin/protoc >/dev/null 2>&1; then
return 0
fi
echo "Removing invalid native_protobuf cache without bin/protoc: $archive"
rm -rf "$ROOT/depends/built/$HOST/native_protobuf"
}
cd "$ROOT" cd "$ROOT"
require_cmd make require_cmd make
@@ -75,6 +90,7 @@ require_cmd cmake
require_cmd ninja require_cmd ninja
reset_qt_configure_state reset_qt_configure_state
remove_invalid_native_protobuf_cache
echo "Building native depends for $HOST..." echo "Building native depends for $HOST..."
make -C depends HOST="$HOST" NO_QT=0 -j"$JOBS" make -C depends HOST="$HOST" NO_QT=0 -j"$JOBS"
+2
View File
@@ -23,5 +23,7 @@ define $(package)_stage_cmds
endef endef
define $(package)_postprocess_cmds define $(package)_postprocess_cmds
test -x bin/protoc || \
(echo "ERROR: native_protobuf staged without bin/protoc" && find . -maxdepth 3 -type f -o -type d && exit 1) && \
chmod +x bin/protoc chmod +x bin/protoc
endef endef