Add --extra-repo-priority for APT pinning + regression test - #50
Conversation
51b0b14 to
97417d7
Compare
|
Verified build of gst-plugins-good1.0 which depends on gst-plugins-base1.0. When --extra-repository-priority is set, CLO version got picked up. |
Loïc Minier (lool)
left a comment
There was a problem hiding this comment.
I see the PR has:
- main implementation commit => I'll review the approach here
- docs/tests updates => skipping this for now
- bug fixes to earlier commits => please squash into the earlier commits
The main implementation currently generates an APT preference file with a particular priority during the docker pkg build, based on the hostname passed as an URL in an earlier extra-repo flag. I believe this is to support builds where CLO archive is in sources and is preferred over Debian. The flags of docker_deb_build are based on sbuild's flags, but since sbuild doesn't provide such an APT preference flag, a --chroot-setup-commands flag is used instead.
The high-level strategy is ok, things I am not comfortable with:
-
what happens if someone passes multiple extra-repository flags with different hostnames (I don't even know if sbuild supports that)
-
how do we ensure people using this get the same behavior, e.g. how do we convey the set of flags to use for this or that typical build environment? It's fine to provide a low-level tool for people to do what they want, we also want a high-level tool that will ensure that different people build the packages in the same way. Perhaps this is more for qcom-build-utils / qli-ci, I'm not sure, but is there a place where we would define build environments profiles? Perhaps something like:
- ubuntu: build against latest Ubuntu stronking (or other suites, or Debian etc.)
- qli: build against Debian trixie + QLI APT repo
- clo: build against Debian trixie + QLI APT repo + CLO APT repo
- hostnames will work to pin the repo, there are often other interesting properties in the Release file to use for APT preferences, so:
a) are there other properties that could be used for the CLO repo?
b) how do we pass other APT preferences data or other configs? would it make more sense to simply channel sbuild's flags such as --chroot-setup-commands in the low-level wrapper?
8870664 to
5f7d2d2
Compare
|
Thanks for the thorough review!
On the passthrough idea (3b): open to adding a raw |
So now the implementation will setup an APT pin for each extra-repo, but what if I specify two times the same host in two separate extra-repo (e.g. APT repo qli + qli-staging on artifactory) but with two priorities? which APT preferences will win, since the only criteria is the hostname? Also, this relies on documentation + user behaving properly, there's no enforcement to have as many --extra-repo as --extra-repo-priority.
Sure, as long as there's a clear way to implement this for tech teams that need the CI setup right.
You can also pin on suite, which I hope Artifactory would set? CLO is on a separate artifactory instance, I believe at https://artifacts.codelinaro.org/
So I'm looking at this from a distance. IIUC, this is the low-level part of the package builds for Ubuntu CI and devcompute use cases. For end-developers, we want this to be flexible (hence the idea of expanding here), and there I think we want to channel the flexibility of sbuild, with perhaps some sensible defaults for us. Kind of a qcom-docker-sbuild-for-pkg-builds. For CI, we want rigorous definition for reproducibility. Since this PR is patching the low-level tool and not about the high-level, and since the wrapper already channels a number of sbuild options, perhaps you want to channel some more, or all of sbuild? BTW sbuild already does "build in containers" in some way, perhaps we could even get rid of the docker side of things, not sure of the use cases we're trying to cover. |
|
Good pushback, and it made me actually test something instead of assuming.
But your same-host scenario (qli + qli-staging on one Artifactory instance) exposed a real bug, and it's worse than "undefined": I set up two preference stanzas pinning the same origin at different priorities, and APT doesn't take the higher priority or the latest one - it takes whichever stanza it registers first (filename order in preferences.d) and silently ignores the other. So one of the two priorities a user asked for just gets dropped, with no warning, and the outcome depends on file ordering rather than intent. That's a real gap in hostname-only pinning, not a corner case worth hand-waving away.
On why Docker at all, given sbuild already isolates via unshare: the containers get built once and pushed to GHCR specifically so PR builds for the Ubuntu suites can |
A long while ago, I was running debootstrap as part of qcom-deb-images CI and it was running in about 30s on GH runners; I guess it might take a couple of minutes to setup a debian docker container with sbuild and an sbuild chroot in it, which compared to the duration of the build might or might be a big deal, don't know. |
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>
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>
5f7d2d2 to
f87ee2d
Compare
|
I just tackled the issue above about same host + conflicting priorities. Now it errors out immediately with a clear message, instead of silently picking whichever preferences file APT happens to read first. To be clear, this closes the silent failure, not the underlying limitation. You still can't pin qli and qli-staging differently; it'll just refuse loudly instead of guessing. I didn't try to smarten the matching (suite/Origin) since neither turned out reliably distinctive enough to trust. Real scenario needs to be addressed separately in the new issue I linked |
Loïc Minier (lool)
left a comment
There was a problem hiding this comment.
I've only reviewed the code and doc changes, not the tests, I assume they were generated by the same LLM as the code
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, sincesbuildhas 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 syntheticlibqcomdummy-devpackage, 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 intocontainer-build-and-upload.ymlas a job that runs afterbuild-deb-arm64.Also moves the existing
dummy-packageCI fixture from.github/dummy-package/totest/dummy-package/, keeping.github/limited to GitHub-special content, alongside the newtest/pinning/fixture.Related Issue
Fixes #48