Skip to content

Commit d24ffdd

Browse files
authored
snap: Transition to from core20 to core22
Closes gohugoio#12219
1 parent ca31b95 commit d24ffdd

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

snap/snapcraft.yaml

+29-25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: hugo
2-
base: core20
2+
base: core22
33
confinement: strict
44
adopt-info: hugo
55
title: Hugo
@@ -75,19 +75,19 @@ environment:
7575
npm_config_userconfig: $SNAP_USER_DATA/.npmrc
7676
pandoc_datadir: $SNAP/usr/share/pandoc
7777
PYTHONHOME: /usr:$SNAP/usr
78-
RUBYLIB: $SNAP/usr/lib/ruby/vendor_ruby/2.7.0:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/ruby/vendor_ruby/2.7.0:$SNAP/usr/lib/ruby/vendor_ruby:$SNAP/usr/lib/ruby/2.7.0:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/ruby/2.7.0
78+
RUBYLIB: $SNAP/usr/lib/ruby/vendor_ruby/3.0.0:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/ruby/vendor_ruby/3.0.0:$SNAP/usr/lib/ruby/vendor_ruby:$SNAP/usr/lib/ruby/3.0.0:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET/ruby/3.0.0
79+
7980
# HUGO_SECURITY_EXEC_OSENV
8081
#
8182
# Default value:
82-
# (?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\w+|(XDG_CONFIG_)?HOME|USERPROFILE|SSH_AUTH_SOCK|DISPLAY|LANG)$
83+
# (?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\w+|(XDG_CONFIG_)?HOME|USERPROFILE|SSH_AUTH_SOCK|DISPLAY|LANG|SYSTEMDRIVE)$
8384
# Bundled applications require additional access:
8485
# git: GIT_EXEC_PATH and LD_LIBRARY_PATH
8586
# npx: npm_config_{cache,init_module,userconfig}
8687
# pandoc: pandoc_datadir
8788
# rst2html: PYTHONHOME and SNAP
8889
# asciidoctor: RUBYLIB
89-
HUGO_SECURITY_EXEC_OSENV: (?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\w+|(XDG_CONFIG_)?HOME|USERPROFILE|SSH_AUTH_SOCK|DISPLAY|LANG|GIT_EXEC_PATH|LD_LIBRARY_PATH|npm_config_(cache|init_module|userconfig)|pandoc_datadir|PYTHONHOME|SNAP|RUBYLIB)$
90-
90+
HUGO_SECURITY_EXEC_OSENV: (?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\w+|(XDG_CONFIG_)?HOME|USERPROFILE|SSH_AUTH_SOCK|DISPLAY|LANG|SYSTEMDRIVE|GIT_EXEC_PATH|LD_LIBRARY_PATH|npm_config_(cache|init_module|userconfig)|pandoc_datadir|PYTHONHOME|SNAP|RUBYLIB)$
9191
apps:
9292
hugo:
9393
command: bin/hugo
@@ -116,7 +116,7 @@ parts:
116116
go:
117117
plugin: nil
118118
stage-snaps:
119-
- go/1.21/stable
119+
- go/1.22/stable
120120
prime:
121121
- bin/go
122122
- pkg/tool
@@ -129,12 +129,12 @@ parts:
129129
- git
130130
- go
131131
override-pull: |
132-
snapcraftctl pull
133-
snapcraftctl set-version "$(git describe --tags --always --match 'v[0-9]*' | sed 's/^v//; s/-/+git/; s/-g/./')"
132+
craftctl default
133+
craftctl set version=$(git describe --tags --always --match 'v[0-9]*' | sed 's/^v//; s/-/+git/; s/-g/./')
134134
if grep -q 'Suffix:\s*""' common/hugo/version_current.go; then
135-
snapcraftctl set-grade "stable"
135+
craftctl set grade=stable
136136
else
137-
snapcraftctl set-grade "devel"
137+
craftctl set grade=devel
138138
fi
139139
override-build: |
140140
echo "\nStarting override-build:"
@@ -152,33 +152,37 @@ parts:
152152
echo " * Building shell completion..."
153153
./hugo completion bash > hugo-completion
154154
155-
echo " * Installing to ${SNAPCRAFT_PART_INSTALL}..."
156-
install -d $SNAPCRAFT_PART_INSTALL/bin
157-
cp -av hugo $SNAPCRAFT_PART_INSTALL/bin/
158-
mv -v hugo-completion $SNAPCRAFT_PART_INSTALL/
155+
echo " * Installing to ${CRAFT_PART_INSTALL}..."
156+
install -d $CRAFT_PART_INSTALL/bin
157+
cp -av hugo $CRAFT_PART_INSTALL/bin/
158+
mv -v hugo-completion $CRAFT_PART_INSTALL/
159159
160160
echo " * Stripping binary..."
161-
ls -l $SNAPCRAFT_PART_INSTALL/bin/hugo
162-
strip --remove-section=.comment --remove-section=.note $SNAPCRAFT_PART_INSTALL/bin/hugo
163-
ls -l $SNAPCRAFT_PART_INSTALL/bin/hugo
161+
ls -l $CRAFT_PART_INSTALL/bin/hugo
162+
strip --remove-section=.comment --remove-section=.note $CRAFT_PART_INSTALL/bin/hugo
163+
ls -l $CRAFT_PART_INSTALL/bin/hugo
164164
165165
asciidoctor:
166166
plugin: nil
167167
stage-packages:
168168
- asciidoctor
169169
override-build: |
170170
set -ex
171-
snapcraftctl build
172-
sed -i '1s|#!/usr/bin/ruby|#!/usr/bin/env ruby|' $SNAPCRAFT_PART_INSTALL/usr/bin/asciidoctor
171+
craftctl default
172+
sed -i '1s|#!/usr/bin/ruby|#!/usr/bin/env ruby|' $CRAFT_PART_INSTALL/usr/bin/asciidoctor
173+
# don't try and flock() gemspecs since this is blocked by AppArmor - see
174+
# https://github.com/rubygems/rubygems/pull/5278 in particular
175+
# https://github.com/rubygems/rubygems/pull/5278/commits/27b682c81226838b1254ac5843a3f5b1cb20f076
176+
sed -i 's|!solaris_platform|win_platform|' $CRAFT_PART_INSTALL/usr/lib/ruby/vendor_ruby/rubygems.rb
173177
174178
dart-sass:
175179
plugin: nil
176180
build-packages:
177181
- curl
178182
override-build: |
179183
set -ex
180-
snapcraftctl build
181-
case "$SNAPCRAFT_TARGET_ARCH" in
184+
craftctl default
185+
case "$CRAFT_TARGET_ARCH" in
182186
amd64) arch=x64 ;;
183187
arm64) arch=arm64 ;;
184188
armhf) arch=arm ;;
@@ -189,8 +193,8 @@ parts:
189193
url=$(curl -s https://api.github.com/repos/sass/dart-sass/releases/latest | awk -F\" "/browser_download_url.*-linux-${arch}.tar.gz/{print \$(NF-1)}")
190194
curl -LO --retry-connrefused --retry 10 "${url}"
191195
tar xf dart-sass-*-linux-${arch}.tar.gz
192-
install -d $SNAPCRAFT_PART_INSTALL/bin
193-
cp -av dart-sass/* $SNAPCRAFT_PART_INSTALL/bin/
196+
install -d $CRAFT_PART_INSTALL/bin
197+
cp -av dart-sass/* $CRAFT_PART_INSTALL/bin/
194198
fi
195199
196200
node:
@@ -209,7 +213,7 @@ parts:
209213
- python3-docutils
210214
override-build: |
211215
set -ex
212-
snapcraftctl build
213-
sed -i "s|'/usr/share/docutils/'|os.path.expandvars('\$SNAP/usr/share/docutils/')|" $SNAPCRAFT_PART_INSTALL/usr/lib/python3/dist-packages/docutils/__init__.py
216+
craftctl default
217+
sed -i "s|'/usr/share/docutils/'|os.path.expandvars('\$SNAP/usr/share/docutils/')|" $CRAFT_PART_INSTALL/usr/lib/python3/dist-packages/docutils/__init__.py
214218
organize:
215219
usr/share/docutils/scripts/python3: usr/bin

0 commit comments

Comments
 (0)