Skip to content

refactor: take the apk, deb, pacman and rpm formats from github.com/M0Rf30/pkgformat - #464

Merged
M0Rf30 merged 8 commits into
mainfrom
feat/pkgformat
Nov 10, 2026
Merged

M0Rf30 merged 8 commits into
mainfrom
feat/pkgformat

Conversation

@M0Rf30

@M0Rf30 M0Rf30 commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

Replaces the in-tree format code with github.com/M0Rf30/pkgformat v0.1.0, an Apache-2.0 library that yap uses too. openartifact keeps the HTTP handlers, storage, database and key management.

Includes the RPM v6 signing work from #463, which this PR supersedes.

Replaced

openartifact now
pkg/xzlimit, pkg/gpg pkgformat/xzlimit, pkgformat/gpg; the repo-level Resolver moves to internal/gpgresolver
pkg/apk (+ apktest) pkgformat/apk, signing explicitly SigRSASHA256; test builder in internal/apktestutil
pkg/pacman pkgformat/pacman
pkg/deb, generic internal/format/deb pkgformat/deb; internal/format/deb/entry.go converts stored control fields
pkg/rpm, pkg/rpmsign, generic internal/format/rpm pkgformat/rpm (ReadPackage, Sign) and rpm/repodata; the rpm_packages.extra JSON lives in internal/rpmextra

Dependency go-rpmutils is removed. Net: 269 files, about −19k lines.

Output compared before and after, on the existing fixtures

  • apk: APKINDEX byte-identical, using stdlib gzip as before.
  • pacman: sync db byte-identical.
  • deb: Packages and stored rows are identical. Packages.gz differs only in gzip bytes (header mtime 0); the decompressed content is identical. The Release file list is sorted by path, and ParseRelease now rejects non-hex digests and contradicting sizes.
  • rpm: filelists, other and repomd are identical. primary.xml now lists primary <file> entries the way createrepo_c does. Rows stored before this change have no mode or flags, so their files render as plain files (no backfill). epoch="0" is omitted, and modules.yaml.gz uses the default gzip level.
  • New rpm_packages.extra rows use lower-case JSON keys; existing rows still decode.

Checks

  • make lint: 0 issues. reuse lint: compliant. go vet -tags=integration ./...: pass.
  • go test -short -p 1 ./...: pass.
  • Integration (-tags=integration, throwaway postgres) for database, worker, api, tests and tests/integration: worker and api pass. Seven unrelated failures need infrastructure that wasn't available: six S3 tests (no S3 endpoint) and TestVulnScanOverviewUsesIndexes (postgres shared memory).

Switch github.com/sassoftware/go-rpmutils to the github.com/M0Rf30/go-rpmutils
fork. Upstream SignRpmStream wrote v4 signatures (RSA header + PGP
header+payload, tags illegal in a v6 signature header) into format-6
packages built by rpm 6; the fork signs them like rpmsign 6 with an OPENPGP
header signature and keeps the RESERVED tag and signature-header size.
It also verifies v6 packages (payload digests without PAYLOADDIGESTALGO,
OPENPGP signatures) and reads stripped cpio payloads correctly.

Tests cover a format-6 fixture built by rpm 6.0.1 and cross-check with
rpm -K when rpm 6 is installed.
…format

Delete pkg/rpm, pkg/rpmsign and the generic internal/format/rpm code. The
extra JSON of rpm_packages now lives in internal/rpmextra; fixtures moved to
testdata/rpm; test rpms are built with pkgformat/rpm/pack. Update the docs.
Drop the local replace. Render deb control fields for the manifest through
deb.ControlFile.String: the library returns logical values, and printing them
raw split continuation lines into bogus fields (Depends lost zlib1g). Point
the rpm fixture paths at testdata/rpm.
The deadcode gate exempts test-support packages named *test; the helper is
only imported from tests.
@github-actions

Copy link
Copy Markdown

Coverage

