#!/usr/bin/env bash # Export the node source as one tarball the builder VM can compile without any GitHub access: # src/vendor/igneum-node/ `git archive HEAD` of NODE_SRC, plus (SRC_MODE=head+dirty) every modified and untracked file # src/igneum-pow/ the same for POW_SRC # The layout keeps the fork's relative path dependency `igneum-pow = { path = "../../../../igneum-pow" }` # (vendor/igneum-node/consensus/pow/Cargo.toml) valid. Output: build/src.tar.gz and build/src.stamp (what went in). # This is the Windows package's src.zip recipe (proto-cuda/windows-node/make-package.sh) in Linux form. . "$(dirname "$0")/lib/common.sh" mkdir -p "$BUILD_DIR" stage="$BUILD_DIR/src" rm -rf "$stage"; mkdir -p "$stage/vendor/igneum-node" "$stage/igneum-pow" export_tree() { # repo-dir dest label local src="$1" dst="$2" label="$3" head dirty=0 [ -d "$src" ] || die "$label: $src does not exist" head=$(git -C "$src" rev-parse --short HEAD) git -C "$src" archive --format=tar HEAD | tar -x -C "$dst" if [ "$SRC_MODE" = "head+dirty" ]; then # modified, deleted and untracked files of the worktree (never target directories or the .git dir) local list; list=$(git -C "$src" ls-files -m -o --exclude-standard | grep -vE '^target' || true) if [ -n "$list" ]; then dirty=$(printf '%s\n' "$list" | grep -c .) printf '%s\n' "$list" | while IFS= read -r f; do if [ -e "$src/$f" ]; then mkdir -p "$dst/$(dirname "$f")"; cp -p "$src/$f" "$dst/$f"; else rm -f "$dst/$f"; fi done fi fi printf '%s: HEAD %s (%s), %s uncommitted files overlaid, mode %s\n' "$label" "$head" "$(git -C "$src" rev-parse --abbrev-ref HEAD)" "$dirty" "$SRC_MODE" } { printf 'exported %s\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" export_tree "$NODE_SRC" "$stage/vendor/igneum-node" "igneum-node ($NODE_SRC)" export_tree "$POW_SRC" "$stage/igneum-pow" "igneum-pow ($POW_SRC)" } | tee "$BUILD_DIR/src.stamp" # the fork's Cargo.lock is tracked, so the builder resolves the same crate versions; drop any stale target dirs rm -rf "$stage/vendor/igneum-node/target" "$stage/igneum-pow/target" tar -C "$BUILD_DIR" -czf "$BUILD_DIR/src.tar.gz" src rm -rf "$stage" log "wrote $BUILD_DIR/src.tar.gz ($(du -h "$BUILD_DIR/src.tar.gz" | cut -f1))" grep -q 'mode head$' "$BUILD_DIR/src.stamp" && log "NOTE: SRC_MODE=head ships HEAD only; on 3 Oct 2026 every worktree's branch work (finality v2, difficulty, hotswap) is uncommitted and would be left out" exit 0