From dac5bbedc693dcb697528db62072546afa254a88 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 1 May 2026 14:09:50 +0000 Subject: [PATCH] Reject invalid native protobuf cache --- contrib/build-linux-wallet.sh | 16 ++++++++++++++++ depends/packages/native_protobuf.mk | 2 ++ 2 files changed, 18 insertions(+) diff --git a/contrib/build-linux-wallet.sh b/contrib/build-linux-wallet.sh index 8777efff..929cd4de 100755 --- a/contrib/build-linux-wallet.sh +++ b/contrib/build-linux-wallet.sh @@ -65,6 +65,21 @@ ensure_native_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" require_cmd make @@ -75,6 +90,7 @@ require_cmd cmake require_cmd ninja reset_qt_configure_state +remove_invalid_native_protobuf_cache echo "Building native depends for $HOST..." make -C depends HOST="$HOST" NO_QT=0 -j"$JOBS" diff --git a/depends/packages/native_protobuf.mk b/depends/packages/native_protobuf.mk index 6549f9eb..d0fd03a4 100644 --- a/depends/packages/native_protobuf.mk +++ b/depends/packages/native_protobuf.mk @@ -23,5 +23,7 @@ define $(package)_stage_cmds endef 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 endef