Skip to content

apk: feed installation from an abstract PackageContents - #2441

Merged
mattmoor merged 1 commit into
chainguard-dev:mainfrom
mattmoor:package-contents-seam
Aug 31, 2026
Merged

apk: feed installation from an abstract PackageContents#2441
mattmoor merged 1 commit into
chainguard-dev:mainfrom
mattmoor:package-contents-seam

Conversation

@mattmoor

Copy link
Copy Markdown
Member

Installation consumed *expandapk.APKExpanded concretely, coupling it to the expanded-APK carrier even though the lazy install path only needs the ordered install records and a filesystem to open their content. Introduce PackageContents as the per-package installation input, adapt the expanded APK to it, and generalize installPackage/lazilyInstallAPKFiles over it.

The control-shaped surface is one method: ControlSection returns the compressed control segment exactly as distributed, and installation derives everything from those bytes — their SHA1 is the package checksum apk records (by definition), and script/trigger extraction reads the decompressed stream. Carriers therefore cannot disagree with themselves about the checksum of the control data they present.

InstallPackageContents installs exactly a caller-supplied, pre-settled package list from its contents — no index, no resolution, no fetch — and build.WithPreResolvedPackages exposes that to image builds, alongside the existing lockfile path. Downstream callers can then carry package contents in forms of their own choosing without apko learning those forms.

Comment thread pkg/build/options.go Outdated
@mattmoor
mattmoor force-pushed the package-contents-seam branch from 2b78b61 to fd36347 Compare August 31, 2026 14:00
@mattmoor
mattmoor enabled auto-merge (squash) August 31, 2026 14:40
Installation consumed *expandapk.APKExpanded concretely, coupling it to
the expanded-APK carrier even though the lazy install path only needs the
ordered install records and a filesystem to open their content. Introduce
PackageContents as the per-package installation input, adapt the expanded
APK to it, and generalize installPackage/lazilyInstallAPKFiles over it.

The control-shaped surface is one method: ControlSection returns the
compressed control segment exactly as distributed, and installation
derives everything from those bytes — script/trigger extraction reads
the decompressed stream, and the segment's SHA1 is the package checksum
apk records (by definition). Carriers therefore cannot disagree with
themselves about the checksum of the control data they present.

Behavior-preserving: the expanded APK is the only carrier, wrapped at
the existing call sites.
@mattmoor
mattmoor force-pushed the package-contents-seam branch from fd36347 to c97459e Compare August 31, 2026 15:43
@mattmoor
mattmoor merged commit 440957e into chainguard-dev:main Aug 31, 2026
32 of 35 checks passed
@mattmoor
mattmoor deleted the package-contents-seam branch August 31, 2026 16:02
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.

2 participants