From 677243d5aaad2fbc5ce5dc5c486f32305817a27c Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 18 Jun 2025 12:40:34 -0400 Subject: [PATCH 1/7] snap: switch to `core24` base Signed-off-by: Simon Deziel --- snap/snapcraft.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index f294c4e..2f2b23f 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -23,7 +23,7 @@ description: | # snap connect shellcheck:removable-media version: git -base: core20 +base: core24 grade: stable confinement: strict @@ -52,5 +52,5 @@ parts: cabal update cabal install -j - install -d $SNAPCRAFT_PART_INSTALL/usr/bin - install .cabal-sandbox/bin/shellcheck $SNAPCRAFT_PART_INSTALL/usr/bin + install -d "${CRAFT_PART_INSTALL}/usr/bin" + install .cabal-sandbox/bin/shellcheck "${CRAFT_PART_INSTALL}/usr/bin" From 133bc8a543855faa7aa3e89d41de8e14483e4061 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 18 Jun 2025 12:50:07 -0400 Subject: [PATCH 2/7] snap: newer `mkswap` require stricter perms Signed-off-by: Simon Deziel --- snap/snapcraft.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 2f2b23f..00ec03a 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -45,6 +45,7 @@ parts: override-build: | # Give ourselves enough memory to build dd if=/dev/zero of=/tmp/swap bs=1M count=2000 + chmod 0600 /tmp/swap mkswap /tmp/swap swapon /tmp/swap From fa99cfd3557b04cc18b8e470c0066e66ab6fcd79 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 18 Jun 2025 12:50:29 -0400 Subject: [PATCH 3/7] snap: replace `dd` by `fallocate` (faster) Signed-off-by: Simon Deziel --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 00ec03a..e751f05 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -44,7 +44,7 @@ parts: - libatomic1 override-build: | # Give ourselves enough memory to build - dd if=/dev/zero of=/tmp/swap bs=1M count=2000 + fallocate -l 2G /tmp/swap chmod 0600 /tmp/swap mkswap /tmp/swap swapon /tmp/swap From 310932be8eeaf71396b62e64fa389d3e992bae89 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 18 Jun 2025 13:09:33 -0400 Subject: [PATCH 4/7] snap: modern `cabal` no longer have `sandbox` subcommand Signed-off-by: Simon Deziel --- snap/snapcraft.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index e751f05..1e3bdcb 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -49,9 +49,8 @@ parts: mkswap /tmp/swap swapon /tmp/swap - cabal sandbox init cabal update cabal install -j install -d "${CRAFT_PART_INSTALL}/usr/bin" - install .cabal-sandbox/bin/shellcheck "${CRAFT_PART_INSTALL}/usr/bin" + install ~/.cabal/bin/shellcheck "${CRAFT_PART_INSTALL}/usr/bin" From 34f582c81c0ae4868068b5efa3045f1c16f6ea91 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 18 Jun 2025 15:01:38 -0400 Subject: [PATCH 5/7] snap: don't abort on `swapon` failures This is needed when building snap on LXD containers. Signed-off-by: Simon Deziel --- snap/snapcraft.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 1e3bdcb..944115b 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -47,7 +47,10 @@ parts: fallocate -l 2G /tmp/swap chmod 0600 /tmp/swap mkswap /tmp/swap - swapon /tmp/swap + if ! swapon /tmp/swap; then + echo "Could not enable swap file, continuing anyway" + rm /tmp/swap + fi cabal update cabal install -j From 638eb88a5aed9a403df1c7c72ac4c745e8d165a0 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 18 Jun 2025 16:01:24 -0400 Subject: [PATCH 6/7] snap: remove now unneeded `libatomic1` stage package Signed-off-by: Simon Deziel --- snap/snapcraft.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 944115b..2baa84c 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -40,8 +40,6 @@ parts: source: . build-packages: - cabal-install - stage-packages: - - libatomic1 override-build: | # Give ourselves enough memory to build fallocate -l 2G /tmp/swap From 9477e268583629bf5ada6093769232530bf9d7c6 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Wed, 18 Jun 2025 16:19:25 -0400 Subject: [PATCH 7/7] snap: `strip` executable during installation Signed-off-by: Simon Deziel --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 2baa84c..83ac1e7 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -54,4 +54,4 @@ parts: cabal install -j install -d "${CRAFT_PART_INSTALL}/usr/bin" - install ~/.cabal/bin/shellcheck "${CRAFT_PART_INSTALL}/usr/bin" + install --strip ~/.cabal/bin/shellcheck "${CRAFT_PART_INSTALL}/usr/bin"