Skip to content

fix: parse and write replaces_priority in the installed apk db - #2497

Open
lyoung-confluent wants to merge 1 commit into
chainguard-dev:mainfrom
lyoung-confluent:claude/apko-replaces-priority-field-7d38e3
Open

lyoung-confluent wants to merge 1 commit into
chainguard-dev:mainfrom
lyoung-confluent:claude/apko-replaces-priority-field-7d38e3

Conversation

@lyoung-confluent

Copy link
Copy Markdown
Contributor

types.PackageInfo/types.Package had no field for a package's replaces_priority, so the value from .PKGINFO was silently dropped and never written to /lib/apk/db/installed (no q: line), unlike upstream apk-tools.

Adds ReplacesPriority to both structs and plumbs it through parsing (.PKGINFOParsePackage) and writing (PackageToInstalled), mirroring how ProviderPriority/k: already works. The q: line is only written when non-zero, matching apk-tools' database.c.

Testing: added round-trip coverage in installed_test.go (write → parse) for both the zero case (no q: line) and non-zero case.

types.PackageInfo/types.Package had no field for a package's
replaces_priority, so the value from .PKGINFO was silently dropped and
never written to /lib/apk/db/installed (no q: line), unlike upstream
apk-tools. Add ReplacesPriority and plumb it through parsing and
writing, mirroring ProviderPriority, and guard the new q: line to only
write when non-zero (matching apk-tools' database.c).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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