mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-10 04:36:40 +00:00
Adds a lint-packages target/workflow that parses the generated packaging metadata with each ecosystem's native parser (dpkg-parsechangelog, rpmspec, bash -n for the PKGBUILD), failing on any parser stderr so warnings cannot slip through. Wired into the make lint fan-out and ci-orchestrator's lint gate; an install group provisions the parsers (best-effort, cross-distro). Hardens package_mirror so the generated changelogs parse without warnings: every RPM body line gets a '- ' continuation prefix (a column-0 '*' was read as a new %changelog entry -> 'bad date'), and the archived-releases notice is folded into the oldest kept entry instead of trailing after the final entry (free text there made dpkg-parsechangelog warn). Regenerates packaging/debian/changelog and the Fedora spec accordingly. Adds a test-lint check (test_package_changelog_completeness) asserting both package changelogs list every CHANGELOG.md + docs/changelog release and that their inline window matches CHANGELOG.md, plus unit regressions for the RPM continuation prefix and the Debian footer fold. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
72 lines
2.2 KiB
Bash
Executable File
72 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# shellcheck shell=bash
|
|
#
|
|
# Validate the generated distro packaging metadata with each ecosystem's
|
|
# native parser, so a malformed changelog/spec/PKGBUILD is caught here
|
|
# instead of failing the (expensive) package build in build-ci-images.
|
|
#
|
|
# Strictness: several of these parsers emit a *warning* and still exit 0
|
|
# (dpkg-parsechangelog on trailing junk, rpmspec on a bad date). This
|
|
# lint therefore fails on any parser stderr, not just on a non-zero exit,
|
|
# so warnings cannot slip through. The generator that writes these files
|
|
# (cli.contributing.changelog.archive.package_mirror) is additionally
|
|
# covered by unit tests, so prevention does not depend on tool
|
|
# availability alone.
|
|
#
|
|
# Each validator is used when its tool is on PATH and skipped with a
|
|
# notice when not, so the check runs in any single-distro lint
|
|
# environment (Debian CI validates debian/ + fedora/, an Arch host
|
|
# validates arch/ with namcap).
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(cd -- "${SCRIPT_DIR}/../.." && pwd)"
|
|
|
|
cd "${REPO_ROOT}"
|
|
|
|
status=0
|
|
|
|
run_strict() { # label cmd...
|
|
local label="$1"
|
|
shift
|
|
local err rc=0
|
|
err="$("$@" 2>&1 1>/dev/null)" || rc=$?
|
|
if [[ ${rc} -ne 0 || -n "${err}" ]]; then
|
|
if [[ -n "${err}" ]]; then
|
|
printf '%s\n' "${err}" >&2
|
|
fi
|
|
printf ' FAILED (%s)\n' "${label}" >&2
|
|
status=1
|
|
else
|
|
printf ' OK (%s)\n' "${label}"
|
|
fi
|
|
}
|
|
|
|
echo ">>> debian/changelog"
|
|
if command -v dpkg-parsechangelog >/dev/null 2>&1; then
|
|
run_strict "dpkg-parsechangelog --all" \
|
|
dpkg-parsechangelog --all -l packaging/debian/changelog
|
|
else
|
|
echo " SKIP: dpkg-parsechangelog not installed (Debian dpkg-dev)"
|
|
fi
|
|
|
|
echo ">>> fedora/infinito-nexus.spec"
|
|
if command -v rpmspec >/dev/null 2>&1; then
|
|
run_strict "rpmspec --parse" \
|
|
rpmspec -P packaging/fedora/infinito-nexus.spec
|
|
else
|
|
echo " SKIP: rpmspec not installed (rpm)"
|
|
fi
|
|
|
|
echo ">>> arch/PKGBUILD"
|
|
run_strict "bash -n syntax" bash -n packaging/arch/PKGBUILD
|
|
if command -v namcap >/dev/null 2>&1; then
|
|
echo " namcap report (informational):"
|
|
namcap packaging/arch/PKGBUILD || true # exit code unreliable → not gating
|
|
else
|
|
echo " SKIP: namcap not installed (informational PKGBUILD lint)"
|
|
fi
|
|
|
|
exit "${status}"
|