[neon/snap-packaging/discover-snap] /: Initial commit

Antoine Gonzalez null at kde.org
Tue Jul 9 03:46:08 BST 2024


Git commit 10d3eb22e1653fb1dfc0150e13f3357f82dc1223 by Antoine Gonzalez.
Committed on 28/06/2024 at 15:22.
Pushed by carlosdem into branch 'master'.

Initial commit

A  +8    -0    debian/.gitlab-ci-neon.yml
A  +232  -0    patches/810-snap-backend-updates.patch
A  +133  -0    patches/873-snap-backend-desktop-launch-BACKPORT.patch
A  +193  -0    snapcraft.yaml

https://invent.kde.org/neon/snap-packaging/discover-snap/-/commit/10d3eb22e1653fb1dfc0150e13f3357f82dc1223

diff --git a/debian/.gitlab-ci-neon.yml b/debian/.gitlab-ci-neon.yml
new file mode 100644
index 0000000..cea696d
--- /dev/null
+++ b/debian/.gitlab-ci-neon.yml
@@ -0,0 +1,8 @@
+# SPDX-FileCopyrightText: none
+# SPDX-License-Identifier: CC0-1.0
+
+include:
+  - project: sysadmin/ci-utilities
+    file:
+      #      - /gitlab-templates/snap-snapcraft-destructive.yml
+      - /gitlab-templates/snap-snapcraft-lxd.yml
diff --git a/patches/810-snap-backend-updates.patch b/patches/810-snap-backend-updates.patch
new file mode 100644
index 0000000..8391d29
--- /dev/null
+++ b/patches/810-snap-backend-updates.patch
@@ -0,0 +1,232 @@
+From 41040a1f085a8294e42321f684a55106038d6a45 Mon Sep 17 00:00:00 2001
+From: Kevin Ottens <kevin.ottens at enioka.com>
+Date: Thu, 4 Apr 2024 11:48:23 +0200
+Subject: [PATCH 1/3] snap: cache the size information in the SnapResource
+
+Depending where the latest QSnapdSnap object is coming from it might old
+or not a value for the download and installed sizes. To avoid loosing
+those between refreshSnap() calls we thus cache them in the SnapResource
+itself.
+---
+ .../backends/SnapBackend/SnapBackend.cpp      |  1 +
+ .../backends/SnapBackend/SnapResource.cpp     | 37 +++++++++++++++++--
+ .../backends/SnapBackend/SnapResource.h       |  6 +++
+ 3 files changed, 40 insertions(+), 4 deletions(-)
+
+diff --git a/libdiscover/backends/SnapBackend/SnapBackend.cpp b/libdiscover/backends/SnapBackend/SnapBackend.cpp
+index 0e60bf4646..1b9e2857fb 100644
+--- a/libdiscover/backends/SnapBackend/SnapBackend.cpp
++++ b/libdiscover/backends/SnapBackend/SnapBackend.cpp
+@@ -270,6 +270,7 @@ void SnapBackend::refreshStates()
+             bool contained = kContains(resources, [res](const StreamResult &in) {
+                 return in.resource == res;
+             });
++            res->updateSizes();
+             if (contained)
+                 res->setState(AbstractResource::Installed);
+             else
+diff --git a/libdiscover/backends/SnapBackend/SnapResource.cpp b/libdiscover/backends/SnapBackend/SnapResource.cpp
+index b7c33835c0..007ea21b84 100644
+--- a/libdiscover/backends/SnapBackend/SnapResource.cpp
++++ b/libdiscover/backends/SnapBackend/SnapResource.cpp
+@@ -72,6 +72,8 @@ const QStringList SnapResource::s_topObjects({QStringLiteral("qrc:/qml/Permissio
+ SnapResource::SnapResource(QSharedPointer<QSnapdSnap> snap, AbstractResource::State state, SnapBackend *backend)
+     : AbstractResource(backend)
+     , m_state(state)
++    , m_installedSize(0)
++    , m_downloadSize(0)
+     , m_snap(snap)
+ {
+     setObjectName(snap->name());
+@@ -100,8 +102,11 @@ QString SnapResource::comment()
+ 
+ quint64 SnapResource::size()
+ {
+-    // return isInstalled() ? m_snap->installedSize() : m_snap->downloadSize();
+-    return m_snap->downloadSize();
++    if (m_state == AbstractResource::Installed) {
++        return installedSize();
++    } else {
++        return downloadSize();
++    }
+ }
+ 
+ QVariant SnapResource::icon() const
+@@ -298,9 +303,12 @@ void SnapResource::setSnap(const QSharedPointer<QSnapdSnap> &snap)
+     if (m_snap == snap)
+         return;
+ 
+-    const bool newSize = m_snap->installedSize() != snap->installedSize() || m_snap->downloadSize() != snap->downloadSize();
++    const auto oldSize = size();
+     m_snap = snap;
+-    if (newSize)
++    updateSizes();
++    const auto newSize = size();
++
++    if (newSize != oldSize)
+         Q_EMIT sizeChanged();
+ 
+     Q_EMIT newSnap();
+@@ -468,6 +476,27 @@ void SnapResource::setChannel(const QString &channelName)
+ #endif
+ }
+ 
++quint64 SnapResource::installedSize() const
++{
++    return m_installedSize;
++}
++
++quint64 SnapResource::downloadSize() const
++{
++    return m_downloadSize;
++}
++
++void SnapResource::updateSizes()
++{
++    if (m_snap->installedSize() > 0) {
++        m_installedSize = m_snap->installedSize();
++    }
++
++    if (m_snap->downloadSize() > 0) {
++        m_downloadSize = m_snap->downloadSize();
++    }
++}
++
+ void SnapResource::refreshSnap()
+ {
+     auto request = client()->find(QSnapdClient::FindFlag::MatchName, m_snap->name());
+diff --git a/libdiscover/backends/SnapBackend/SnapResource.h b/libdiscover/backends/SnapBackend/SnapResource.h
+index e7f4413edb..4f46036a34 100644
+--- a/libdiscover/backends/SnapBackend/SnapResource.h
++++ b/libdiscover/backends/SnapBackend/SnapResource.h
+@@ -68,6 +68,10 @@ public:
+     QString channel() const;
+     void setChannel(const QString &channel);
+ 
++    quint64 installedSize() const;
++    quint64 downloadSize() const;
++    void updateSizes();
++
+     QSharedPointer<QSnapdSnap> snap() const
+     {
+         return m_snap;
+@@ -82,6 +86,8 @@ public:
+     void refreshSnap();
+     void gotIcon();
+     AbstractResource::State m_state;
++    quint64 m_installedSize;
++    quint64 m_downloadSize;
+ 
+     QSharedPointer<QSnapdSnap> m_snap;
+     mutable QVariant m_icon;
+-- 
+GitLab
+
+
+From e5c32ebe81a489912eeab8c01de04506845bc144 Mon Sep 17 00:00:00 2001
+From: Kevin Ottens <kevin.ottens at enioka.com>
+Date: Thu, 4 Apr 2024 11:48:32 +0200
+Subject: [PATCH 2/3] snap: start checking for updates
+
+It indeed auto-updates by default but a) this is not instant, one might
+open Discover in between two auto-update attempts and b) snapd can be
+configured to disable auto-updates.
+
+Modify the backend to have a proper list of updates being reported in
+order to cover the two cases above.
+---
+ .../backends/SnapBackend/SnapBackend.cpp      | 19 +++++++++++++++++++
+ .../backends/SnapBackend/SnapBackend.h        |  4 +---
+ 2 files changed, 20 insertions(+), 3 deletions(-)
+
+diff --git a/libdiscover/backends/SnapBackend/SnapBackend.cpp b/libdiscover/backends/SnapBackend/SnapBackend.cpp
+index 1b9e2857fb..82e66a963e 100644
+--- a/libdiscover/backends/SnapBackend/SnapBackend.cpp
++++ b/libdiscover/backends/SnapBackend/SnapBackend.cpp
+@@ -84,6 +84,8 @@ SnapBackend::SnapBackend(QObject *parent)
+     , m_updater(new StandardBackendUpdater(this))
+     , m_reviews(OdrsReviewsBackend::global())
+ {
++    connect(m_updater, &StandardBackendUpdater::updatesCountChanged, this, &SnapBackend::updatesCountChanged);
++
+     connect(m_reviews.data(), &OdrsReviewsBackend::ratingsReady, this, [this] {
+         m_reviews->emitRatingFetched(this, kTransform<QList<AbstractResource *>>(m_resources.values(), [](AbstractResource *r) {
+                                          return r;
+@@ -257,6 +259,22 @@ Transaction *SnapBackend::removeApplication(AbstractResource *_app)
+     return new SnapTransaction(&m_client, app, Transaction::RemoveRole, AbstractResource::None);
+ }
+ 
++void SnapBackend::checkForUpdates()
++{
++    auto ret = new StoredResultsStream({populate(m_client.findRefreshable())});
++    connect(ret, &StoredResultsStream::finishedResources, this, [this](const QVector<StreamResult> &resources) {
++        for (SnapResource *res : std::as_const(m_resources)) {
++            bool contained = kContains(resources, [res](const StreamResult &in) {
++                return in.resource == res;
++            });
++            if (contained) {
++                res->setState(AbstractResource::Upgradeable);
++                res->updateSizes();
++            }
++        }
++    });
++}
++
+ QString SnapBackend::displayName() const
+ {
+     return QStringLiteral("Snap");
+@@ -276,6 +294,7 @@ void SnapBackend::refreshStates()
+             else
+                 res->setState(AbstractResource::None);
+         }
++        checkForUpdates();
+     });
+ }
+ 
+diff --git a/libdiscover/backends/SnapBackend/SnapBackend.h b/libdiscover/backends/SnapBackend/SnapBackend.h
+index 8a9b6d3a65..7e2f885bb2 100644
+--- a/libdiscover/backends/SnapBackend/SnapBackend.h
++++ b/libdiscover/backends/SnapBackend/SnapBackend.h
+@@ -43,9 +43,7 @@ public:
+     {
+         return m_fetching;
+     }
+-    void checkForUpdates() override
+-    {
+-    }
++    void checkForUpdates() override;
+     bool hasApplications() const override
+     {
+         return true;
+-- 
+GitLab
+
+
+From 03f3e05cae6484126410efef0f4e43310cb92e10 Mon Sep 17 00:00:00 2001
+From: Kevin Ottens <kevin.ottens at enioka.com>
+Date: Thu, 4 Apr 2024 15:04:49 +0200
+Subject: [PATCH 3/3] snap: place a refresh request for upgradeable packages
+
+This allows to manually upgrade snap packages as well.
+
+BUG: 476654
+---
+ libdiscover/backends/SnapBackend/SnapTransaction.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/libdiscover/backends/SnapBackend/SnapTransaction.cpp b/libdiscover/backends/SnapBackend/SnapTransaction.cpp
+index d1c1d7e39f..9d300f499e 100644
+--- a/libdiscover/backends/SnapBackend/SnapTransaction.cpp
++++ b/libdiscover/backends/SnapBackend/SnapTransaction.cpp
+@@ -24,6 +24,8 @@ SnapTransaction::SnapTransaction(QSnapdClient *client, SnapResource *app, Role r
+ {
+     if (role == RemoveRole)
+         setRequest(m_client->remove(app->packageName()));
++    else if (app->state() == AbstractResource::Upgradeable)
++        setRequest(m_client->refresh(app->packageName()));
+     else
+         setRequest(m_client->install(app->packageName()));
+ }
+-- 
+GitLab
+
diff --git a/patches/873-snap-backend-desktop-launch-BACKPORT.patch b/patches/873-snap-backend-desktop-launch-BACKPORT.patch
new file mode 100644
index 0000000..3f3842f
--- /dev/null
+++ b/patches/873-snap-backend-desktop-launch-BACKPORT.patch
@@ -0,0 +1,133 @@
+diff --git a/libdiscover/backends/SnapBackend/CMakeLists.txt b/libdiscover/backends/SnapBackend/CMakeLists.txt
+index a3bb0f005..ecb1f763a 100644
+--- a/libdiscover/backends/SnapBackend/CMakeLists.txt
++++ b/libdiscover/backends/SnapBackend/CMakeLists.txt
+@@ -1,7 +1,23 @@
+ add_subdirectory(libsnapclient)
+ 
+-add_library(snap-backend MODULE SnapResource.cpp SnapBackend.cpp SnapTransaction.cpp snapui.qrc)
+-target_link_libraries(snap-backend Qt::Gui Qt::Core Qt::Concurrent KF6::CoreAddons KF6::ConfigCore Discover::Common Snapd::Core)
++set(snap-backend_SRCS
++        SnapResource.cpp
++        SnapBackend.cpp
++        SnapTransaction.cpp
++        snapui.qrc
++)
++ecm_qt_declare_logging_category(snap-backend_SRCS HEADER libdiscover_snap_debug.h IDENTIFIER LIBDISCOVER_SNAP_LOG CATEGORY_NAME org.kde.plasma.libdiscover.snap DESCRIPTION "libdiscover snap backend" EXPORT DISCOVER)
++add_library(snap-backend MODULE ${snap-backend_SRCS})
++target_link_libraries(snap-backend
++    Qt::Gui
++    Qt::Core
++    Qt::Concurrent
++    KF6::CoreAddons
++    KF6::ConfigCore
++    KF6::KIOGui
++    Discover::Common
++    Snapd::Core
++)
+ 
+ if ("${Snapd_VERSION}" VERSION_GREATER 1.40)
+     target_compile_definitions(snap-backend PRIVATE -DSNAP_COMMON_IDS -DSNAP_CHANNELS)
+diff --git a/libdiscover/backends/SnapBackend/SnapResource.cpp b/libdiscover/backends/SnapBackend/SnapResource.cpp
+index 4374c8790..ca17b2425 100644
+--- a/libdiscover/backends/SnapBackend/SnapResource.cpp
++++ b/libdiscover/backends/SnapBackend/SnapResource.cpp
+@@ -6,9 +6,13 @@
+ 
+ #include "SnapResource.h"
+ #include "SnapBackend.h"
++#include "libdiscover_snap_debug.h"
++#include <KIO/ApplicationLauncherJob>
++#include <KService>
+ #include <KLocalizedString>
+ #include <QBuffer>
+ #include <QDebug>
++#include <QFile>
+ #include <QImageReader>
+ #include <QProcess>
+ #include <QStandardItemModel>
+@@ -282,9 +286,62 @@ void SnapResource::fetchScreenshots()
+     Q_EMIT screenshotsFetched(screenshots);
+ }
+ 
++/**
++ * Tries to obtain a launchable desktop file for this snap, in this order:
++ *
++ * 1. Any app with the same name as the snap and a desktop file (the main app)
++ * 2. The first app with a desktop file (the next best app)
++ * 3. The expected desktop file for the main app
++ *
++ * @return The path to the selected launchable desktop file.
++ */
++QString SnapResource::launchableDesktopFile() const
++{
++    QString desktopFile;
++    qCDebug(LIBDISCOVER_SNAP_LOG) << "Snap: " << packageName() << " - " << m_snap->appCount() << " app(s) detected";
++    for (int i = 0; i < m_snap->appCount(); i++) {
++        if (m_snap->app(i)->desktopFile().isEmpty()) {
++            qCDebug(LIBDISCOVER_SNAP_LOG) << "App " << i << ": " << m_snap->app(i)->name() << ": " << "No desktop file, skipping";
++            continue;
++        }
++        if (packageName().compare(m_snap->app(i)->name(), Qt::CaseInsensitive) == 0) {
++            qCDebug(LIBDISCOVER_SNAP_LOG) << "App " << i << ": " << m_snap->app(i)->name() << ": " << "Main app, stopping search";
++            desktopFile = m_snap->app(i)->desktopFile();
++            break;
++        }
++        if (desktopFile.isEmpty()) {
++            qCDebug(LIBDISCOVER_SNAP_LOG) << "App " << i << ": " << m_snap->app(i)->name() << ": " << "First candidate, keeping for now";
++            desktopFile = m_snap->app(i)->desktopFile();
++        }
++    }
++    if (desktopFile.isEmpty()) {
++        qCWarning(LIBDISCOVER_SNAP_LOG) << "No desktop file found for this snap, trying expected path for the main app desktop file";
++        desktopFile = QStringLiteral("/var/lib/snapd/desktop/applications/")
++                      + packageName()
++                      + QStringLiteral("_")
++                      + packageName()
++                      + QStringLiteral(".desktop");
++    }
++    return desktopFile;
++}
++
++/**
++ * Launches a snap using its desktop file.
++ *
++ * If no desktop file is found, defaults back to `snap run`, which will fail in Ubuntu Core environments.
++ */
+ void SnapResource::invokeApplication() const
+ {
+-    QProcess::startDetached(QStringLiteral("snap"), {QStringLiteral("run"), packageName()});
++    QString desktopFile = launchableDesktopFile();
++    if (QFile::exists(desktopFile)) {
++        qCDebug(LIBDISCOVER_SNAP_LOG) << "Launching desktop file " << desktopFile;
++        KService::Ptr service = KService::serviceByDesktopPath(desktopFile);
++        KIO::ApplicationLauncherJob *job = new KIO::ApplicationLauncherJob(service);
++        job->start();
++    } else {
++        qCWarning(LIBDISCOVER_SNAP_LOG) << "No desktop file found, defaulting to snap run";
++        QProcess::startDetached(QStringLiteral("snap"), {QStringLiteral("run"), packageName()});
++    }
+ }
+ 
+ AbstractResource::Type SnapResource::type() const
+@@ -358,7 +415,7 @@ public:
+                     // qDebug() << "xxx" << plug->name() << plug->label() << plug->interface() << slot->snap() << "slot:" << slot->name() <<
+                     // slot->snap() << slot->interface() << slot->label();
+                     item->setCheckable(true);
+-                    item->setCheckState(plug->connectionCount() > 0 ? Qt::Checked : Qt::Unchecked);
++                    item->setCheckState(plug->connectedSlotCount() > 0 ? Qt::Checked : Qt::Unchecked);
+                     item->setData(plug->name(), PlugNameRole);
+                     item->setData(slot->snap(), SlotSnapRole);
+                     item->setData(slot->name(), SlotNameRole);
+diff --git a/libdiscover/backends/SnapBackend/SnapResource.h b/libdiscover/backends/SnapBackend/SnapResource.h
+index 7a3a8abbd..b35ce5586 100644
+--- a/libdiscover/backends/SnapBackend/SnapResource.h
++++ b/libdiscover/backends/SnapBackend/SnapResource.h
+@@ -42,6 +42,7 @@ public:
+     {
+         return true;
+     }
++    QString launchableDesktopFile() const;
+     void invokeApplication() const override;
+     void fetchChangelog() override;
+     void fetchScreenshots() override;
diff --git a/snapcraft.yaml b/snapcraft.yaml
new file mode 100644
index 0000000..81e4668
--- /dev/null
+++ b/snapcraft.yaml
@@ -0,0 +1,193 @@
+
+# SPDX-FileCopyrightText: 2024 Antoine Gonzalez <antoine.gonzalez at enioka.com>
+#
+# SPDX-License-Identifier: CC0-1.0
+
+# FIXME's:
+# - plasma-discover:
+#       -> snapd-glib's snapd_snap_get_apps returns frequently returns an empty list
+#       -> APPARMOR denied on `/proc/sys/kernel/core_pattern` file read
+# - plasma-discover-notifier:
+#       -> no snapd backend exists for notifier
+#       -> APPARMOR denied on `/proc/sys/kernel/core_pattern` file read
+
+---
+name: plasma-discover
+confinement: strict
+grade: stable
+base: core22
+adopt-info: plasma-discover
+apps:
+    plasma-discover:
+        environment:
+            LD_LIBRARY_PATH: $SNAP/usr/lib/x86_64-linux-gnu/plasma-discover:$LD_LIBRARY_PATH
+            _KDE_APPLICATIONS_AS_FORKING: 1
+        extensions:
+            - kde-neon-6
+        common-id: org.kde.discover.desktop
+        desktop: usr/share/applications/org.kde.discover.desktop
+        command: usr/bin/plasma-discover
+        slots:
+            - dbus-kde-discover
+        plugs:
+            - desktop
+            - wayland
+            - x11
+            - desktop-launch
+            - snapd-control
+            - screen-inhibit-control
+            - network
+            - network-status
+            - network-manager
+            - system-observe         # Needed to read /proc/cgroups
+            - mount-observe          # Needed to read /proc/self/mountinfo
+            - system-snap
+            - home-snap
+    plasma-discover-notifier:
+        environment:
+            LD_LIBRARY_PATH: $SNAP/usr/lib/x86_64-linux-gnu/plasma-discover:$LD_LIBRARY_PATH
+            _KDE_APPLICATIONS_AS_FORKING: 1
+        extensions:
+            - kde-neon-6
+        command: usr/lib/x86_64-linux-gnu/libexec/DiscoverNotifier
+        daemon: simple
+        passthrough:
+            daemon-scope: user
+        restart-delay: 1s
+        slots:
+            - dbus-kde-discover-notifier
+        plugs:
+            - desktop
+            - wayland
+            - x11
+            - snapd-control
+            - network
+            - network-status
+            - network-manager
+            - system-snap
+            - home-snap
+assumes:
+- snapd2.58.3
+compression: lzo
+slots:
+    dbus-kde-discover:
+        interface: dbus
+        bus: session
+        name: org.kde.discover
+    dbus-kde-discover-notifier:
+        interface: dbus
+        bus: session
+        name: org.kde.discover.notifier
+plugs:
+    system-snap:
+        interface: system-files
+        read:
+            - /snap           # $SNAP
+            - /var/snap       # $SNAP_DATA and $SNAP_COMMON
+            - /var/lib/snapd  # Needed to read snap dir options
+            - /usr/bin/snap   # Needed to run snap commands
+            - /run/user       # Needed to read the Auth file of installed snaps
+            - /etc/xdg/menus  # Needed for desktop-launch
+            - /usr/share/applications/mimeapps.list  # Needed for desktop-launch
+    home-snap:
+        interface: personal-files
+        read:
+            - $HOME/.snap/auth.json
+        write:
+            - $HOME/snap      # Needed to access and create dirs for installed snaps
+environment: {}
+hooks: {}
+layout: {}
+package-repositories:
+-   type: apt
+    components:
+    - main
+    suites:
+    - jammy
+    key-id: 444DABCF3667D0283F894EDDE6D4736255751E5D
+    url: http://archive.neon.kde.org/user
+    key-server: keyserver.ubuntu.com
+parts:
+    plasma-discover:
+        parse-info:
+        - usr/share/metainfo/org.kde.discover.appdata.xml
+        source: https://invent.kde.org/plasma/discover.git
+        source-type: git
+        source-branch: v6.0.5  # v6.0.80 onwards require ECM 6.2.0, kde-neon-6 extension only has 6.1.0
+        plugin: cmake
+        build-packages:
+        - libsnapd-glib-dev
+        - libsnapd-qt-dev
+        - libappstreamqt-dev
+        stage-packages:
+        - libsnapd-glib1
+        - libsnapd-qt1
+        - libappstreamqt-3
+        override-pull: |
+            craftctl default
+            # Apply patches
+            git apply $CRAFT_PROJECT_DIR/patches/810-snap-backend-updates.patch
+            git apply $CRAFT_PROJECT_DIR/patches/873-snap-backend-desktop-launch-BACKPORT.patch
+            # Force-disable KNS backend which does not have an associated cmake variable
+            sed -i '11,13d' $SNAPCRAFT_PART_SRC/libdiscover/backends/CMakeLists.txt
+        cmake-parameters:
+        - "--log-level=STATUS"
+        - "-DBUILD_DummyBackend=OFF"
+        - "-DBUILD_FlatpakBackend=OFF"
+        - "-DBUILD_FwupdBackend=OFF"
+        - "-DBUILD_RpmOstreeBackend=OFF"
+        - "-DBUILD_SnapBackend=ON"
+        - "-DBUILD_SteamOSBackend=OFF"
+        - "-DBUILD_TESTING=OFF"
+        - "-DBUILD_WITH_QT6=ON"
+        - "-DBUILD_SHARED_LIBS=TRUE"
+        - "-DCMAKE_BUILD_TYPE=Release"
+        - "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON"
+        - "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON"
+        - "-DCMAKE_FIND_ROOT_PATH=$CRAFT_STAGE\\;/snap/kde-qt6-core22-sdk/current\\;/snap/kf6-core22-sdk/current\\;/usr"
+        - "-DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF"
+        - "-DCMAKE_INSTALL_LIBDIR=lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR"
+        - "-DCMAKE_INSTALL_LOCALSTATEDIR=/var"
+        - "-DCMAKE_INSTALL_PREFIX=/usr"
+        - "-DCMAKE_INSTALL_RUNSTATEDIR=/run"
+        - "-DCMAKE_INSTALL_SYSCONFDIR=/etc"
+        - "-DCMAKE_LIBRARY_PATH=lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR"
+        - "-DCMAKE_PREFIX_PATH=$CRAFT_STAGE\\;/snap/kde-qt6-core22-sdk/current\\;/snap/kf6-core22-sdk/current\\;/usr"
+        - "-DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON"
+        - "-DCMAKE_VERBOSE_MAKEFILE=ON"
+        - "-DENABLE_TESTING=OFF"
+        - "-DKDE_INSTALL_FULL_APPDIR=$SNAP/usr/share/applications"
+        - "-DKDE_INSTALL_PLUGINDIR=/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/qt6/plugins/"
+        - "-DKDE_INSTALL_USE_QT_SYS_PATHS=FALSE"
+        - "-DKDE_SKIP_TEST_SETTINGS=ON"
+        - "-DQT_MAJOR_VERSION=6"
+        prime:
+        - "-usr/lib/*/cmake/*"
+        - "-usr/include/*"
+        - "-usr/share/ECM/*"
+        - "-usr/share/man/*"
+        - "-usr/share/icons/breeze-dark*"
+        - "-usr/bin/X11"
+        - "-usr/lib/gcc/$CRAFT_ARCH_TRIPLET_BUILD_FOR/6.0.0"
+        - "-usr/lib/aspell/*"
+        - "-usr/share/lintian"
+        - "-patches"
+        build-environment:
+        - PATH: /snap/kde-qt6-core22-sdk/current/usr/bin:/snap/kf6-core22-sdk/current/usr/bin${PATH:+:$PATH}
+        - XDG_DATA_DIRS: $CRAFT_STAGE/usr/share:/snap/kde-qt6-core22-sdk/current/usr/share:/snap/kf6-core22-sdk/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}
+        - XDG_CONFIG_HOME: $CRAFT_STAGE/etc/xdg:/snap/kde-qt6-core22-sdk/etc/xdg:/snap/kf6-core22-sdk/etc/xdg:/etc/xdg${XDG_CONFIG_HOME:+:$XDG_CONFIG_HOME}
+        - LD_LIBRARY_PATH: /snap/kde-qt6-core22-sdk/current/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR:/snap/kf6-core22-sdk/current/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR:/snap/kde-qt6-core22-sdk/current/usr/lib:/snap/kf6-core22-sdk/current/usr/lib:$CRAFT_STAGE/usr/lib:CRAFT_STAGE/usr/lib:$CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR{LD_LIBRARY_PATH:+:LD_LIBRARY_PATH}
+    cleanup:
+        after:
+        - plasma-discover
+        plugin: nil
+        build-snaps:
+        - core22
+        - kf6-core22
+        - kde-qt6-core22
+        override-prime: |
+            set -eux
+            for snap in "core22" "kf6-core22" "kde-qt6-core22"
+            do
+                cd "/snap/$snap/current" && find . -type f,l -exec rm -rf "$CRAFT_PRIME/{}" \;
+            done


More information about the Neon-commits mailing list