[neon/snap-packaging/kf6-core/work.core24] /: Improve cleanup our snap is 11G.. Add cache gens, add all the missing

Scarlett Moore null at kde.org
Tue Nov 26 15:23:01 GMT 2024


Git commit 20dcb71af0796a7aa633378d39cdc9e56f5794c2 by Scarlett Moore.
Committed on 26/11/2024 at 15:20.
Pushed by scarlettmoore into branch 'work.core24'.

Improve cleanup our snap is 11G.. Add cache gens, add all the missing
libs not in core. Add gpu-2404 cleanup. Add fonts.

M  +254  -47   snapcraft.yaml

https://invent.kde.org/neon/snap-packaging/kf6-core/-/commit/20dcb71af0796a7aa633378d39cdc9e56f5794c2

diff --git a/snapcraft.yaml b/snapcraft.yaml
index dfc4313..2c58576 100644
--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -39,44 +39,272 @@ package-repositories:
     url: http://origin.archive.neon.kde.org/user
     key-server: keyserver.ubuntu.com
 parts:
+  kf6-sdk:
+    stage-snaps:
+      - kf6-core24-sdk/latest/stable
+      - kde-qt6-core24-sdk/latest/stable
+    stage:
+      - lib/*/bindtextdomain.so
+      - usr
+      - lib/$CRAFT_ARCH_TRIPLET/*
+      - etc/xdg/*
+      - etc/qt6/*
+      - -etc/emacs
+      - -etc/X11/Xreset.d/README
+      - -etc/fonts/conf.d/README
+      - -var/lib/aspell/README
+      - -var/lib/ispell/README
+      - -usr/share/dict/README.select-wordlist
+      - -usr/share/emacs
+      - -usr/share/fontconfig
+      - -usr/share/gdb
+      - -usr/share/glade
+      - -usr/share/gobject-introspection-1.0
+      - -usr/share/gst-plugins-base
+      - -usr/share/gtk-doc
+      - -usr/share/help
+      - -usr/share/installed-tests
+      - -usr/share/maven-repo
+      - -usr/bin/dpkg*
+      - -usr/bin/$CRAFT_ARCH_TRIPLET-*
+      - -usr/bin/g-ir-*
+      - -usr/bin/glib-compile-*
+      - -usr/bin/glib-gettextize
+      - -usr/bin/glib-genmarshal
+      - -usr/bin/glib-mkenums
+      - -usr/bin/gtester*
+      - -usr/bin/gtk-builder-tool
+      - -usr/bin/gtk4-builder-tool
+      - -usr/bin/gtk-update-icon-cache
+      - -usr/bin/gtk4-update-icon-cache
+      - -usr/bin/h2ph
+      - -usr/bin/h2xs
+      - -usr/bin/make
+      - -usr/bin/make-first-existing-target
+      - -usr/bin/mm-common-get
+      - -usr/bin/mm-common-prepare
+      - -usr/bin/nm
+      - -usr/bin/objcopy
+      - -usr/bin/objdump
+      - -usr/bin/patch
+      - -usr/bin/peas-demo
+      - -usr/bin/pkg-config
+      - -usr/bin/pl2pm
+      - -usr/bin/pldd
+      - -usr/bin/prove
+      - -usr/bin/py3clean
+      - -usr/bin/ranlib
+      - -usr/bin/readelf
+      - -usr/bin/rpcgen
+      - -usr/bin/size
+      - -usr/bin/strings
+      - -usr/bin/strip
+      - -usr/bin/wayland-scanner
+      - -usr/bin/x86_64-pc-linux-gnu-pkg-config
+      - -usr/bin/xgettext
+      - -usr/bin/xsubpp
+
+      - -usr/**/*.a
+      - -usr/**/*.c
+      - -usr/**/*.cpp
+      - -usr/**/*.o
+      - -usr/**/*.h
+      - -usr/**/*.hpp
+      - -usr/**/*.pc
+
+      - -usr/bin/g++*
+      - -usr/bin/*-linux-gnu-g++*
+      - -usr/bin/gcc*
+      - -usr/bin/*-linux-gnu-gcc*
+      - -usr/bin/python*
+      - -usr/bin/vala*
+      - -usr/bin/vapi*
+
+      - -usr/include
+
+      - -usr/lib/*vala*
+
+      - -usr/share/perl
+      - -usr/share/vala*
+      - -usr/share/gir*
+
+      - -usr/bin/meson
+      - -usr/bin/ninja
+      - -usr/lib/python3/dist-packages/meson*
+      - -usr/share/devhelp/books
+    plugin: nil
+
   kf6:
+    after: [kf6-sdk]
     stage-packages:
-      - libglib2.0-0
-      - gstreamer1.0-x
+      - fcitx-frontend-qt6
+      - fonts-noto-color-emoji
+      - gir1.2-ggit-1.0
+      - gir1.2-gucharmap-2.90
+      - gir1.2-vte-2.91
+      - gstreamer1.0-gl
       - gstreamer1.0-plugins-base
-      - gstreamer1.0-pulseaudio
       - gstreamer1.0-plugins-good
-      - gstreamer1.0-alsa
-      - gstreamer1.0-libav
-      - gstreamer1.0-tools
+      - gstreamer1.0-pipewire
+      - ibus-gtk3
+      - libasound2t64
+      - libasyncns0
+      - libavahi-client3
+      - libavahi-common3
+      - libbrotli1
+      - libc-bin
+      - libcanberra-gtk3-module
+      - libcdt5
+      - libcgraph6
+      - libcolord2
+      - libcups2t64
+      - libdatrie1
+      - libdbus-glib-1-2
+      - libdb5.3t64
+      - libevdev2
+      - libflac12t64
+      - libfontconfig1
+      - libfreetype6
+      - libgck-1-0
+      - libgcr-base-3-1
+      - libgcr-ui-3-1
+      - libgoa-1.0-0b
+      - libgraphite2-3
+      - libgspell-1-2
+      - libgstreamer-plugins-base1.0-0
+      - libgstreamer-plugins-good1.0-0
       - libgstreamer1.0-0
-      - gstreamer1.0-plugins-bad
-      - gstreamer1.0-plugins-ugly
+      - libgvc6
+      - libicu74
+      - libinput10
+      - libjbig0
+      - libjpeg-turbo8
+      - liblcms2-2
+      - libllvm17t64
+      - libmozjs-115-0t64
+      - libmpc3
+      - libmpfr6
+      - libmtdev1t64
+      - libogg0
+      - libpathplan4
+      - libpipewire-0.3-0t64
+      - libproxy1v5
+      - libpng16-16t64
       - libpulse0
-      - locales
-      - libc-bin
-      - gettext
-      - xkb-data
-      - perl
+      - libpython3.12t64
+      - librsvg2-2
+      - libsigc++-2.0-0v5
+      - libsndfile1
+      - libthai0
+      - libtiff6
+      - libvorbis0a
+      - libvorbisenc2
+      - libwacom9
+      - libx11-6
+      - libxau6
+      - libxcb-render0
+      - libxcomposite1
+      - libxcursor1
+      - libxdamage1
+      - libxdmcp6
+      - libxext6
+      - libxfixes3
+      - libxft2
+      - libxi6
+      - libxinerama1
+      - libxkbcommon0
+      - libxml2
+      - libxrandr2
+      - libxrender1
+      - libxtst6
       - locales-all
-    stage-snaps:
-      - kf6-core24-sdk/latest/stable
-      - kde-qt6-core24-sdk/latest/stable
+      - python3-dbus
+      - python3-gi
+      - python3.12-minimal
+      - shared-mime-info
+      - xdg-user-dirs
+      - xkb-data
     stage:
-      - -usr/lib/*/libdrm*
-      - -usr/share/doc/libdrm*
-      - -usr/lib/*/cmake
-      - -usr/lib/*/qt6/mkspecs
-      - -usr/share/qt6/doc
-      - -usr/share/man
-      - -usr/share/doc
-      - -usr/share/ECM
+      - -usr/lib/$CRAFT_ARCH_TRIPLET/libLLVM*
+    override-build: |
+      set -eux
+      craftctl default
+      cd $CRAFT_STAGE/usr
+      # We need to explicitly remove this recursively
+      rm -rf $CRAFT_PART_INSTALL/usr/lib/python3/dist-packages/PyGObject-3.*.egg-info
+      find . -type f,l -exec rm -f $CRAFT_PART_INSTALL/usr/{} \;
+      find . -type f,l -name "*.so*" -exec bash -c "rm -f $CRAFT_PART_INSTALL/usr/{}*" \;
+      cd $CRAFT_STAGE/usr/lib
+      find . -type f,l -exec rm -f $CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET/{} \;
+      find . -type f,l -name "*.so*" -exec bash -c "rm -f $CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET/{}*" \;
+      cd $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET
+      find . -type f,l -exec rm -f $CRAFT_PART_INSTALL/usr/lib/{} \;
+      find . -type f,l -name "*.so*" -exec bash -c "rm -f $CRAFT_PART_INSTALL/usr/lib/{}*" \;
+
+  fonts-config:
+      after: [ kf6 ]
+      plugin: nil
+      stage-packages: [ fontconfig-config, fonts-arphic-ukai, fonts-arphic-uming, fonts-beng-extra, fonts-dejavu-core, fonts-deva-extra, fonts-droid-fallback, fonts-gubbi, fonts-gujr-extra, fonts-guru-extra, fonts-lohit-beng-assamese, fonts-lohit-beng-bengali, fonts-lohit-deva, fonts-lohit-gujr, fonts-lohit-guru, fonts-lohit-knda, fonts-lohit-mlym, fonts-lohit-orya, fonts-lohit-taml, fonts-lohit-taml-classical, fonts-lohit-telu, fonts-noto-cjk, fonts-noto-mono, fonts-orya-extra, fonts-pagul, fonts-smc-anjalioldlipi, fonts-smc-chilanka, fonts-smc-dyuthi, fonts-smc-karumbi, fonts-smc-keraleeyam, fonts-smc-manjari, fonts-smc-meera, fonts-smc-rachana, fonts-smc-raghumalayalamsans, fonts-smc-suruma, fonts-smc-uroob, fonts-telu-extra, fonts-tlwg-garuda, fonts-tlwg-kinnari, fonts-tlwg-laksaman, fonts-tlwg-loma, fonts-tlwg-mono, fonts-tlwg-norasi, fonts-tlwg-typist, fonts-tlwg-typo, fonts-tlwg-umpush, fonts-tlwg-waree, fonts-urw-base35, language-selector-common ]
+      stage:
+      - etc/fonts
+      - usr/share/fontconfig
+
+  caches:
+    after: [ fonts-config ]
     plugin: nil
