Skip to content

Prevent apt lockfiles from containing multiple versions - #252

Open
hartikainen wants to merge 2 commits into
bazel-contrib:mainfrom
hartikainen:hartikainen/apt-single-package-version
Open

hartikainen wants to merge 2 commits into
bazel-contrib:mainfrom
hartikainen:hartikainen/apt-single-package-version

Conversation

@hartikainen

Copy link
Copy Markdown

This is an attempt to solve #251, i.e. to prevent apt lockfiles from containing multiple versions of the same Debian package for one target architecture. Separate root closures can currently select that package from different suites, causing both .deb archives to be included even when one version satisfies both closures.

I expected one selected record for each (Package, target architecture) identity, but observed both noble/libssl3t64:amd64=3.0.13-0ubuntu3 and noble-updates/libssl3t64:amd64=3.0.13-0ubuntu3.9.

The first commit adds a regression test reproducing the duplicate package and stale dependency edge. The second commit indexes packages by name and target architecture while constructing the lock, retains the first selected package, and resolves dependency edges through that same index. The serialized lock key format and Architecture: all expansion remain unchanged.

I tested this in my downstream application and it seems to fix the problem. That said, I'm a newbie here so I'm not sure if this is the right way to handle this.

For transparency: I both investigated this and implement the fix with heavy help from Opus.

Fixes #251.

@hartikainen hartikainen changed the title Prevent apt locfiles from containing multiple versions Prevent apt lockfiles from containing multiple versions Aug 22, 2026
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.

apt lock can contain multiple package versions for one architecture

1 participant