]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
snap: Transition to from core20 to core22
authorJoe Mooring <joe@mooring.com>
Sat, 9 Mar 2024 16:47:53 +0000 (08:47 -0800)
committerGitHub <noreply@github.com>
Sat, 9 Mar 2024 16:47:53 +0000 (08:47 -0800)
Closes #12219

snap/snapcraft.yaml

index cbf2cf0dd218fe9c50106200a459fc3eea54cb70..e35e849cc5e978ad7fa168ba3e497b938a245702 100644 (file)
@@ -1,5 +1,5 @@
 name: hugo
-base: core20
+base: core22
 confinement: strict
 adopt-info: hugo
 title: Hugo
@@ -75,19 +75,19 @@ environment:
   npm_config_userconfig: $SNAP_USER_DATA/.npmrc
   pandoc_datadir: $SNAP/usr/share/pandoc
   PYTHONHOME: /usr:$SNAP/usr
-  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
+  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
+
   # HUGO_SECURITY_EXEC_OSENV
   #
   # Default value:
-  #   (?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\w+|(XDG_CONFIG_)?HOME|USERPROFILE|SSH_AUTH_SOCK|DISPLAY|LANG)$
+  #   (?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\w+|(XDG_CONFIG_)?HOME|USERPROFILE|SSH_AUTH_SOCK|DISPLAY|LANG|SYSTEMDRIVE)$
   # Bundled applications require additional access:
   #   git:          GIT_EXEC_PATH and LD_LIBRARY_PATH
   #   npx:          npm_config_{cache,init_module,userconfig}
   #   pandoc:       pandoc_datadir
   #   rst2html:     PYTHONHOME and SNAP
   #   asciidoctor:  RUBYLIB
-  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)$
-
+  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)$
 apps:
   hugo:
     command: bin/hugo
@@ -116,7 +116,7 @@ parts:
   go:
     plugin: nil
     stage-snaps:
-      - go/1.21/stable
+      - go/1.22/stable
     prime:
       - bin/go
       - pkg/tool
@@ -129,12 +129,12 @@ parts:
       - git
       - go
     override-pull: |
-      snapcraftctl pull
-      snapcraftctl set-version "$(git describe --tags --always --match 'v[0-9]*' | sed 's/^v//; s/-/+git/; s/-g/./')"
+      craftctl default
+      craftctl set version=$(git describe --tags --always --match 'v[0-9]*' | sed 's/^v//; s/-/+git/; s/-g/./')
       if grep -q 'Suffix:\s*""' common/hugo/version_current.go; then
-        snapcraftctl set-grade "stable"
+        craftctl set grade=stable
       else
-        snapcraftctl set-grade "devel"
+        craftctl set grade=devel
       fi
     override-build: |
       echo "\nStarting override-build:"
@@ -152,15 +152,15 @@ parts:
       echo " * Building shell completion..."
       ./hugo completion bash > hugo-completion
 
-      echo " * Installing to ${SNAPCRAFT_PART_INSTALL}..."
-      install -d $SNAPCRAFT_PART_INSTALL/bin
-      cp -av hugo $SNAPCRAFT_PART_INSTALL/bin/
-      mv -v hugo-completion $SNAPCRAFT_PART_INSTALL/
+      echo " * Installing to ${CRAFT_PART_INSTALL}..."
+      install -d $CRAFT_PART_INSTALL/bin
+      cp -av hugo $CRAFT_PART_INSTALL/bin/
+      mv -v hugo-completion $CRAFT_PART_INSTALL/
 
       echo " * Stripping binary..."
-      ls -l $SNAPCRAFT_PART_INSTALL/bin/hugo
-      strip --remove-section=.comment --remove-section=.note $SNAPCRAFT_PART_INSTALL/bin/hugo
-      ls -l $SNAPCRAFT_PART_INSTALL/bin/hugo
+      ls -l $CRAFT_PART_INSTALL/bin/hugo
+      strip --remove-section=.comment --remove-section=.note $CRAFT_PART_INSTALL/bin/hugo
+      ls -l $CRAFT_PART_INSTALL/bin/hugo
 
   asciidoctor:
     plugin: nil
@@ -168,8 +168,12 @@ parts:
       - asciidoctor
     override-build: |
       set -ex
-      snapcraftctl build
-      sed -i '1s|#!/usr/bin/ruby|#!/usr/bin/env ruby|' $SNAPCRAFT_PART_INSTALL/usr/bin/asciidoctor
+      craftctl default
+      sed -i '1s|#!/usr/bin/ruby|#!/usr/bin/env ruby|' $CRAFT_PART_INSTALL/usr/bin/asciidoctor
+      # don't try and flock() gemspecs since this is blocked by AppArmor - see
+      # https://github.com/rubygems/rubygems/pull/5278 in particular
+      # https://github.com/rubygems/rubygems/pull/5278/commits/27b682c81226838b1254ac5843a3f5b1cb20f076
+      sed -i 's|!solaris_platform|win_platform|' $CRAFT_PART_INSTALL/usr/lib/ruby/vendor_ruby/rubygems.rb
 
   dart-sass:
     plugin: nil
@@ -177,8 +181,8 @@ parts:
       - curl
     override-build: |
       set -ex
-      snapcraftctl build
-      case "$SNAPCRAFT_TARGET_ARCH" in
+      craftctl default
+      case "$CRAFT_TARGET_ARCH" in
         amd64)  arch=x64    ;;
         arm64)  arch=arm64  ;;
         armhf)  arch=arm    ;;
@@ -189,8 +193,8 @@ parts:
         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)}")
         curl -LO --retry-connrefused --retry 10 "${url}"
         tar xf dart-sass-*-linux-${arch}.tar.gz
-        install -d $SNAPCRAFT_PART_INSTALL/bin
-        cp -av dart-sass/* $SNAPCRAFT_PART_INSTALL/bin/
+        install -d $CRAFT_PART_INSTALL/bin
+        cp -av dart-sass/* $CRAFT_PART_INSTALL/bin/
       fi
 
   node:
@@ -209,7 +213,7 @@ parts:
       - python3-docutils
     override-build: |
       set -ex
-      snapcraftctl build
-      sed -i "s|'/usr/share/docutils/'|os.path.expandvars('\$SNAP/usr/share/docutils/')|" $SNAPCRAFT_PART_INSTALL/usr/lib/python3/dist-packages/docutils/__init__.py
+      craftctl default
+      sed -i "s|'/usr/share/docutils/'|os.path.expandvars('\$SNAP/usr/share/docutils/')|" $CRAFT_PART_INSTALL/usr/lib/python3/dist-packages/docutils/__init__.py
     organize:
       usr/share/docutils/scripts/python3: usr/bin