Skip to content

feat: xbps packager support#1061

Open
actx4gh wants to merge 19 commits intogoreleaser:mainfrom
actx4gh:actx4gh/xbps-packager-pr1
Open

feat: xbps packager support#1061
actx4gh wants to merge 19 commits intogoreleaser:mainfrom
actx4gh:actx4gh/xbps-packager-pr1

Conversation

@actx4gh
Copy link
Copy Markdown

@actx4gh actx4gh commented Mar 28, 2026

xbps packager support

Resolves #718

What this adds

Native XBPS package generation for Void Linux.
Packages are zstd-compressed tarballs containing props.plist, files.plist,
lifecycle scripts (INSTALL/REMOVE), and content entries, matching the
format consumed by xbps-rindex, xbps-install, and related tools.

Supported features

  • Architecture mapping (amd64, arm64, arm6, arm7, 386, noarch, plus explicit xbps.arch override)
  • Dependencies (run_depends), conflicts, provides, replaces, reverts
  • Config files (all config variants recorded in conf_files metadata)
  • Lifecycle scripts (pre/post install/remove wrapped into XBPS INSTALL/REMOVE dispatch)
  • Alternatives (xbps.alternatives)
  • Preserve mode (xbps.preserve)
  • Tags (xbps.tags)
  • Short and long descriptions
  • Environment variable expansion for all XBPS-specific fields

How scripts work

XBPS uses a single INSTALL script called with positional args ($1 = pre/post,
$4 = yes/no for update). nfpm's four separate script hooks are wrapped into
this dispatch via heredoc extraction to a temp directory and a case block.
Same approach for REMOVE.

Testing

  • Unit tests in xbps/xbps_test.go covering naming, metadata, plist serialization,
    script rendering, and error paths
  • Docker-based acceptance tests on ghcr.io/void-linux/void-glibc-full:
    • lifecycle: install, query, reconfigure, remove (with config preservation)
    • upgrade: v1 to v2 with script semantic args and metadata assertions
    • preserve: package-level preserve flag across upgrades
    • metadata: noarch mapping and alternatives wiring
  • Taskfile smoke test for local build + install + query loop

Scope and known limitations

  • CI matrix tests x86_64 only. Arch mapping covers other targets but they
    are not exercised in acceptance tests yet.
  • No package signing support (XBPS repos can use unsigned local repos, which
    is what the acceptance tests do).

Changes to shared code

  • nfpm.go: Added XBPS struct, hasAnyArch() replacing inline arch check
    (now correctly considers all packager-specific arch overrides, not just deb/rpm/apk)
  • acceptance_test.go: Extracted acceptWithOldPackage() and acceptPackageTarget()
    helpers to share upgrade-test scaffolding across formats, added NoCache to
    dockerParams, explicit f.Close() before docker build (fixes potential flush race)
  • schema.json: Regenerated via go run ./cmd/nfpm/ schema -o ./www/static/schema.json.
    The indentation change is from the generation tool; XBPS additions are the only semantic diff.

actx4gh added 13 commits March 24, 2026 19:44
Register a native XBPS packager, add the packager-specific
config model, and implement naming, metadata, archive writing,
and unit coverage for the initial format support.

Closes goreleaser#718
Document the new xbps block, add quick start and arch mapping
coverage, refresh command docs, and regenerate the public
schema.

See goreleaser#718
Correct the native writer and acceptance fixtures so install,
remove, and metadata behavior match the tested Void lifecycle.

See goreleaser#718
Allow format-specific arch overrides to satisfy validation so
xbps can use its own normalized values without tripping generic
checks.

See goreleaser#718
Harden the acceptance flow and container setup so the Void-based
install, upgrade, reconfigure, and removal checks run reliably.

See goreleaser#718
Add upgrade and preserve fixtures and tighten the Void
assertions around file state across package replacement
scenarios.

See goreleaser#718
Cover metadata ordering, config-file variants, noarch naming,
and archive entry behavior to keep the native writer
deterministic.

See goreleaser#718
Assert the reconfigure path more directly and check props.plist
details that should remain stable across the acceptance flow.

See goreleaser#718
Add noarch and alternatives acceptance coverage and accept the
normalized noarch arch mapping in the native packager tests.

See goreleaser#718
Show the xbps settings in the generated example config so users
can discover the new format and its primary packager options.

See goreleaser#718
Refine the README and docs wording so the support statement
matches the current scope and primary Void Linux validation
target.

See goreleaser#718
Expose XBPS in the upstream build matrix and surface it on the
project landing pages so the supported format list stays
aligned.

See goreleaser#718
Extend the local smoke path to build, install, and query XBPS
packages so contributors can exercise the format in the normal
loop.

See goreleaser#718
@pull-request-size pull-request-size bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Mar 28, 2026
Wrap the Void Linux docker command in a folded block scalar
so the colon-space in the grep pattern is not parsed as a
YAML mapping key, which caused task to reject the Taskfile.

See goreleaser#718
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 28, 2026

Codecov Report

❌ Patch coverage is 81.87135% with 93 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.87%. Comparing base (295b178) to head (48987e5).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
xbps/xbps.go 81.67% 50 Missing and 40 partials ⚠️
internal/cmd/root.go 0.00% 2 Missing ⚠️
cmd/nfpm/main.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1061      +/-   ##
==========================================
+ Coverage   73.50%   74.87%   +1.36%     
==========================================
  Files          23       24       +1     
  Lines        2767     3276     +509     
==========================================
+ Hits         2034     2453     +419     
- Misses        510      560      +50     
- Partials      223      263      +40     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

actx4gh and others added 5 commits March 29, 2026 08:56
Wrap the Void Linux smoke command in a folded block scalar
so the colon-space in the grep pattern is not parsed as a
YAML mapping key.  Sync remote repos before install so
dependencies declared in the test fixture resolve.  Skip
xbps in TestCore since it uses dedicated stages covered by
TestXBPSAcceptance.

See goreleaser#718
Wrap the tar writer in a zstd compressor so generated packages
match the compression format used by Void Linux repositories.
Reject non-integer release values early with a clear error
instead of silently defaulting to revision 1. Update the
acceptance dockerfile tar commands for zstd and regenerate
schema.json.

See goreleaser#718
Remove unused mutable parameter from fileEntry to satisfy the
unparam linter. Normalize bare dependency names to XBPS-required
format by appending >=0 (e.g. "bash" becomes "bash>=0"). Install
zstd in Void Linux dockerfile stages so tar --zstd can extract
plists for verification. Rename the package to its conventional
filename in the Taskfile install step so xbps-install can locate
it during checksum verification.
@actx4gh actx4gh changed the title xbps packager support feat: xbps packager support Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support xbps packages

1 participant