-    override-prime: |
+    build-packages:
+      - libglib2.0-bin
+      - shared-mime-info
+    build-environment:
+      - LD_LIBRARY_PATH: $CRAFT_STAGE/usr/lib:$CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
+    override-build: |
       set -eux
       craftctl default
+      $CRAFT_STAGE/usr/bin/glib-compile-schemas $CRAFT_STAGE/usr/share/glib-2.0/schemas
+      $CRAFT_STAGE/usr/bin/update-mime-database $CRAFT_STAGE/usr/share/mime
+
+      # the icons cache is rebuilt in 'cleanup' priming because it is there where the duplicated icons are removed
+
+      kbuildsycoca6 --noincremental
+
+  command-chain:
+    source: https://github.com/snapcore/snapcraft-desktop-integration.git
+    source-type: git
+    source-subdir: kde-neon-6
+    plugin: make
+    make-parameters:
+      - PLATFORM_PLUG=$SNAPCRAFT_PROJECT_NAME
+      - WITH_GRAPHICS=false
+
+  cleanup:
+    after: [ caches ]
+    plugin: nil
+    source: https://github.com/canonical/gpu-snap.git
+    build-snaps:
+      - gtk-common-themes
+    build-packages:
+      - python3-pip
+      - zip
+      - python3-apt
+    override-prime: |
+      set -eux
+
+      cd /snap/gtk-common-themes/current
+      find . -type f,l ! -name index.theme -exec rm -f $CRAFT_PRIME/usr/{} \;
       cd $CRAFT_PRIME
