Enable apt repository for overlay packages
Metadata
Current evaluation
Overlay packages can now install from repositories declared in package-repositories; fixed by merged PR canonical/rockcraft#278 in commit f8cd8b90.
Resolution: closed resolved
Reason: Maintainer @tigarmo identified PR #278 as the fix. It was merged as commit f8cd8b90 and enables overlay-packages to use repositories declared in package-repositories.
Evaluated by: mr-cal-bot
No scores available.
Issue body
## Use case
Install packages from a PPA while having its maintainerscripts executed
## Context
Using stage-packages directive I was able to do the following (minimal reproduction):
```yaml
name: keystone
summary: Openstack Keystone
license: Apache-2.0
description: |
Ubuntu distribution of OpenStack Keystone
version: antelope
base: ubuntu:22.04
platforms:
amd64:
parts:
cloud-archive:
plugin: nil
build-packages:
- software-properties-common
override-pull: |
add-apt-repository cloud-archive:antelope
apt update
craftctl default
keystone:
after: [cloud-archive]
plugin: nil
stage-packages:
- keystone
```
Looking to the LXC build container, I have:
```bash
root@rockcraft-my-rock-name-52836265:~# find . -name "keystone*.deb"
./.cache/rockcraft/download/keystone-common_22.0.0+git2023011009.7d4047cb-0ubuntu1~cloud0_all.deb
./.cache/rockcraft/download/keystone_22.0.0+git2023011009.7d4047cb-0ubuntu1~cloud0_all.deb
./parts/keystone/stage_packages/keystone-common_22.0.0+git2023011009.7d4047cb-0ubuntu1~cloud0_all.deb
./parts/keystone/stage_packages/keystone_22.0.0+git2023011009.7d4047cb-0ubuntu1~cloud0_all.deb
```
These are the right version.
Trying the same with overlay step:
```diff
diff repro-stage/rockcraft.yaml repro-overlay/rockcraft.yaml
25c25
< stage-packages:
---
> overlay-packages:
```
Inside the LXC build container, I have:
```
root@rockcraft-my-rock-name-52836265:~# find . -name "keystone*.deb"
./overlay/packages/var/cache/apt/archives/partial/keystone-common_2%3a21.0.0-0ubuntu1_all.deb
./overlay/packages/var/cache/apt/archives/partial/keystone_2%3a21.0.0-0ubuntu1_all.deb
./overlay/packages/var/cache/apt/archives/keystone_2%3a21.0.0-0ubuntu1_all.deb
./overlay/packages/var/cache/apt/archives/keystone-common_2%3a21.0.0-0ubuntu1_all.deb
```
These are the distro versions you get from Jammy naturally.
From what I understand, what I do in `override-pull` updates the sources on the LXC container. When downloading packages in pull step for `overlay-packages`, the command is chrooted in the overlay and therefore does not have the modification in the sources.
Is there an easy way to modify the sources and have the cache updated in the overlay layer ?
## Modifying the overlay directly
<details>
<summary>very wrong way</summary>
```yaml
name: keystone
summary: Openstack Keystone
license: Apache-2.0
description: |
Ubuntu distribution of OpenStack Keystone
version: antelope
base: ubuntu:22.04
platforms:
amd64:
parts:
cloud-archive:
plugin: nil
overlay-packages:
- software-properties-common
overlay-script: |
mount /etc/resolv.conf $CRAFT_OVERLAY/etc/resolv.conf --bind
mount proc $CRAFT_OVERLAY/proc -t proc
mount sysfs $CRAFT_OVERLAY/sys -t sysfs
mount /dev $CRAFT_OVERLAY/dev --rbind --make-private
chroot $CRAFT_OVERLAY stat /dev/null
chroot $CRAFT_OVERLAY add-apt-repository cloud-archive:antelope
chroot $CRAFT_OVERLAY apt update
chroot $CRAFT_OVERLAY bash -c "DEBIAN_FRONTEND=noninteractive apt install apache2 keystone --yes"
umount --recursive $CRAFT_OVERLAY/dev
umount $CRAFT_OVERLAY/sys
umount $CRAFT_OVERLAY/proc
umount $CRAFT_OVERLAY/etc/resolv.conf
```
</details>
## Question
What's the expected way to enable a PPA inside an overlay layer ?
Is there a way from `override-pull` to modify apt sources lists meaningfully ?
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Overlay packages can now install from repositories declared in package-repositories; fixed by merged PR canonical/rockcraft#278 in commit f8cd8b90. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by canonical/rockcraft#278 (commit f8cd8b90), allowing overlay-packages to install from repositories declared in package-repositories. | |
| stealth/space-bunny-alpha | — | closed resolved | Overlay packages can now use repositories declared in package-repositories. canonical/rockcraft#278 was merged as f8cd8b90, providing the requested fix. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed by PR #278. Added support for package repositories in overlay layers, enabling apt source modifications during the overlay package installation step. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed by PR #278. Added support for configuring apt repositories within overlay layers, enabling PPA and cloud archive installation with maintainer script execution during the overlay stage. | |
| qwen/qwen3.6-35b-a3b | — | — | Resolved by PR #278, which implements package repository support for overlay layers, enabling apt source modifications for overlay-packages. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed by PR #278. Added support for package repositories in overlay layers, enabling PPAs and cloud archives to be properly configured during overlay package installation. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/rockcraft#278
(confidence 100%)
Merged PR implementing repository support for overlay packages in commit f8cd8b90.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #278 parts: install package repositories in overlays | rockcraft | merged | Merged as f8cd8b90, enabling overlay-packages to install packages from repositories declared in package-repositories. | |
| #216 repo: add support for package repositories | rockcraft | closed | Package-repository support was superseded by canonical/rockcraft#217, merged to main as 2b416602 and resolving CRAFT-1553. |