Skip to content

Add --extra-repo-priority for APT pinning + regression test - #50

Open
Simon Beaudoin (simonbeaudoin0935) wants to merge 6 commits into
mainfrom
fix/extra-repo-priority-pinning-48
Open

Add --extra-repo-priority for APT pinning + regression test#50
Simon Beaudoin (simonbeaudoin0935) wants to merge 6 commits into
mainfrom
fix/extra-repo-priority-pinning-48

Conversation

@simonbeaudoin0935

@simonbeaudoin0935 Simon Beaudoin (simonbeaudoin0935) commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Adds --extra-repo-priority, paired positionally with --extra-repo, to let a repo win APT dependency resolution even when a different source offers a higher version number. Implemented by writing an APT preferences file into the sbuild chroot (pinned by origin/hostname) via --chroot-setup-commands, since sbuild has no built-in pinning option.

Also adds a real regression test (test/pinning/) reproducing the actual bug: two throwaway containers each serve a conflicting version of a synthetic libqcomdummy-dev package, and a fixture source package fails to build unless the intended version resolves. The test runs the build twice - once unpinned (expected to fail, proving the bug) and once with --extra-repo-priority (expected to succeed, proving the fix) - wired into container-build-and-upload.yml as a job that runs after build-deb-arm64.

Also moves the existing dummy-package CI fixture from .github/dummy-package/ to test/dummy-package/, keeping .github/ limited to GitHub-special content, alongside the new test/pinning/ fixture.

Related Issue
Fixes #48

Downstream-patched packages published via --extra-repo lose to a newer
upstream security release once its version number overtakes the +qcomN
suffix, since APT/aptitude always prefers the highest version among
equal-priority candidates. Pin each --extra-repo to its own APT
Pin-Priority (by origin/hostname) via sbuild's --chroot-setup-commands,
so a repo can be preferred even when its package version is lower.

Fixes #48

Signed-off-by: Simon Beaudoin <sbeaudoi@qti.qualcomm.com>
Add a README usage example and an AGENTS.md common-command entry for
the new --extra-repo-priority flag, so the pairing convention with
--extra-repo is discoverable without reading --help.

Signed-off-by: Simon Beaudoin <sbeaudoi@qti.qualcomm.com>
.github/ should only hold GitHub-special content (workflows, issue
templates, dependabot config). Move the CI dummy-package fixture to a
top-level test/ directory, where upcoming testing logic will also
live, and update the one workflow step that references its path.

Signed-off-by: Simon Beaudoin <sbeaudoi@qti.qualcomm.com>
Comment thread .github/workflows/container-build-and-upload.yml Fixed
Add test/pinning/: a source package that Build-Depends on a synthetic
libqcomdummy-dev and fails unless the resolved version matches the
hardcoded "patched" one, plus run-pinning-test.sh, which publishes two
conflicting versions of that library via two throwaway repo containers
(so each gets its own address on the default bridge network - APT's
origin pin matches by hostname only and ignores port, so same-host
repos on different ports can't be told apart by the mechanism
--extra-repo-priority uses) and runs the build twice: once unpinned
(expected to fail, reproducing the bug) and once pinned (expected to
succeed, verifying the fix). Wire it into the existing
container-build-and-upload.yml as a job depending on build-deb-arm64.

Verified end-to-end in a local sandbox with Docker + an arm64 host:
both the unpinned failure and the pinned success reproduce exactly as
designed.

Signed-off-by: Simon Beaudoin <sbeaudoi@qti.qualcomm.com>
@simonbeaudoin0935
Simon Beaudoin (simonbeaudoin0935) marked this pull request as ready for review September 9, 2026 17:52
@simonbeaudoin0935 Simon Beaudoin (simonbeaudoin0935) changed the title WIP: Add --extra-repo-priority for APT pinning + regression test Add --extra-repo-priority for APT pinning + regression test Sep 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There are a few correctness/reliability issues in the new CI fixtures/workflow (future-dated changelog timestamp, potentially flaky container readiness, and inconsistent checkout action versions) that should be fixed before merging.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds an APT pinning capability to docker_deb_build.py via a new --extra-repo-priority option (positionally paired with --extra-repo) and introduces a regression test that reproduces and validates the fix for issue #48.

Changes:

  • Add --extra-repo-priority CLI option and generate APT preferences in the sbuild chroot to pin packages by repo origin hostname.
  • Add an end-to-end regression test (test/pinning/) that demonstrates failure without pinning and success with pinning.
  • Move the CI dummy package fixture into test/dummy-package/ and wire the new pinning test into the CI workflow.
File summaries
File Description
docker_deb_build.py Adds --extra-repo-priority parsing/validation and generates chroot setup commands to write APT pin preferences.
README.md Documents how to use --extra-repo-priority for APT pinning.
AGENTS.md Updates agent docs with a pinning usage example.
.github/workflows/container-build-and-upload.yml Points dummy-package validation at test/dummy-package/ and adds a new pinning regression-test job.
test/pinning/run-pinning-test.sh New end-to-end regression test that serves two conflicting repos and validates pinning behavior.
test/pinning/package/debian/control New fixture source package that Build-Depends on the synthetic pinned dependency.
test/pinning/package/debian/rules Asserts the resolved libqcomdummy-dev version matches the expected pinned version.
test/pinning/package/debian/changelog New package changelog for the pinning fixture.
test/pinning/package/debian/copyright License header for the pinning fixture package.
test/pinning/package/debian/source/format Declares the pinning fixture as a native source package.
test/dummy-package/README.md Relocated dummy-package fixture documentation under test/.
test/dummy-package/dummy.txt Dummy payload installed by the CI dummy package.
test/dummy-package/debian/source/format Declares the dummy package as a native source package.
test/dummy-package/debian/rules Minimal dh-based rules for the dummy package fixture.
test/dummy-package/debian/install Installs dummy payload into the package image.
test/dummy-package/debian/control Package metadata for the CI dummy package fixture.
test/dummy-package/debian/changelog Changelog for the CI dummy package fixture.
test/dummy-package/debian/copyright License header for the dummy package fixture.
Review details
  • Files reviewed: 10/18 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/pinning/run-pinning-test.sh
Comment thread docker_deb_build.py Outdated
Comment thread docker_deb_build.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Simon Beaudoin <sbeaudoi@qti.qualcomm.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Simon Beaudoin <sbeaudoi@qti.qualcomm.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.

Provide APT pinning option along with extra-repo

3 participants