| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
shims are test-only
`publish.rs::package_name` — the function that decides which package a built
artifact is, and therefore what the index says — called into the test harness
(`shims::read_pkginfo`) to read it. Worse, the shim module carried its own
`.PKGINFO` field parser alongside the real one in `pkginfo.rs`. Two parsers
that can drift is a supply-chain-shaped foot-gun in a system whose whole job
is provenance: the bytes we sign and the bytes the tests believed in would be
interpreted by different code, and a green shim test would not have meant the
pipeline read the package the same way.
There is now one parser. `package_name` uses `pkginfo::pkginfo_text` and
`pkginfo::parse_pkginfo`; the shim's `repo-add` renders its `DESC` entry from
the same `PkgInfo` the production code parses, so the fake tool and the real
pipeline cannot disagree about what a package calls itself. The duplicate
parser and the two wrapper functions are deleted, and the harness test reads
its artifact with `pkginfo` too.
The module itself is now test-only in the way the review asked for. `pub(crate)`
was not available — the shim binaries are separate crates that link the
library — so the equivalent enforcement is used instead: `shims` is compiled
out unless the `test-support` feature is on, and every shim binary declares
`required-features = ["test-support"]`. A production `cargo build --release`
neither builds the fakes nor links their code; `cargo build --bin makepkg`
says so out loud. `tests/production_surface.rs` covers the half the compiler
cannot see: no module in `src/` outside the harness may name `shims::`, and the
binaries must keep declaring the feature.
|
|
|
The harness that makes the rest of this developable. Six real binaries
named exactly like the tools the pipeline shells out to, sharing one
shim module, driven entirely by environment so no production code path
is test-only:
AUR_SHIM_DIR where invocations are recorded (jsonl)
AUR_SHIM_MANIFEST the fixture manifest to obey
AUR_SHIM_FAIL optional tool forced to fail
makechrootpkg emits real .pkg.tar.zst files with .PKGINFO and
.BUILDINFO (the full chroot world, which is why §10.1 filters it),
makepkg answers --printsrcinfo and --vercheck for Stage B, repo-add
rebuilds a gzip'd .db with %FILENAME%/%VERSION%/%SHA256SUM% DESC
entries, gpg writes a detached signature, mkarchroot creates a warm
root. Each one records its invocation so tests assert on what actually
ran.
testcorpus/ holds 17 fixtures, each a PKGBUILD plus a manifest with the
scripted outcome: plain-make, with-patch, install-hooks, skip-checksum,
split-pkgbase, build-fails, check-fails, missing-dep, dep-cycle,
epoch-bump, pkgrel-reset, downgrade, digest-drift, pin-drift,
git-sourced, git-submodules, unresolvable. The harness commits a fixture
into a real git repo standing in for AUR, materialises a local upstream
git repo for VCS fixtures, and swaps payload bytes for the drift cases.
Config.child_env is what puts the shims on PATH for child processes, so
the pipeline runs completely unmodified under test.
Part of P0 (DESIGN.md §17).
|