Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 56 additions & 31 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ apps:
parts:
kvm-support:
plugin: nil
build-attributes:
- enable-patchelf
stage-packages:
- on amd64:
- msr-tools
Expand Down Expand Up @@ -385,27 +387,21 @@ parts:
-X ${PROJECT}/${PKG_DIR}.buildUser=$BUILD_USER \
-X ${PROJECT}/${PKG_DIR}.buildDate=$BUILD_DATE" \
./cmd/ovs_exporter/*.go
override-prime: |
craftctl default
install -D $SNAPCRAFT_PART_SRC/../build/bin/ovs-exporter bin/ovs-exporter
install -D ./bin/${BINARY} $CRAFT_PART_INSTALL/bin/${BINARY}

qemu:
source: https://git.launchpad.net/ubuntu/+source/qemu
source-type: git
source-branch: ubuntu/resolute-devel
source-depth: 1
plugin: autotools
build-attributes:
- enable-patchelf
stage-packages:
- seabios
- qemu-system-data
- ipxe-qemu
# UEFI Support, required on arm64
- on arm64:
- qemu-efi-aarch64
- qemu-efi-arm
- libspice-server1
- on amd64:
- ovmf
- libspice-server1
- libglut3.12 # provides libglut.so.3
- libnuma1
Expand Down Expand Up @@ -510,6 +506,7 @@ parts:
- --disable-bsd-user
- --disable-xen
- --disable-werror
- --python=/usr/bin/python3
- --prefix=/usr
- --localstatedir=/var/snap/$CRAFT_PROJECT_NAME/common
- --sysconfdir=/var/snap/$CRAFT_PROJECT_NAME/common
Expand All @@ -520,11 +517,21 @@ parts:

# Install keymaps as the qemu build process does not!
install -Dp -m0644 -t $CRAFT_PART_INSTALL/usr/share/qemu/keymaps $(ls -1 $CRAFT_PART_SRC/pc-bios/keymaps/* | fgrep -v /meson.build)
override-prime: |
craftctl default
# execstack is no longer available in Ubuntu 26.04 (removed with prelink).
# Modern toolchains produce binaries with correct PT_GNU_STACK by default,
# so clearing executable stack flags manually is no longer necessary.

# note(gboutry): isolate qemu firmware data to prevent its dependencies to be pulled into the qemu part.
qemu-firmware-data:
after: [qemu]
plugin: nil
stage-packages:
- qemu-system-data
- on amd64:
- seabios
- ovmf
- on arm64:
- qemu-efi-aarch64
stage:
- usr/share
- -usr/share/doc

libvirt:
source: https://git.launchpad.net/ubuntu/+source/libvirt
Expand All @@ -534,6 +541,8 @@ parts:
after:
- qemu
plugin: meson
build-attributes:
- enable-patchelf
build-packages:
- libxml2-dev
- libxml-libxml-perl
Expand Down Expand Up @@ -635,6 +644,7 @@ parts:
- -Dlibdir=/snap/$CRAFT_PROJECT_NAME/current/usr/lib
- -Dincludedir=/snap/$CRAFT_PROJECT_NAME/current/usr/include
- -Dlocalstatedir=/var/snap/$CRAFT_PROJECT_NAME/common
- -Drunstatedir=/var/snap/$CRAFT_PROJECT_NAME/common/run
- -Dsysconfdir=/var/snap/$CRAFT_PROJECT_NAME/common/etc
override-build: |
dpkg-source --before-build $CRAFT_PART_SRC
Expand Down Expand Up @@ -683,20 +693,6 @@ parts:
rm -rf $CRAFT_PART_INSTALL/snap/$CRAFT_PROJECT_NAME/current/usr
# purge dangling symlinks from stage-packages
rm -f $CRAFT_PART_INSTALL/usr/bin/on_ac_power
override-prime: |
craftctl default
# on_ac_power is a symlink into the host filesystem (/sbin/on_ac_power);
# remove it here (prime phase) to ensure it never lands in the snap.
rm -f $CRAFT_PRIME/usr/bin/on_ac_power

# enable-patchelf sets RPATH on libvirt-built ELF files so that shared
# libraries staged under usr/lib/<triplet> are found at runtime without
# LD_LIBRARY_PATH. This is required because libvirt_iohelper is spawned
# by virFileWrapperFdNew() with a minimal environment (no LD_LIBRARY_PATH),
# causing the resolution chain libvirt.so.0 -> libxml2.so.2 -> libicuuc.so.74
# to fail with "cannot open shared object file" on server suspend/resume.
build-attributes:
- enable-patchelf

templates:
source: templates/
Expand All @@ -712,6 +708,8 @@ parts:

networking:
plugin: nil
build-attributes:
- enable-patchelf
stage-packages:
- openvswitch-switch
- on amd64:
Expand All @@ -731,11 +729,15 @@ parts:

apache2-webdav:
plugin: nil
build-attributes:
- enable-patchelf
stage-packages:
- apache2

openstack:
plugin: nil
build-attributes:
- enable-patchelf
build-packages:
- patch
- python3-pip
Expand Down Expand Up @@ -785,9 +787,8 @@ parts:
rm -rf $CRAFT_PART_INSTALL/usr/bin/rst2*
# Install webdav4 for Nova's HttpDriver (not available as Debian package)
pip3 install --target=$CRAFT_PART_INSTALL/usr/lib/python3/dist-packages webdav4
override-prime: |
craftctl default
pushd "$CRAFT_PRIME/usr/lib/python3/dist-packages"

pushd "$CRAFT_PART_INSTALL/usr/lib/python3/dist-packages"
path="$CRAFT_PROJECT_DIR/snap/patches/nova/0001-remotefs-http-driver.patch"
# Unapply patch, ignore on failure
patch -p1 --reverse --forward --quiet --batch --reject-file=/dev/null --input "$path" || true
Expand All @@ -796,6 +797,8 @@ parts:

openstack-hypervisor:
plugin: uv
build-attributes:
- enable-patchelf
source: .
build-snaps: [astral-uv]
build-packages:
Expand All @@ -816,6 +819,8 @@ parts:

libvirt-exporter:
plugin: go
build-attributes:
- enable-patchelf
source-tag: 2.3.3
source-type: git
source: https://github.com/Tinkoff/libvirt-exporter
Expand All @@ -831,6 +836,8 @@ parts:
# gets backported.
netplan:
plugin: nil
build-attributes:
- enable-patchelf
source-tag: main
source-type: git
source: https://github.com/canonical/netplan
Expand Down Expand Up @@ -877,6 +884,24 @@ parts:
meson compile -C _build
meson install -C _build --destdir $CRAFT_PART_INSTALL

elf-rpath-fixes:
plugin: nil
after:
- libvirt-exporter
- netplan
- openstack-hypervisor
- qemu-firmware-data
build-packages:
- patchelf
override-prime: |
craftctl default

numpy_lapack_lite="$CRAFT_PRIME/usr/lib/python3/dist-packages/numpy/linalg/lapack_lite.cpython-314-x86_64-linux-gnu.so"
numpy_lapack_lite_rpath='$ORIGIN/../../../../x86_64-linux-gnu/blas:$ORIGIN/../../../../x86_64-linux-gnu:$ORIGIN/../../../../x86_64-linux-gnu/lapack'
if [ -f "$numpy_lapack_lite" ]; then
patchelf --force-rpath --set-rpath "$numpy_lapack_lite_rpath" "$numpy_lapack_lite"
fi

slots:
hypervisor-config:
interface: content
Expand Down
Loading