-      find . -type f,l -name "*.h" -exec bash -c "rm -f {}*" \;
+      for dir in usr/share/icons/*; do
+        if [ -f "$dir/index.theme" ]; then
+          $CRAFT_STAGE/usr/bin/gtk-update-icon-cache --force "$dir"
+        fi
+      done
+
+      rm -rf usr/share/doc
+      rm -rf usr/share/man
+
+      find . -type d -empty -delete
+
+       ${CRAFT_PART_SRC}/bin/gpu-2404-cleanup mesa-2404
+
   alsa-pulseaudio:
     plugin: dump
     source: .
@@ -96,24 +324,3 @@ parts:
             fallback "sysdefault"
           }
         EOF
-
-  gpu-2404:
-    after: [kf6]
-    source: https://github.com/canonical/gpu-snap.git
-    plugin: dump
-    override-prime: |
-      craftctl default
-      ${CRAFT_PART_SRC}/bin/gpu-2404-cleanup mesa-2404
-    prime:
-    - bin/gpu-2404-wrapper
-
-  command-chain:
-    source: https://invent.kde.org/neon/snap-packaging/snapcraft-desktop-integration.git
-    source-type: git
-    source-branch: work.core24
-    source-subdir: kde-neon-6
-    plugin: make
-    make-parameters:
-      - PLATFORM_PLUG="kf6-core24"
-    stage-packages:
-      - tox


More information about the Neon-commits mailing list