Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-sovereign-core-mv/blob/main/scripts/package-release.sh # aien-sovereign-core-mv AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-sovereign-core-mv / scripts / package-release.sh` 91 lines ยท 4781 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # SPDX-License-Identifier: Apache-2.0 3 # Copyright 2026 Drake Stapleton (AIEN / aien-dev) 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # Package the release binaries into a byte-reproducible tarball. 18 # 19 # scripts/package-release.sh 20 # 21 # Environment: 22 # AIEN_DRY_RUN=1 label the package dry-run (release.toml `dry-run = true`) and package even when the release 23 # gate fails (candidate "NOT-RELEASABLE"); never for a release 24 # AIEN_RELEASE_BIN_DIR directory holding the built binaries (default target/release) 25 # SOURCE_DATE_EPOCH mtime for every entry (default 0) 26 # 27 # The archive carries release.toml: schema, candidate id, the sha256 of the packaged aien-cli, 28 # the optional [model] table and a [files] table with the sha256 of every other file. install.sh 29 # verifies every listed file against it before it activates a release. 30 # Same inputs give the same bytes: sorted entries, fixed mtime, owner 0, no atime (gnu format), 31 # normalised modes, gzip -n (no name or time in the gzip header). 32 set -euo pipefail 33 cd "$(dirname "${BASH_SOURCE[0]}")/.." 34 ARTIFACT="${1:?provide output archive path}" 35 BIN_DIR="${AIEN_RELEASE_BIN_DIR:-target/release}" 36 # The candidate id and model table come from the release gate, never from the caller. A tree that fails the 37 # gate is not packaged, except with AIEN_DRY_RUN=1, which labels the package NOT-RELEASABLE (it then fails 38 # check-release-candidate.sh --package and cannot be installed as a candidate). 39 GATE_MODEL="$(mktemp)" 40 if CANDIDATE="$(bash scripts/check-release-candidate.sh --model "$GATE_MODEL" | sed -n 's/^candidate=//p')" && [[ -n "$CANDIDATE" ]]; then 41 AIEN_MODEL_INPUTS="$GATE_MODEL" 42 elif [[ "${AIEN_DRY_RUN:-}" == 1 ]]; then 43 echo "WARNING: release gate failed; dry run packages this tree as NOT-RELEASABLE" >&2 44 CANDIDATE="NOT-RELEASABLE"; AIEN_MODEL_INPUTS="" 45 else 46 echo "release gate failed; refusing to package" >&2; exit 1 47 fi 48 EPOCH="${SOURCE_DATE_EPOCH:-0}" 49 TAR=tar 50 command -v gtar >/dev/null 2>&1 && TAR=gtar 51 "$TAR" --version 2>/dev/null | grep -q 'GNU tar' || { echo "GNU tar is required (on macOS: brew install gnu-tar)" >&2; exit 1; } 52 sha() { if command -v sha256sum >/dev/null 2>&1; then sha256sum "$1" | cut -d' ' -f1; else shasum -a 256 "$1" | cut -d' ' -f1; fi; } 53 PACKAGE_DIR="$(mktemp -d)" 54 trap 'rm -rf "$PACKAGE_DIR" "$GATE_MODEL"' EXIT 55 mkdir -p "$PACKAGE_DIR/bin" 56 for binary in aien-cli spark-cockpit-rs spark-inquisitor cortex-encoder-rs cortex-rs spark-supervisor spark-debugger; do 57 [[ -x "$BIN_DIR/$binary" ]] || { echo "Missing release binary: $binary" >&2; exit 1; } 58 name="$binary" 59 [[ "$binary" != aien-cli ]] || name=aien 60 cp "$BIN_DIR/$binary" "$PACKAGE_DIR/bin/$name" 61 done 62 for f in LICENSE NOTICE THIRD_PARTY.md; do [[ -f "$f" ]] || { echo "Missing $f; a release must carry its licence notices" >&2; exit 1; }; done 63 cp CONSTITUTION.md README.md install.sh LICENSE NOTICE THIRD_PARTY.md "$PACKAGE_DIR/" 64 if [[ -d imprints/en2-trinity ]]; then 65 mkdir -p "$PACKAGE_DIR/imprints" 66 cp -R imprints/en2-trinity "$PACKAGE_DIR/imprints/" 67 fi 68 find "$PACKAGE_DIR" -type d -exec chmod 755 {} + 69 find "$PACKAGE_DIR" -type f -exec chmod 644 {} + 70 chmod 755 "$PACKAGE_DIR/bin/"* "$PACKAGE_DIR/install.sh" 71 { 72 echo 'schema = "AienReleaseV1"' 73 echo "candidate = \"$CANDIDATE\"" 74 echo "aien-cli-sha256 = \"$(sha "$PACKAGE_DIR/bin/aien")\"" 75 # A dry-run package says so in its manifest; install.sh refuses it under the release key (sc#385). 76 [[ "${AIEN_DRY_RUN:-}" != 1 ]] || echo 'dry-run = true' 77 if [[ -n "${AIEN_MODEL_INPUTS:-}" ]]; then 78 echo 79 grep -q '^\[model\]' "$AIEN_MODEL_INPUTS" || { echo "AIEN_MODEL_INPUTS must start with [model]" >&2; exit 1; } 80 cat "$AIEN_MODEL_INPUTS" 81 fi 82 echo 83 echo '[files]' 84 (cd "$PACKAGE_DIR" && find . -type f ! -name release.toml | LC_ALL=C sort | sed 's|^\./||') | while read -r f; do 85 printf '"%s" = "%s"\n' "$f" "$(sha "$PACKAGE_DIR/$f")" 86 done 87 } > "$PACKAGE_DIR/release.toml" 88 chmod 644 "$PACKAGE_DIR/release.toml" 89 (cd "$PACKAGE_DIR" && "$TAR" --sort=name --mtime="@$EPOCH" --owner=0 --group=0 --numeric-owner \ 90 --format=gnu -cf - .) | gzip -n -9 > "$ARTIFACT" 91 echo "packaged $ARTIFACT sha256 $(sha "$ARTIFACT")"