Adopt pinned public core snapshot and prepare Sized 2.0.0
This commit is contained in:
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
repo_root=$(cd "$(dirname "$0")/.." && pwd)
|
||||
cd "$repo_root"
|
||||
[[ $# == 1 && $1 == /* ]] || { echo 'Usage: scripts/package-source.sh ABSOLUTE_NEW_DIRECTORY' >&2; exit 2; }
|
||||
destination=$1
|
||||
[[ ! -e $destination && ! -L $destination ]] || { echo 'Refusing existing source output.' >&2; exit 1; }
|
||||
git diff --quiet HEAD -- || { echo 'Commit tracked changes before packaging.' >&2; exit 1; }
|
||||
revision=$(git rev-parse HEAD)
|
||||
mkdir -p "$destination"
|
||||
source_dir="$destination/sized-source"
|
||||
mkdir "$source_dir"
|
||||
git archive "$revision" | tar -x -C "$source_dir"
|
||||
mkdir -p "$source_dir/.cargo"
|
||||
cargo vendor --locked --versioned-dirs --manifest-path "$source_dir/Cargo.toml" "$source_dir/vendor" > "$destination/vendor-config"
|
||||
sed 's|directory = ".*"|directory = "vendor"|' "$destination/vendor-config" > "$source_dir/.cargo/config.toml"
|
||||
printf '%s\n' "$revision" > "$source_dir/SOURCE-REVISION.txt"
|
||||
cat > "$source_dir/BUILD-OFFLINE.txt" <<BUILD
|
||||
Sized 2.0.0 source checkpoint: $revision
|
||||
Requires Rust 1.88 or newer and the target platform's C linker/toolchain.
|
||||
From this directory: cargo build --locked --offline --release
|
||||
Test: cargo test --locked --offline --workspace (run as an ordinary user)
|
||||
Verify included core: python3 scripts/check-core.py
|
||||
Make an unsigned host archive: SIZED_SOURCE_REVISION=$revision scripts/release.sh
|
||||
Developer ID signing/notarization requires your own identity and is separate.
|
||||
BUILD
|
||||
(cd "$source_dir" && CARGO_HOME="$destination/empty-cargo-home" CARGO_TARGET_DIR="$destination/check-target" cargo check --locked --offline --workspace --all-targets)
|
||||
(cd "$source_dir" && python3 scripts/check-core.py)
|
||||
tar -czf "$destination/sized-v2.0.0-source.tar.gz" -C "$destination" sized-source
|
||||
printf '%s\n' "$revision" > "$destination/SOURCE-REVISION.txt"
|
||||
echo "Verified offline source: $destination/sized-v2.0.0-source.tar.gz"
|
||||
Reference in New Issue
Block a user