2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2026-09-12 12:36:23 +00:00
Commit Graph

10 Commits

Author SHA1 Message Date
Daniel Hilst d0875ee1ff fix(xcat-dep): validate_manifest must apply the SAME arch:all skip as the builder (ppc build was aborting)
The previous commit added the arch:all boot tools (syslinux-xcat/grub2-xcat/
elilo-xcat/xnba-undi) to the ppc64el manifest and taught build_one_codename to
skip BUILDING them on non-amd64 -- but validate_manifest, which runs per-arch on
every non-dry-run invocation and is NOT gated by --skip-createrepo, still
demanded them. On the ppc64el build stage (--arch ppc64el, no --skip-build) the
builder skipped the four (correct -- their source is x86-only) so they were never
staged, then validate_manifest reported them MISSING and aborted the whole ppc
build before assembly: every BUILD_PPC=true run would have failed.

Fix the drift structurally: extract the skip rule into one pure, tested decider
BuildUtils::skip_arch_all_on() behind a shared sbuild-all.pl helper
pkg_skip_on_arch(), consulted by BOTH build_one_codename and validate_manifest,
so a package the build skips is never demanded by the per-arch validation. The
arch:all debs' presence on ppc is still verified later against the published
index by verify_assembled_repo. Also make control_binary_arch return the full
Architecture value (not just the first token of a multi-arch list) and add a
regression test for the shared skip rule.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-08-13 11:05:33 -03:00
Daniel Hilst 8f3dfd9e84 fix(xcat-dep): require the arch:all boot tools (syslinux/grub2/elilo/xnba) on ppc64el
The ppc64el manifest sections listed only the natively-built deps
(ipmitool-xcat, conserver-xcat, goconserver) + genesis, omitting the four
noarch boot components syslinux-xcat, grub2-xcat, elilo-xcat and xnba-undi. A
ppc management node needs these for netboot -- the EL manifest and the
historical 2.16 ppc dep repo both ship them (grub2-xcat + syslinux-xcat
especially; yaboot-xcat was dropped in 2.18 as obsolete). They ARE published
to the ppc index today (Architecture:all rides into every binary-<arch>
index), but the completeness gate never asserted their presence for ppc.

List them as required-present on every ppc64el target so the gate verifies the
ppc repo carries them. They remain SINGLE-PRODUCER: their source is x86-only
(syslinux compiles with nasm/gcc-multilib), so build_one_codename now skips an
Architecture:all package on any non-amd64 arch -- detected via a new pure,
unit-tested control_binary_arch() helper -- so listing them for ppc64el drives
verification, not a second (failing) build.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-08-13 10:43:56 -03:00
Daniel Hilst 7944387b4b fix(xcat-dep): verify gate must detect a NATIVE-arch build, not a non-empty index
The prior commit scoped the apt verify gate to '--arch floor UNION present
arches', but detected presence with a non-empty binary-<arch>/Packages. That
is wrong: every binary-<arch> index carries the Architecture:all debs
(grub2-xcat, genesis), so a BUILD_PPC=false run has a non-empty binary-ppc64el
index built purely from arch:all debs -- and the gate would still demand the
native ppc compiled deps (ipmitool-xcat, conserver-xcat, goconserver) it never
built, the exact false-fail the change was meant to remove.

Detect a genuine per-arch build via a new pure helper index_has_native_arch(),
which is true only when the index has a stanza with Architecture == that arch
(not merely Architecture:all). Unit-tested happy + the arch:all-only sad case.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-08-13 10:08:33 -03:00
Daniel Hilst cacc78cead fix(xcat-dep): scope the apt verify gate to --arch (present-arch union); drop dead option specs
Two review follow-ups to the Ubuntu matrix build:

1. verify_assembled_repo hardcoded {amd64, ppc64el}, so a single-arch run
   (BUILD_PPC=false, or --verify-repo on an amd64-only tree) false-failed
   demanding a ppc index it never built. The gate now verifies the --arch
   set as a required FLOOR unioned with any arch that actually published a
   non-empty index: the multi-arch assemble (invoked --arch amd64) still
   verifies the ppc64el debs it carries, while a genuine single-arch run no
   longer demands the absent arch. No Jenkinsfile/invocation change, so
   master's shared inline job stays compatible.

2. standard_options advertised finalize-xcat-dep!/force-unlock!, which
   sbuild-all.pl never wires (--force-unlock would even error as unknown).
   Drop them.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-08-13 10:05:12 -03:00
Daniel Hilst 1ac98b6fb6 fix(xcat-dep): repo gate — duplicate version is a hard error; signature strictly matches CLI key
Align the apt gate with the EL gate so both AGREE on success/failure:
- Duplicate: parse_packages_index now DIES loudly on a package with two DISTINCT versions
  (stale .deb not cleaned), mirroring EL's rpm_version -- no more silent keep-highest.
  Removed the dpkg keep-highest oracle; added a happy/sad test.
