Files
sized/scripts/package-source.sh
T
gamertan e0707447ad
Sized Linux checks / Linux AMD64 / Rust 1.88.0 (pull_request) Successful in 4m54s
Sized Linux checks / Linux AMD64 / Rust 1.88.0 (push) Successful in 4m57s
Adopt pinned public core snapshot and prepare Sized 2.0.0
2026-10-10 13:11:02 -04:00

32 lines
1.8 KiB
Bash
Executable File

#!/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"