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
aien-sovereign-core-mv / scripts / test-offline-build.sh
| 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 | # Offline build check: fetch locked dependencies into a temp CARGO_HOME (needs network, once), |
| 18 | # then build the release crates with --offline --locked and, where possible, with the network |
| 19 | # namespace denied. This is an offline build from a warm cargo cache, not a vendored build. |
| 20 | # scripts/test-offline-build.sh (slow; not run in CI) |
| 21 | set -euo pipefail |
| 22 | cd "$(dirname "${BASH_SOURCE[0]}")/.." |
| 23 | CRATES=(aien-cli spark-cockpit-rs spark-inquisitor cortex-encoder-rs cortex-rs spark-supervisor spark-debugger) |
| 24 | WORK="$(mktemp -d "${TMPDIR:-/tmp}/aien-offline-build.XXXXXX")" |
| 25 | [[ -n "${KEEP:-}" ]] || trap 'rm -rf "$WORK"' EXIT |
| 26 | export CARGO_HOME="$WORK/cargo-home" CARGO_TARGET_DIR="$WORK/target" |
| 27 | # keep the toolchain from the real rustup home |
| 28 | export RUSTUP_HOME="${RUSTUP_HOME:-$HOME/.rustup}" |
| 29 | start=$SECONDS |
| 30 | echo "[*] cargo fetch --locked (network allowed)" |
| 31 | cargo fetch --locked |
| 32 | echo "[+] fetched in $((SECONDS - start))s" |
| 33 | args=(); for c in "${CRATES[@]}"; do args+=(-p "$c"); done |
| 34 | build=(cargo build --release --offline --locked "${args[@]}") |
| 35 | if unshare -rn true 2>/dev/null; then |
| 36 | echo "[*] building with the network namespace denied (unshare -rn)" |
| 37 | NETMODE="network denied (unshare -rn)" |
| 38 | unshare -rn "${build[@]}" |
| 39 | else |
| 40 | echo "WARNING: unshare -rn unavailable; network denial NOT enforced, only --offline was used" >&2 |
| 41 | NETMODE="only --offline (network denial not enforced)" |
| 42 | "${build[@]}" |
| 43 | fi |
| 44 | echo "PASS: offline build from a warm cargo cache (cargo fetch --locked, then --offline --locked), $NETMODE, crates: ${CRATES[*]}, $((SECONDS - start))s total" |