- Signature: sig_observed_key returns the signer fingerprint or undef (no presence-only
  fallback); the gate hard-fails (SIGKEY) if --gpg-key-id doesn't resolve to a fingerprint,
  so it always confirms the repo was signed by EXACTLY the CLI key. Signature is required
  only when --gpg-sign was used.
- Align the MISSING message with EL (undef pin -> '*'). Document the gate + idiosyncrasies
  in BUILD.md.
prove t/sbuild-all.t: 98/98.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-08-12 17:11:42 -03:00
Daniel Hilst 6f7497cceb fix(xcat-dep): repo gate must verify the NATIVE per-arch genesis; harden signature check
Review follow-up on the apt-repo gate:
- FALSE-PASS (concern #7610): genesis name-resolution picked xcat-genesis-base-amd64
  alphabetically for BOTH cells (both genesis debs are Architecture:all and appear in every
  arch index), so the ppc64el cell never verified its NATIVE xcat-genesis-base-ppc64el -- a
  dropped ppc genesis passed. Extract a PURE, unit-tested resolve_present_names that resolves
  the arch-suffixed genesis to THIS cell's arch only (never a different arch), with a test that
  reproduces the masked-genesis case.
- signature: reject EXPKEYSIG/REVKEYSIG/EXPSIG (expired/revoked keys emit VALIDSIG too); drop
  the short-GOODSIG-keyid fallback (could never equal the 40-hex expected fpr -> spurious WRONGKEY).
- FALSE-FAIL: the post-assembly auto-run now requires a signature only when --gpg-sign was
  actually used (an unsigned-by-choice repo no longer dies UNSIGNED); standalone --verify-repo
  keeps checking whenever a gpg key/home is configured.
- cosmetic: de-duplicate the MISSING-INDEX message.
prove t/sbuild-all.t: pure gate tests incl. the new genesis-resolution cases.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-08-12 16:43:19 -03:00
Daniel Hilst 68f17873bb feat(xcat-dep): manifest-driven apt repo completeness + signature gate, auto-run after assemble
Adds a real gate on the ASSEMBLED apt repo, per codename x arch, using
debs-manifest.conf as the single source of truth, layered pure/testable:

- BuildUtils: verify_repo_packages(\%expected,\%present) (MISSING/VERSION),
  verify_repo_signature(\%expected,\%observed) (UNSIGNED/WRONGKEY), and
  parse_packages_index($text) -- all PURE and unit-tested (happy+sad, no dpkg-deb).
- sbuild-all.pl does the IO via one sub verify_assembled_repo: parses each published
  binary-<arch>/Packages (resolving arch-suffixed names like xcat-genesis-base-<arch>,
  reducing to upstream via deb_upstream_version to compare against the manifest pin),
  runs gpg --verify on each dists/<cn>/InRelease and extracts the signer fingerprint,
  then delegates to the two pure deciders and dies listing every [<cn>/<arch>] problem.
- Runs AUTOMATICALLY at the end of assemble_apt (once Packages + signed Release exist);
  suppressible with --no-verify-repo; skipped under --dry-run. Also a standalone,
  lock-free, build-free '--verify-repo=<apt_dir>' mode using the script's --manifest/
  --dists/--gpg-key-id/--gpg-home. Replaces the coarse pool-global hard-coded check.

prove t/sbuild-all.t: 90/90 (was 71). Smoke-tested: complete tree passes; dropped pkg
-> MISSING; wrong version -> VERSION; missing index -> MISSING-INDEX; all die nonzero.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-08-12 15:30:53 -03:00
Daniel Hilst c808e06da3 fix(xcat-dep): address code review — run lock, loud tree wipes, wire tested genesis copier, dedupe pool, honest Release arches
Review follow-up for the Ubuntu sbuild matrix:

- Add a fail-fast exclusive flock over the whole run (<output-root>/.sbuild-all.lock,
  file-scoped handle) so two overlapping runs can't corrupt the shared staging/apt
  tree -- this is the root of the observed 'remove_tree .../staging/<cn>/<arch>:
  Directory not empty' (an NFS silly-rename from a concurrent run).
- wipe_tree(): remove_tree that captures {error} and dies loud, so an ENOTEMPTY no
  longer carps-and-continues leaving stale debs; used for all staging/pool/dists wipes.
- Wire the tested, hash-based cross_copy_genesis_deb into build_genesis (was a naive
  glob+copy, so the unit-tested stale-dropping copier was dead code); remove the
  genuinely-unused deb_snap_version/rewrite_changelog_top helpers + their subtests
  (compiled deps intentionally ship their tracked changelog version).
- Dedupe assemble_apt on binary Package+Architecture (keep highest via
  dpkg --compare-versions) so a double-produced genesis can't land two versions in
  the pool, independent of the --skip-genesis contract.
- Derive Release Architectures from the arches actually staged (non-empty
  binary-<arch>/Packages), not a hard-coded 'amd64 ppc64el'.
- goconserver: guard 'go mod init' when a go.mod exists (+ TODO to commit go.sum for
  the pinned SHA). Accept-and-ignore the unused per-package --log-dir/--build-number/
  --skip-install flags (documented). Remove orphaned make_deb.sh dispatchers
  (build-debs-all, build.sh, ipmitool/build.sh) + update the READMEs.

perl -c clean; prove t/sbuild-all.t: 71/71.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-08-12 11:49:54 -03:00
Daniel Hilst b72139c18c refactor(xcat-dep): make each <dep>/sbuild.pl a true per-package builder
The per-package <dep>/sbuild.pl were generic wrappers that shelled out to each
package's make_deb.sh, so a package's build brain was split across two files and
package-specific fixes (e.g. goconserver's Go toolchain) landed in make_deb.sh
instead of the builder -- inconsistent with the EL side, where <dep>/mockbuild.pl
IS the per-package builder.

Make each <dep>/sbuild.pl own its build (mirroring <dep>/mockbuild.pl), absorbing
its make_deb.sh (source prep, patches, toolchain, dpkg-buildpackage), and remove
all seven make_deb.sh. The common chroot orchestration -- ephemeral schroot session,
apt update, build-dep install, out-of-tree copy, SOURCE_DATE_EPOCH, deb collection +
host-side verification -- moves into BuildUtils::build_deb_in_chroot; each builder
supplies only its package-specific recipe (passed base64-encoded to avoid quoting
interplay through schroot).

Also make the older Ubuntu codenames buildable:
- goconserver: install a pinned modern Go (1.25.12) in the build -- focal/jammy ship
  a Go too old to even auto-switch toolchains, and goconserver's pinned deps need
  Go >= 1.25 (it is a static CGO-free binary, so the pinned toolchain is portable and
  reproducible across codenames).
- ipmitool + goconserver: lower debian/compat 13 -> 12 and Build-Depends debhelper
  (>= 12), since Ubuntu 20.04 (focal) ships debhelper 12; compat 12 also builds cleanly
  on newer codenames.

Validated: all recipe shapes build green through the new path -- tarball
(ipmitool@focal), git-clone+pinned-Go (goconserver@focal), tarball+patches
(syslinux@noble), in-place (grub2-xcat), in-place+custom-rules (xnba); 80/80 unit
tests still pass.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-08-11 13:12:59 -03:00
Daniel Hilst b4627bc227 feat(xcat-dep): rework the Ubuntu dep build as testable Perl (sbuild-all.pl)
The Ubuntu/Debian dependency build shipped as three bash scripts
(build-dep-debs.sh, build-apt-repo.sh, mk-dep-chroots.sh) whose review
(PR #63) surfaced correctness problems: partial/stale output could be
published, the rpm->deb genesis conversion dropped the maintained package
semantics (Depends/Breaks/Replaces + maintainer scripts), the arch matrix
was invalid (x86-only syslinux/elilo/xnba treated as ppc64el packages, and
Architecture:all packages with no single producer), several required
failures exited zero, and the build/repo scripts disagreed on their staging
path and codename set (focal missing from the assembler).

Rewrite it as proper, unit-tested Perl mirroring the EL side
(mockbuild-all.pl / MockBuildUtils.pm / <dep>/mockbuild.pl / t/*.t /
packages-manifest.conf), sharing one CLI vocabulary:

- BuildUtils.pm: shared, testable helpers + the canonical CLI spec, plus the
  Debian-specific helpers (out-of-tree changelog stamping, genesis control
  preservation, deb inspection, cross-arch genesis provisioning).
- sbuild-all.pl: the orchestrator, absorbing all three shell scripts. Builds
  + validates into a fresh per-arch staging tree and only (re)assembles the
  published apt repo from validated staging -- so partial/failed output never
  ships and stale debs never accumulate. Auto-initializes the per-codename
  sbuild chroots on first run. Fails the whole run non-zero on any missing
  chroot/package/artifact or version-pin mismatch.
- <dep>/sbuild.pl x7: per-package builders that drive each package's
  MAINTAINED debian/ in the matching chroot (never re-implemented), so the
  converted/built packages keep their control metadata and maintainer scripts.
- debs-manifest.conf: per-[<codename>-<arch>] required set + version pins,
  encoding the per-arch package sets (x86 boot components built once on amd64
  as the single producer; ppc64el builds only the arch-specific compiled deps).
- t/sbuild-all.t: fixture tests for every pure helper.
- goconserver/make_deb.sh: pin the upstream SHA instead of cloning a moving
  branch, so every matrix cell builds the same source (reproducible).

Codename set unified across build, assembly, chroots and docs (focal IS
supported). BUILD.md documents the new flow.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-08-10 18:55:29 -03:00