From d96109ff6d00c3e2d798b443c809c9ec7f2d453c Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 5 Jan 2024 13:57:09 -0500 Subject: [PATCH 01/10] snapcraft: add zfs 2.2 to 5.0-edge for compat with kernel 6.5 Signed-off-by: Simon Deziel --- snapcraft.yaml | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/snapcraft.yaml b/snapcraft.yaml index 93af6c253..4eee67aea 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -1184,6 +1184,38 @@ parts: mv "${SNAPCRAFT_PART_INSTALL}.tmp/lib/"*so* "${SNAPCRAFT_PART_INSTALL}/zfs-2.1/lib/" rm -Rf "${SNAPCRAFT_PART_INSTALL}.tmp" + zfs-2-2: + build-attributes: [core22-step-dependencies] + source: https://github.com/openzfs/zfs + source-type: git + source-tag: zfs-2.2.2 + source-depth: 1 + plugin: autotools + autotools-configure-parameters: + - --prefix=/ + - --with-config=user + build-packages: + - libblkid-dev + - libssl-dev + - uuid-dev + - zlib1g-dev + override-build: |- + [ "$(uname -m)" != "x86_64" ] && \ + [ "$(uname -m)" != "aarch64" ] && \ + [ "$(uname -m)" != "s390x" ] && \ + [ "$(uname -m)" != "ppc64le" ] && exit 0 + snapcraftctl build + set -ex + + ZFS_VER="2.2" + + mv "${SNAPCRAFT_PART_INSTALL}" "${SNAPCRAFT_PART_INSTALL}.tmp" + mkdir -p "${SNAPCRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin" "${SNAPCRAFT_PART_INSTALL}/zfs-${ZFS_VER}/lib" + mv "${SNAPCRAFT_PART_INSTALL}.tmp/sbin/zfs" "${SNAPCRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin/" + mv "${SNAPCRAFT_PART_INSTALL}.tmp/sbin/zpool" "${SNAPCRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin/" + mv "${SNAPCRAFT_PART_INSTALL}.tmp/lib/udev/zvol_id" "${SNAPCRAFT_PART_INSTALL}/zfs-${ZFS_VER}/bin/" + mv "${SNAPCRAFT_PART_INSTALL}.tmp/lib/"*so* "${SNAPCRAFT_PART_INSTALL}/zfs-${ZFS_VER}/lib/" + rm -Rf "${SNAPCRAFT_PART_INSTALL}.tmp" zstd: build-attributes: [core22-step-dependencies] @@ -1484,6 +1516,7 @@ parts: - zfs-0-8 - zfs-2-0 - zfs-2-1 + - zfs-2-2 - lxc - lxcfs - criu @@ -1502,7 +1535,7 @@ parts: strip -s ${SNAPCRAFT_PRIME}/lib/libdqlite* strip -s ${SNAPCRAFT_PRIME}/lib/libsqlite* - for zfs in zfs-0.6 zfs-0.7 zfs-0.8 zfs-2.0 zfs-2.1; do + for zfs in zfs-0.6 zfs-0.7 zfs-0.8 zfs-2.0 zfs-2.1 zfs-2.2; do [ ! -d "${SNAPCRAFT_PRIME}/${zfs}" ] && continue strip -s ${SNAPCRAFT_PRIME}/${zfs}/bin/* ${SNAPCRAFT_PRIME}/${zfs}/lib/* done From 33479fe882ea1fef89d666c51f5fa5c7bdf171c3 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 5 Jan 2024 14:30:31 -0500 Subject: [PATCH 02/10] snapcraft/commands/daemon.start: add zfs-2.2 Signed-off-by: Simon Deziel --- snapcraft/commands/daemon.start | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/snapcraft/commands/daemon.start b/snapcraft/commands/daemon.start index 6a1f5dce9..8d46f1513 100755 --- a/snapcraft/commands/daemon.start +++ b/snapcraft/commands/daemon.start @@ -336,7 +336,11 @@ else VERSION=$(nsenter -t 1 -m modinfo -F version zfs 2>/dev/null || true) fi -if echo "${VERSION}" | grep -q ^2\.1; then +if echo "${VERSION}" | grep -q ^2\.2; then + echo "==> Setting up ZFS (2.2)" + export LD_LIBRARY_PATH="${SNAP_CURRENT}/zfs-2.2/lib/:${LD_LIBRARY_PATH}" + export PATH="${SNAP_CURRENT}/zfs-2.2/bin:${PATH}" +elif echo "${VERSION}" | grep -q ^2\.1; then echo "==> Setting up ZFS (2.1)" export LD_LIBRARY_PATH="${SNAP_CURRENT}/zfs-2.1/lib/:${LD_LIBRARY_PATH}" export PATH="${SNAP_CURRENT}/zfs-2.1/bin:${PATH}" From efbf6996d6ff0c2a5d119afabade52271339532e Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 5 Jan 2024 14:31:01 -0500 Subject: [PATCH 03/10] snapcraft/commands/lxd-migrate: add zfs-2.2 Signed-off-by: Simon Deziel --- snapcraft/commands/lxd-migrate | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/snapcraft/commands/lxd-migrate b/snapcraft/commands/lxd-migrate index bc1539757..38a6a0147 100755 --- a/snapcraft/commands/lxd-migrate +++ b/snapcraft/commands/lxd-migrate @@ -18,7 +18,10 @@ else VERSION=$(nsenter -t 1 -m modinfo -F version zfs 2>/dev/null || true) fi -if echo "${VERSION}" | grep -q ^2\.1; then +if echo "${VERSION}" | grep -q ^2\.2; then + export LD_LIBRARY_PATH="${SNAP_CURRENT}/zfs-2.2/lib/:${LD_LIBRARY_PATH}" + export PATH="${SNAP_CURRENT}/zfs-2.2/bin:${PATH}" +elif echo "${VERSION}" | grep -q ^2\.1; then export LD_LIBRARY_PATH="${SNAP_CURRENT}/zfs-2.1/lib/:${LD_LIBRARY_PATH}" export PATH="${SNAP_CURRENT}/zfs-2.1/bin:${PATH}" elif echo "${VERSION}" | grep -q ^2\.0; then From d4421dd6421da8b6b2a1266d9f0c8d65f33f41a8 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 24 Jan 2024 15:04:06 -0500 Subject: [PATCH 04/10] snapcraft: pin dqlite version to v1.14.0 Signed-off-by: Simon Deziel --- snapcraft.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/snapcraft.yaml b/snapcraft.yaml index 4eee67aea..61c3873ed 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -272,6 +272,7 @@ parts: - raft - sqlite source: https://github.com/canonical/dqlite + source-tag: v1.14.0 source-type: git source-depth: 1 plugin: autotools From 483d0f8839bbeb9feb7cbd13745f6fbb100f9b4f Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 24 Jan 2024 15:04:22 -0500 Subject: [PATCH 05/10] snapcraft: pin raft version v0.17.1 Signed-off-by: Simon Deziel --- snapcraft.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/snapcraft.yaml b/snapcraft.yaml index 61c3873ed..c7c1089e2 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -894,6 +894,7 @@ parts: raft: build-attributes: [core22-step-dependencies] source: https://github.com/canonical/raft + source-tag: v0.17.1 source-type: git source-depth: 1 plugin: autotools From 35036d5797dd6a9949c9dd91f31bd7cd7c2a2924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Thu, 27 Apr 2023 07:18:19 +0200 Subject: [PATCH 06/10] spice: Update git URLs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber Signed-off-by: Simon Deziel --- snapcraft.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snapcraft.yaml b/snapcraft.yaml index c7c1089e2..373817fa1 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -660,7 +660,7 @@ parts: spice-protocol: build-attributes: [core22-step-dependencies] - source: https://github.com/freedesktop/spice-protocol + source: https://gitlab.freedesktop.org/spice/spice-protocol source-type: git source-tag: v0.14.4 source-depth: 1 @@ -671,7 +671,7 @@ parts: build-attributes: [core22-step-dependencies] after: - spice-protocol - source: https://github.com/freedesktop/spice + source: https://gitlab.freedesktop.org/spice/spice source-type: git source-tag: v0.15.1 source-depth: 1 From 3de18c251f47a529b1f4fafb8c3eeb3a37abe447 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 24 Jan 2024 22:40:52 -0500 Subject: [PATCH 07/10] lxd-migrate: go mod edit -replace go mod edit -replace "github.com/lxc/lxd=github.com/canonical/lxd@v0.0.0-20220526200742-11ace6e6c1b3" Signed-off-by: Simon Deziel --- lxd-migrate/go.mod | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lxd-migrate/go.mod b/lxd-migrate/go.mod index c8791231e..32908eb53 100644 --- a/lxd-migrate/go.mod +++ b/lxd-migrate/go.mod @@ -34,3 +34,5 @@ require ( gopkg.in/macaroon-bakery.v2 v2.3.0 // indirect gopkg.in/macaroon.v2 v2.1.0 // indirect ) + +replace github.com/lxc/lxd => github.com/canonical/lxd v0.0.0-20220526200742-11ace6e6c1b3 From 963080f2e26b8c0da3c8a5a721318130e3828508 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 24 Jan 2024 22:39:39 -0500 Subject: [PATCH 08/10] snapcraft: s|github.com/lxc/lxd|github.com/canonical/lxd|g Signed-off-by: Simon Deziel --- snapcraft.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/snapcraft.yaml b/snapcraft.yaml index 373817fa1..748ef2f05 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -53,8 +53,8 @@ description: |- /var/snap/lxd/common/global-conf/ (config.yml and servercerts) contact: lxc-devel@lists.linuxcontainers.org -issues: https://github.com/lxc/lxd/issues -source-code: https://github.com/lxc/lxd +issues: https://github.com/canonical/lxd/issues +source-code: https://github.com/canonical/lxd website: https://linuxcontainers.org/lxd confinement: strict @@ -1332,7 +1332,7 @@ parts: lxd: build-attributes: [core22-step-dependencies] - source: https://github.com/lxc/lxd + source: https://github.com/canonical/lxd source-type: git source-tag: lxd-5.0.2 after: @@ -1368,8 +1368,8 @@ parts: # Setup the GOPATH rm -Rf "${GOPATH}" - mkdir -p "${GOPATH}/src/github.com/lxc" - ln -s "$(pwd)" "${GOPATH}/src/github.com/lxc/lxd" + mkdir -p "${GOPATH}/src/github.com/canonical" + ln -s "$(pwd)" "${GOPATH}/src/github.com/canonical/lxd" # Download the dependencies go get -d -v ./... @@ -1391,12 +1391,12 @@ parts: export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)" # Build the binaries - go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxc" github.com/lxc/lxd/lxc - go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxc-to-lxd" github.com/lxc/lxd/lxc-to-lxd - go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxd" -tags=libsqlite3 github.com/lxc/lxd/lxd - CGO_ENABLED=0 go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxd-agent" -tags=agent,netgo github.com/lxc/lxd/lxd-agent - go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxd-benchmark" github.com/lxc/lxd/lxd-benchmark - go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxd-user" github.com/lxc/lxd/lxd-user + go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxc" github.com/canonical/lxd/lxc + go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxc-to-lxd" github.com/canonical/lxd/lxc-to-lxd + go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxd" -tags=libsqlite3 github.com/canonical/lxd/lxd + CGO_ENABLED=0 go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxd-agent" -tags=agent,netgo github.com/canonical/lxd/lxd-agent + go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxd-benchmark" github.com/canonical/lxd/lxd-benchmark + go build -o "${SNAPCRAFT_PART_INSTALL}/bin/lxd-user" github.com/canonical/lxd/lxd-user # Setup bash completion mkdir -p ${SNAPCRAFT_PART_INSTALL}/etc/bash_completion.d/ From 611446721b948c457162f89b5cbc38df4c600ed0 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 24 Jan 2024 16:48:49 -0500 Subject: [PATCH 09/10] snapcraft: replace all occurences of github.com/lxc/lxd in LXD 5.0.2 tag Signed-off-by: Simon Deziel --- snapcraft.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/snapcraft.yaml b/snapcraft.yaml index 748ef2f05..2da01d765 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -1371,6 +1371,15 @@ parts: mkdir -p "${GOPATH}/src/github.com/canonical" ln -s "$(pwd)" "${GOPATH}/src/github.com/canonical/lxd" + # Git cherry-picks + cd ../src + git config user.email "noreply@linuxcontainers.org" + git config user.name "LXD snap builder" + + # XXX: replace all occurences of the old repo (github.com/lxc/lxd) by the new one + find -type f -exec sed -i 's|github.com/lxc/lxd|github.com/canonical/lxd|g' {} + + git commit --all -m "*: s|github.com/lxc/lxd|github.com/canonical/lxd|g" + # Download the dependencies go get -d -v ./... override-build: | From 474ba44bdb6a65203d79739acba5aa433552232f Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 24 Jan 2024 20:18:03 -0500 Subject: [PATCH 10/10] snapcraft: mangle cherry-pick commit 124b908e55c8 to replace github.com/lxc/lxd by github.com/canonical/lxd Signed-off-by: Simon Deziel --- snapcraft.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/snapcraft.yaml b/snapcraft.yaml index 2da01d765..a9df89890 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -1391,7 +1391,9 @@ parts: git config user.name "LXD snap builder" git cherry-pick a1dc7c3f5bd1c46b7dd5914500c9baf687fe22cb # lxd/instances_post: Fix copying profiles during instance copy - git cherry-pick 124b908e55c8ff7da9a91b6989a5af782c8017ff # lxc/migrate: Make live migration error message more helpful + #git cherry-pick 124b908e55c8ff7da9a91b6989a5af782c8017ff # lxc/migrate: Make live migration error message more helpful + git show 124b908e55c8ff7da9a91b6989a5af782c8017ff | sed 's|github\.com/lxc/lxd|github.com/canonical/lxd|g' | git apply - + git show --no-patch 124b908e55c8ff7da9a91b6989a5af782c8017ff --format="%s%n%n%b" | git commit --all --author="kayos@tcp.direct " --date="Tue Jan 17 02:56:07 2023 -0800" --file - # Setup build environment export GOPATH=$(realpath ./.go)