Coverage vs main
Go, unit + integration 83.1% -0.3
Go, unit tests only 69.4% -0.7
Go, integration tests only 53.4% -0.5
Web, lines 91.8% ±0.0
Web, functions 85.8% ±0.0
Go by area
Area Coverage vs main
cmd/docgen 80.3% ±0.0
cmd/genformats 90.8% ±0.0
cmd/oa 0.0% ±0.0
cmd/resetpw 0.0% ±0.0
cmd/server 70.2% ±0.0
internal/ai 85.6% ±0.0
internal/api 77.0% ±0.0
internal/apkkeys 77.1% ±0.0
internal/apktest 90.7% new
internal/artifactpath 100.0% ±0.0
internal/attest 84.0% ±0.0
internal/attestation 79.2% ±0.0
internal/audit 97.6% ±0.0
internal/auth 91.6% ±0.0
internal/backup 72.4% ±0.0
internal/bgtask 96.8% ±0.0
internal/blockreason 100.0% ±0.0
internal/branding 93.5% ±0.0
internal/bundlechecks 100.0% ±0.0
internal/clientsetup 93.6% ±0.0
internal/config 96.4% ±0.0
internal/cron 90.0% ±0.0
internal/crypto 91.0% ±0.0
internal/csaf 85.0% ±0.0
internal/curation 99.0% ±0.0
internal/database 76.1% +0.1
internal/declarative 84.1% ±0.0
internal/dtrack 85.3% ±0.0
internal/exploit 94.1% +0.5
internal/federation 81.6% -0.3
internal/format 80.2% -1.0
internal/formats 88.0% ±0.0
internal/gpgkeys 87.1% ±0.0
internal/group 89.5% ±0.0
internal/httpcache 100.0% ±0.0
internal/httpcompress 93.3% ±0.0
internal/httpx 85.7% ±0.0
internal/imagesbom 81.9% ±0.0
internal/importmeta 93.3% ±0.0
internal/iocopy 100.0% ±0.0
internal/itempath 98.3% ±0.0
internal/lazyre 100.0% ±0.0
internal/license 98.5% ±0.0
internal/licensemeta 87.5% ±0.0
internal/licensepolicy 92.6% ±0.0
internal/limitio 92.9% ±0.0
internal/mcp 89.8% ±0.0
internal/metrics 96.2% ±0.0
internal/middleware 94.6% ±0.0
internal/netutil 93.4% ±0.0
internal/nixkeys 79.6% ±0.0
internal/oacli 85.0% ±0.0
internal/ocimanifest 100.0% ±0.0
internal/ocipath 100.0% ±0.0
internal/ociref 96.8% ±0.0
internal/osv 89.8% ±0.0
internal/passwd 93.3% ±0.0
internal/pathseg 100.0% ±0.0
internal/pglock 79.0% ±0.0
internal/pkgdeps 88.1% ±0.0
internal/presign 99.2% ±0.0
internal/promote 84.5% ±0.0
internal/proxy 86.7% ±0.0
internal/publicurl 96.8% ±0.0
internal/pypisimple 97.9% ±0.0
internal/quarantine 100.0% ±0.0
internal/quayapi 81.2% ±0.0
internal/quota 92.2% ±0.0
internal/recovery 85.3% +0.3
internal/registry 100.0% ±0.0
internal/replication 78.1% ±0.0
internal/repodispatch 85.1% ±0.0
internal/repotype 97.0% ±0.0
internal/rpmextra 92.9% new
internal/sbom 89.9% ±0.0
internal/scanexport 96.4% ±0.0
internal/search 90.3% ±0.0
internal/secrets 91.4% ±0.0
internal/storage 84.9% ±0.0
internal/telemetry 92.2% ±0.0
internal/tiering 83.5% ±0.0
internal/trash 96.7% ±0.0
internal/urlparams 100.0% ±0.0
internal/vexsync 80.0% ±0.0
internal/vuln 89.9% ±0.0
internal/webhook 86.1% ±0.0
internal/worker 82.6% +0.1
internal/workq 79.5% ±0.0
pkg/ansible 89.8% ±0.0
pkg/cargo 95.6% ±0.0
pkg/compactindex 97.8% ±0.0
pkg/composer 94.5% ±0.0
pkg/conan 99.2% ±0.0
pkg/conda 94.8% ±0.0
pkg/delta 71.4% ±0.0
pkg/gemversion 100.0% ±0.0
pkg/helm 97.0% ±0.0
pkg/logger 96.9% ±0.0
pkg/maven 96.7% ±0.0
pkg/nix 99.1% ±0.0
pkg/npm 88.0% ±0.0
pkg/nuget 97.6% ±0.0
pkg/pyversion 100.0% ±0.0
pkg/rubymarshal 87.1% ±0.0
tests/integration 78.8% ±0.0
web 93.7% ±0.0
Web by area (lines)
Area Coverage vs main
src 85.1% ±0.0
src/api 92.1% ±0.0
src/components 90.4% ±0.0
src/composables 89.7% ±0.0
src/demo 93.3% ±0.0
src/i18n 98.5% ±0.0
src/lib 99.2% ±0.0
src/pages 92.1% ±0.0
src/pwa 97.6% ±0.0
src/router 98.6% ±0.0
src/stores 99.0% ±0.0
src/telemetry 90.9% ±0.0

Full report (HTML, merged profile) in the CI run artifacts

@M0Rf30
M0Rf30 merged commit d01e9c7 into main Nov 10, 2026
25 checks passed
@M0Rf30
M0Rf30 deleted the feat/pkgformat branch November 10, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant