package repository advance grammar support
Metadata
Current evaluation
No evaluation has been recorded for this issue yet.
Issue body
### Bug Description
Support for package repositories unlocked possibilities with cross-building, however side effect of this is that native build suffers from unnecessary inclusion of the source packages as those are already unlocked by the host arch.
https://pastebin.ubuntu.com/p/kHDpx9d77Y/
A proposed solution would be to support of the advance grammar for `package-repositories`.
### To Reproduce
Add the following stanza to the `snapcraft.yaml` and run a native build on the arm64 host.
```
package-repositories:
- type: apt
architectures: [$CRAFT_ARCH_BUILD_FOR]
formats: [deb, deb-src]
components: [main]
suites: [noble, noble-updates, noble-backports]
key-id: F6ECB3762474EDA9D21B7022871920D1991BC93C
url: http://ports.ubuntu.com/ubuntu-ports
```
Once snap build completes, run in the container `$ sudo apt-get update`
The following warnings should be observed:
https://pastebin.ubuntu.com/p/kHDpx9d77Y/
### Environment
Host Ubuntu 24.04
Using LXD backend
### snapcraft.yaml
```yaml
Example project:
https://github.com/kubiko/imx-gadget
```
### Relevant log output
```shell
sudo apt-get update
Hit:1 https://ppa.launchpadcontent.net/snappy-dev/image/ubuntu noble InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports noble InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports noble-updates InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports noble-backports InRelease
Hit:5 http://ports.ubuntu.com/ubuntu-ports noble-security InRelease
Reading package lists... Done
W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Packages (main/binary-arm64/Packages) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target DEP-11 (main/dep11/Components-arm64.yml) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target DEP-11 (main/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target CNF (main/cnf/Commands-arm64) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Packages (main/binary-arm64/Packages) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target DEP-11 (main/dep11/Components-arm64.yml) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target DEP-11 (main/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target CNF (main/cnf/Commands-arm64) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Packages (main/binary-arm64/Packages) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target DEP-11 (main/dep11/Components-arm64.yml) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target DEP-11 (main/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target CNF (main/cnf/Commands-arm64) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Packages (main/binary-arm64/Packages) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target DEP-11 (main/dep11/Components-arm64.yml) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target DEP-11 (main/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target CNF (main/cnf/Commands-arm64) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Packages (main/binary-arm64/Packages) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target DEP-11 (main/dep11/Components-arm64.yml) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target DEP-11 (main/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target CNF (main/cnf/Commands-arm64) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Sources (main/source/Sources) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Packages (main/binary-arm64/Packages) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Packages (main/binary-all/Packages) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target Translations (main/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target DEP-11 (main/dep11/Components-arm64.yml) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target DEP-11 (main/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target CNF (main/cnf/Commands-arm64) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
W: Target CNF (main/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list.d/craft-http_ports_ubuntu_com_ubuntu_ports.sources:1 and /etc/apt/sources.list.d/ubuntu.sources:1
```
### Additional context
_No response_
Evaluation history
No evaluation history available.