From a05b3553e4fe69ebcf13465e63cc3ee55c61b027 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Thu, 29 Feb 2024 17:54:02 -0800 Subject: [PATCH] mk/{package,publish.sh}: Do extra last-instant dirty repo checks. `--allow-dirty` doesn't allow us to be as granular as we'd like; see https://github.com/rust-lang/cargo/issues/9398#issuecomment-1874902344. This isn't foolproof but it gets us closer to what we want. The new `mk/publish.sh` is a step towards more robust publishing with tagging, etc. --- mk/package.sh | 4 ++++ mk/publish.sh | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100644 mk/publish.sh diff --git a/mk/package.sh b/mk/package.sh index 56e07b3d40..18cda44325 100644 --- a/mk/package.sh +++ b/mk/package.sh @@ -12,4 +12,8 @@ fi cargo clean --target-dir=target/pregenerate_asm RING_PREGENERATE_ASM=1 CC_AARCH64_PC_WINDOWS_MSVC=clang \ cargo build -p ring --target-dir=target/pregenerate_asm +if [[ -n "$(git status --porcelain -- ':(exclude)pregenerated/')" ]]; then + echo Repository is dirty. + exit 1 +fi cargo package -p ring --allow-dirty diff --git a/mk/publish.sh b/mk/publish.sh new file mode 100644 index 0000000000..194ef1361e --- /dev/null +++ b/mk/publish.sh @@ -0,0 +1,9 @@ +set -eux -o pipefail +IFS=$'\n\t' + +# Make sure the current tree isn't dirty other than what's in pregenerated/. +if [[ -n "$(git status --porcelain -- ':(exclude)pregenerated/')" ]]; then + echo Repository is dirty. + exit 1 +fi +cargo publish -p ring --allow-dirty