Enable apt repository for overlay packages
Metadata
Current evaluation
Fixed by PR #278. Added support for package repositories in overlay layers, enabling apt source modifications during the overlay package installation step.
Suggested action: —
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 |
|---|---|---|---|---|
| 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed by PR #278. Support for package repositories was added to overlay layers, enabling PPAs and custom apt sources for overlay-packages. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #278 parts: install package repositories in overlays | rockcraft | merged | Merged. Enables overlay-packages to install packages from repositories defined in package-repositories. Approved by three reviewers, the update modifies 11 files with 245 additions and 27 deletions. |