Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

fix(packaging): AUR PKGBUILD survives constrained builders (#677)

AkitaOnRails0f9749f22567
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cf819cf9..fe0cc8a7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
now uses the import instead of a prose pointer (#680).
### Fixed
+- The from-source AUR `PKGBUILD` now builds and tests on constrained AUR
+ builders. Release LTO was disabled (`options=('!debug' '!lto')`) so the
+ final link no longer gets OOM-killed on low-memory build hosts, and the
+ `check()` step pins `CARGO_HOME` to the registry `build()` already
+ populated before it repoints `HOME` at an empty test home, so the
+ `--frozen` test run can resolve the packages it fetched instead of
+ failing offline (#677).
- CLI server errors now name the request. A non-2xx response from the
configured server printed only `server returned 404 Not Found: <body>`,
so a failure gave no clue which endpoint answered. The message now leads
diff --git a/crates/ai-memory-cli/tests/suite/packaging.rs b/crates/ai-memory-cli/tests/suite/packaging.rs
index 5fedf8ed..7e5f9488 100644
--- a/crates/ai-memory-cli/tests/suite/packaging.rs
+++ b/crates/ai-memory-cli/tests/suite/packaging.rs
@@ -221,6 +221,28 @@ fn aur_packages_install_all_native_assets() {
);
}
+ // The from-source PKGBUILD builds and runs `check()` on the AUR host.
+ // Two things keep that green (see #677): `!lto` avoids the release-LTO
+ // link step that OOM-killed the build on constrained AUR builders, and
+ // pinning CARGO_HOME to the real registry before the HOME override lets
+ // the `--frozen` check() resolve the packages build() already fetched.
+ let src_pkgbuild = read_repo("packaging/aur/PKGBUILD");
+ assert!(
+ src_pkgbuild.contains("options=('!debug' '!lto')"),
+ "from-source PKGBUILD must disable LTO to survive constrained AUR builders"
+ );
+ let cargo_home = src_pkgbuild
+ .find("export CARGO_HOME=")
+ .expect("check() must pin CARGO_HOME");
+ let home_override = src_pkgbuild
+ .find(r#"export HOME="$srcdir/test-home""#)
+ .expect("check() must override HOME");
+ assert!(
+ cargo_home < home_override,
+ "CARGO_HOME must be pinned to the real registry before HOME is repointed, \
+ or --frozen check() cannot resolve the fetched packages"
+ );
+
let install = read_repo("packaging/aur/ai-memory.install");
assert!(install.contains("sudo -u ai-memory ai-memory --data-dir /var/lib/ai-memory"));
assert!(!install.contains("sudo ai-memory --data-dir /var/lib/ai-memory"));
diff --git a/packaging/aur/PKGBUILD b/packaging/aur/PKGBUILD
index adeb4653..eef9711b 100644
--- a/packaging/aur/PKGBUILD
+++ b/packaging/aur/PKGBUILD
@@ -27,7 +27,7 @@ optdepends=(
)
backup=('etc/ai-memory/config.toml' 'etc/ai-memory/env')
install=ai-memory.install
-options=('!debug')
+options=('!debug' '!lto')
conflicts=('ai-memory-bin')
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('SKIP')
@@ -51,6 +51,10 @@ check() {
export RUSTUP_TOOLCHAIN=1.95
export CARGO_TARGET_DIR=target
export TAILWIND_SKIP=1
+ # Pin CARGO_HOME to the real registry (populated by build()) before the
+ # HOME override below points cargo at an empty ~/.cargo, or --frozen fails
+ # to resolve the vendored registry it already downloaded.
+ export CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}"
export HOME="$srcdir/test-home"
mkdir -p "$HOME"
cargo test --frozen --release -p ai-memory-cli --bin ai-memory