Repository navigation
feeds: enable an add-on feed by name in distro.feeds - #323
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Add-on validation mishandles snapshot URLs, ignores configured CA trust, and can bypass an earlier rejection.
3 open issues
What changed in this PR
Enables projects to select distro-published add-on feeds by name without defining repository URLs.
Changes:
- Expands add-on names into target and SDK repositories in priority order.
- Checks availability before materialization and suggests corrections.
- Adds unit tests and updates configuration documentation.
| File | Description |
|---|---|
| src/utils/feeds.rs | Adds expansion, validation, and unit tests. |
| src/utils/config.rs | Checks add-ons before materializing feeds. |
| schemas/avocado-config.json | Documents add-on names and examples. |
| CHANGELOG.md | Describes the new feed support. |
Review effort: Balanced
There was a problem hiding this comment.
Re-checked at a26ca45. My earlier comment on add-on repos ignoring repo.insecure is addressed: the add-on repos now take tls_verify and ca from the same getters as the distro feed, and a new test asserts both halves resolve to tls_verify == false. The three open Copilot threads are covered too: the targets.json client now honours the configured CA and the insecure setting, the pinned-snapshot check no longer depends on the order of snapshot pinning, and a rejected add-on is re-checked on the next call. No new blocking findings. I did not run the tests. No inline comments on the new commits; a few minor notes were left off.
A name in distro.feeds that repos: does not define is now an add-on the distro feed publishes beside its own repos. It expands to two feeds, the target half at target/<target>-<name> and the SDK half (<name>-sdk) at sdk/<target>-<name>, both off the distro feed's base URL and releasever and both enabled at every stage, so an add-on that later ships SDK tools or cross-compile -dev packages needs no config change. Before the first dnf run the CLI reads the channel's targets.json and refuses an add-on the target does not list, with the nearest published name, what the target does publish, and which other targets carry it. When the index cannot be read the check warns and dnf reports what is missing.
…re the lock From review of the add-on feed change: - An add-on's target half is written only where target dnf reads it (rootfs, extensions, the SDK's target sysroot) and its SDK half only for the SDK host (ResolvedFeed::placement, recorded in the canonical document only when set, so no other feed's document or hash moves). - Both halves carry the distro feed's CA and tls_verify, so a private-CA or insecure distro feed reaches its add-ons too. - The check reads the channel's targets.json, which exists under a snapshot pin, where the releasever's path does not. It requires both halves in the index, uses the distro feed's TLS client, and runs once per target before the canonical document and the lock are written, so a refused add-on never reaches the lock. - A name close to one repos: defines is refused as a typo with a did-you-mean for repos:. `<name>-sdk`, `ext` and `<name>-ext` are refused as add-on names.
The channel's targets.json lists an add-on only while the channel's current snapshot has it, so checking a snapshot-pinned project against it could refuse an add-on the pinned snapshot does have, or pass one it does not. Under a pin, probe the snapshot's target and sdk repodata for each add-on, and use the index only to explain a miss (did-you-mean, where else it is published).
f25ee88 to
a26ca45
Compare

What
A project can enable an add-on feed the distro publishes, such as ROS 2 Jazzy, by name:
An add-on is a set of packages built alongside the base feed and published next to it, never inside it, and it never ships a package name the base feed has. The project names it; the CLI knows where it lives.
How
Resolution (
ResolvedFeedSet::resolve): adistro.feedsname thatrepos:does not define is an add-on. It expands to two feeds off the distro feed's base URL and releasever:<name>→<url>/<release>/<channel>/target/<target>-<name><name>-sdk→<url>/<release>/<channel>/sdk/<target>-<name>Each half goes only where it belongs, matching the distro feed's own baked repos:
This is
ResolvedFeed::placement, which is recorded in the canonical document only when set, so no other feed's document or hash changes. The SDK half exists even while an add-on ships no SDK packages, so host tools can arrive later without a config change. Both halves use the distro feed's base URL and releasever, so they follow a snapshot pin, and its TLS settings (ca,tls_verify,AVOCADO_REPO_CA,AVOCADO_REPO_INSECURE).Ordering is unchanged. An add-on takes its position in
distro.feedsas its dnf priority, like any other feed, and the distro feed stays first unless listed. A full example:This resolves to
acme-private(10), the distro repos (20),ros2-jazzy(30),ros2-jazzy-sdk(40) andvendor-tools(50).A typo fails before dnf runs (
ResolvedFeedSet::check_addons). The check runs once per target, before the canonical document and the lock are written, so a refused add-on never reaches the lock. The CLI reads the channel'stargets.json(machine → repo paths, already published per channel), even under a snapshot pin. An add-on is atarget/<target>-<name>entry, other than the built-in-ext, whosesdk/<target>-<name>is listed too. Under a pin, the CLI also checks that the pinned snapshot has both halves. A requested add-on the target does not publish is refused with:It also lists the other targets that publish the name. When
targets.jsoncannot be read, the check warns and dnf reports whatever is really missing.Mistakes are refused rather than read as add-ons:
repos:defines gets a did-you-mean forrepos:;<name>-sdk,extand<name>-extare not add-on names;repos:entry named<name>-sdknext to an add-on<name>is refused.Schema description and CHANGELOG updated.
The layer side, which builds an add-on as a multiconfig and publishes it, is avocado-linux/meta-avocado#529.
Testing
repos:typos,-sdk,ext,-ext, the-sdkclash);-extexcluded, SDK half required, unpublished target, other targets listed.validation_errorsnow asserts the remaining refusal, an add-on name that cannot be a repo id or path segment, since an undefined name is no longer an error.cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo test: all pass.ros2-jazzyadd-on:feeds: [ros2-jazy]failed with the message above before any dnf run;feeds: [ros2-jazzy]: dnf readros2-jazzyandros2-jazzy-sdk, and the lock pinned the ROS packages toros2-jazzyand the base packages to the distro repo;sdk installwith this build;