diff --git a/extensions/desktop/command-chain-kde/Makefile b/extensions/desktop/command-chain-kde/Makefile new file mode 100644 index 0000000000..602d097a4e --- /dev/null +++ b/extensions/desktop/command-chain-kde/Makefile @@ -0,0 +1,13 @@ +#!/usr/bin/make -f + +BIN_DIR := $(DESTDIR)/snap/command-chain +GPU_WRAPPER := + +scripts = hooks-configure-desktop desktop-launch run $(GPU_WRAPPER) + +*: + install -D -m755 "$@" "$(BIN_DIR)"/"$@" + +install: $(scripts) + +.PHONY: $(scripts) diff --git a/extensions/desktop/command-chain-kde/desktop-launch b/extensions/desktop/command-chain-kde/desktop-launch new file mode 100644 index 0000000000..b1c663416a --- /dev/null +++ b/extensions/desktop/command-chain-kde/desktop-launch @@ -0,0 +1,15 @@ +#!/bin/bash + +if [ "$QT_VERSION" == "6" ]; then + +set -- "${SNAP}/kf6/snap/command-chain/desktop-launch6" "$@" +# shellcheck source=/dev/null +source "${SNAP}/snap/command-chain/run" + +elif [ "$QT_VERSION" == "5" ]; then + +set -- "${SNAP}/kf5/snap/command-chain/desktop-launch" "$@" +# shellcheck source=/dev/null +source "${SNAP}/snap/command-chain/run" + +fi diff --git a/extensions/desktop/command-chain-kde/gpu-2404-wrapper b/extensions/desktop/command-chain-kde/gpu-2404-wrapper new file mode 100644 index 0000000000..997466660d --- /dev/null +++ b/extensions/desktop/command-chain-kde/gpu-2404-wrapper @@ -0,0 +1,5 @@ +#!/bin/bash + +set -- "${SNAP}/gpu-2404/bin/gpu-2404-provider-wrapper" "$@" +# shellcheck source=/dev/null +source "${SNAP}/snap/command-chain/run" diff --git a/extensions/desktop/command-chain-kde/hooks-configure-desktop b/extensions/desktop/command-chain-kde/hooks-configure-desktop new file mode 100644 index 0000000000..ad1fce94cc --- /dev/null +++ b/extensions/desktop/command-chain-kde/hooks-configure-desktop @@ -0,0 +1,5 @@ +#!/bin/bash + +set -- "${SNAP}/kf6/command-chain/hooks-configure-desktop" "$@" +# shellcheck source=/dev/null +source "${SNAP}/snap/command-chain/run" diff --git a/extensions/desktop/command-chain-kde/hooks-configure-fonts b/extensions/desktop/command-chain-kde/hooks-configure-fonts new file mode 100644 index 0000000000..3431e6c80d --- /dev/null +++ b/extensions/desktop/command-chain-kde/hooks-configure-fonts @@ -0,0 +1,5 @@ +#!/bin/bash + +set -- "${SNAP}/kf6/command-chain/hooks-configure-fonts" "$@" +# shellcheck source=/dev/null +source "${SNAP}/snap/command-chain/run" diff --git a/extensions/desktop/command-chain-kde/run b/extensions/desktop/command-chain-kde/run new file mode 100644 index 0000000000..4b0b41a93a --- /dev/null +++ b/extensions/desktop/command-chain-kde/run @@ -0,0 +1,25 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "Usage: run " + exit 1 +fi + +if [ -z "${SNAP}" ]; then + echo "Not running inside a snap context: SNAP not declared" + exit +fi + + +if [ ! -f "$1" ]; then + echo "Content snap command-chain for $1 not found: ensure slot is connected" + exit +fi + +# emulate "exec $@" using "source" +# have to disable "unused variables" because checkshell doesn't know that $BASH_ARGV0 is $0 +# shellcheck disable=SC2034 # Unused variables left for readability +BASH_ARGV0=$1 +shift +# shellcheck source=/dev/null +source "$0" diff --git a/snapcraft/extensions/kde_neon.py b/snapcraft/extensions/kde_neon.py index e4f0f7b534..17eaf8e322 100644 --- a/snapcraft/extensions/kde_neon.py +++ b/snapcraft/extensions/kde_neon.py @@ -25,28 +25,35 @@ from .extension import Extension, get_extensions_data_dir, prepend_to_env -_SDK_SNAP = {"core22": "kf5-5-113-qt-5-15-11-core22-sdk"} - - -@dataclasses.dataclass -class ExtensionInfo: - """Content/SDK build information.""" - - cmake_args: str +_QT5_SDK_SNAP = {"core22": "kde-qt5-core22-sdk", "core24": "kde-qt5-core24-sdk"} +_KF5_SDK_SNAP = {"core22": "kf5-core22-sdk", "core24": "kf5-core24-sdk"} +_QT_VERSION = "5" @dataclasses.dataclass class KDESnaps: """A structure of KDE related snaps. - :cvar sdk: The name of the SDK snap to use. - :cvar content: The name of the content snap to use. - :cvar builtin: True if the SDK is built into the content snap. + :cvar qt5_sdk_snap: The name of the qt5 SDK snap to use. + :cvar kf5_sdk_snap: The name of the kf5 SDK snap to use. + :cvar content_qt5: The name of the qt5 content snap to use. + :cvar content_kf5: The name of the kf5 content snap to use. + :cvar qt_version: The major version of qt to use. + :cvar gpu_plugs: The gpu plugs to use with gpu-2404. + :cvar gpu_layouts: The gpu layouts to use with gpu-2404. + :cvar qt5_builtin: True if the SDK is built into the qt5 content snap. + :cvar kf5_builtin: True if the SDK is built into the kf5 content snap. """ - sdk: str - content: str - builtin: bool = True + qt5_sdk_snap: str + kf5_sdk_snap: str + content_qt5: str + content_kf5: str + qt_version: str + gpu_plugs: Dict[str, Any] + gpu_layouts: Dict[str, Any] + qt5_builtin: bool = True + kf5_builtin: bool = True class KDENeon(Extension): @@ -76,7 +83,7 @@ class KDENeon(Extension): @staticmethod @overrides def get_supported_bases() -> Tuple[str, ...]: - return ("core22",) + return ("core22", "core24") @staticmethod @overrides @@ -90,52 +97,114 @@ def is_experimental(base: Optional[str]) -> bool: @overrides def get_app_snippet(self, *, app_name: str) -> Dict[str, Any]: + command_chain = ["snap/command-chain/desktop-launch"] + if self.yaml_data["base"] == "core24": + command_chain.insert(0, "snap/command-chain/gpu-2404-wrapper") return { - "command-chain": ["snap/command-chain/desktop-launch"], - "plugs": ["desktop", "desktop-legacy", "opengl", "wayland", "x11"], + "command-chain": command_chain, + "plugs": [ + "desktop", + "desktop-legacy", + "opengl", + "wayland", + "x11", + "audio-playback", + "unity7", + "network", + "network-bind", + ], } @functools.cached_property def kde_snaps(self) -> KDESnaps: """Return the KDE related snaps to use to construct the environment.""" base = self.yaml_data["base"] - sdk_snap = _SDK_SNAP[base] + qt5_sdk_snap = _QT5_SDK_SNAP[base] + kf5_sdk_snap = _KF5_SDK_SNAP[base] + qt_version = _QT_VERSION + + match base: + case "core22": + gpu_plugs = {} + gpu_layouts = { + "/usr/share/libdrm": {"bind": "$SNAP/kf5-core22/usr/share/libdrm"}, + } + case "core24": + gpu_plugs = { + "gpu-2404": { + "interface": "content", + "target": "$SNAP/gpu-2404", + "default-provider": "mesa-2404", + }, + } + gpu_layouts = { + "/usr/share/libdrm": {"bind": "$SNAP/gpu-2404/libdrm"}, + "/usr/share/drirc.d": {"symlink": "$SNAP/gpu-2404/drirc.d"}, + "/usr/share/X11/XErrorDB": { + "symlink": "$SNAP/gpu-2404/X11/XErrorDB" + }, + } + case _: + raise AssertionError(f"Unsupported base: {base}") build_snaps: List[str] = [] for part in self.yaml_data["parts"].values(): build_snaps.extend(part.get("build-snaps", [])) - # use the sdk snap if it is defined in any part's build-snaps - # otherwise, assume it is built into the content snap - matcher = re.compile(r"kf5-\d+-\d+-qt-\d+.*-" + base + r"-sdk.*") - sdk_snap_candidates = [s for s in build_snaps if matcher.match(s)] - if sdk_snap_candidates: - sdk_snap = sdk_snap_candidates[0].split("/")[0] - builtin = False + matcher = re.compile(r"kde-qt5-" + base + r"-sdk.*") + qt5_sdk_snap_candidates = [s for s in build_snaps if matcher.match(s)] + if qt5_sdk_snap_candidates: + qt5_sdk_snap = qt5_sdk_snap_candidates[0].split("/")[0] + qt5_builtin = False else: - builtin = True - # The same except the trailing -sd - content = sdk_snap[:-4] - - return KDESnaps(sdk=sdk_snap, content=content, builtin=builtin) - - @functools.cached_property - def ext_info(self) -> ExtensionInfo: - """Return the extension info cmake_args, provider, content, build_snaps.""" - cmake_args = "-DCMAKE_FIND_ROOT_PATH=/snap/" + self.kde_snaps.sdk + "/current" + qt5_builtin = True - return ExtensionInfo(cmake_args=cmake_args) + matcher = re.compile(r"kf5-" + base + r"-sdk.*") + kf5_sdk_snap_candidates = [s for s in build_snaps if matcher.match(s)] + if kf5_sdk_snap_candidates: + kf5_sdk_snap = kf5_sdk_snap_candidates[0].split("/")[0] + kf5_builtin = False + else: + kf5_builtin = True + # The same except the trailing -sdk + content_qt5_snap = qt5_sdk_snap[:-4] + content_kf5_snap = kf5_sdk_snap[:-4] + + return KDESnaps( + qt5_sdk_snap=qt5_sdk_snap, + content_qt5=content_qt5_snap, + qt5_builtin=qt5_builtin, + kf5_sdk_snap=kf5_sdk_snap, + content_kf5=content_kf5_snap, + kf5_builtin=kf5_builtin, + gpu_layouts=gpu_layouts, + gpu_plugs=gpu_plugs, + qt_version=qt_version, + ) @overrides def get_root_snippet(self) -> Dict[str, Any]: - platform_snap = self.kde_snaps.content - content_snap = self.kde_snaps.content + "-all" + platform_kf5_snap = self.kde_snaps.content_kf5 + content_kf5_snap = self.kde_snaps.content_kf5 + "-all" + gpu_plugs = self.kde_snaps.gpu_plugs + gpu_layouts = self.kde_snaps.gpu_layouts + qt_version = self.kde_snaps.qt_version return { - "assumes": ["snapd2.43"], # for 'snapctl is-connected' + "assumes": ["snapd2.58.3"], # for cups support "compression": "lzo", "plugs": { "desktop": {"mount-host-font-cache": False}, + "gtk-2-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, + "gtk-3-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, "icon-themes": { "interface": "content", "target": "$SNAP/data-dir/icons", @@ -146,52 +215,121 @@ def get_root_snippet(self) -> Dict[str, Any]: "target": "$SNAP/data-dir/sounds", "default-provider": "gtk-common-themes", }, - platform_snap: { - "content": content_snap, + platform_kf5_snap: { + "content": content_kf5_snap, "interface": "content", - "default-provider": platform_snap, + "default-provider": platform_kf5_snap, "target": "$SNAP/kf5", }, + **gpu_plugs, + }, + "environment": { + "SNAP_DESKTOP_RUNTIME": "$SNAP/kf5", + "GTK_USE_PORTAL": "1", + "QT_VERSION": qt_version, }, - "environment": {"SNAP_DESKTOP_RUNTIME": "$SNAP/kf5"}, "hooks": { "configure": { "plugs": ["desktop"], "command-chain": ["snap/command-chain/hooks-configure-desktop"], } }, - "layout": {"/usr/share/X11": {"symlink": "$SNAP/kf5/usr/share/X11"}}, + "layout": { + "/usr/share/X11": {"symlink": "$SNAP/kf5/usr/share/X11"}, + "/usr/share/qt5": {"symlink": "$SNAP/kf5/usr/share/qt5"}, + **gpu_layouts, + }, } @overrides def get_part_snippet(self, *, plugin_name: str) -> Dict[str, Any]: - sdk_snap = self.kde_snaps.sdk - cmake_args = self.ext_info.cmake_args + qt5_sdk_snap = self.kde_snaps.qt5_sdk_snap + kf5_sdk_snap = self.kde_snaps.kf5_sdk_snap return { "build-environment": [ { "PATH": prepend_to_env( - "PATH", [f"/snap/{sdk_snap}/current/usr/bin"] + "PATH", + [ + f"/snap/{qt5_sdk_snap}/current/usr/bin", + f"/snap/{kf5_sdk_snap}/current/usr/bin", + ], ), }, { "XDG_DATA_DIRS": prepend_to_env( "XDG_DATA_DIRS", [ - f"$CRAFT_STAGE/usr/share:/snap/{sdk_snap}/current/usr/share", + "$CRAFT_STAGE/usr/share", + f"/snap/{qt5_sdk_snap}/current/usr/share", + f"/snap/{kf5_sdk_snap}/current/usr/share", "/usr/share", ], ), }, { - "SNAPCRAFT_CMAKE_ARGS": prepend_to_env( - "SNAPCRAFT_CMAKE_ARGS", + "XDG_CONFIG_HOME": prepend_to_env( + "XDG_CONFIG_HOME", + [ + "$CRAFT_STAGE/etc/xdg", + f"/snap/{qt5_sdk_snap}/current/etc/xdg", + f"/snap/{kf5_sdk_snap}/current/etc/xdg", + "/etc/xdg", + ], + ), + }, + { + "LD_LIBRARY_PATH": prepend_to_env( + "LD_LIBRARY_PATH", [ - cmake_args, + # Qt5 arch specific libs + f"/snap/{qt5_sdk_snap}/current/usr/lib/" + "${CRAFT_ARCH_TRIPLET_BUILD_FOR}", + # Qt5 libs + f"/snap/{qt5_sdk_snap}/current/usr/lib", + # kf5 arch specific libs + f"/snap/{kf5_sdk_snap}/current/usr/lib/" + "${CRAFT_ARCH_TRIPLET_BUILD_FOR}", + # blas + f"/snap/{kf5_sdk_snap}/current/usr/lib/" + "${CRAFT_ARCH_TRIPLET_BUILD_FOR}/blas", + # lapack + f"/snap/{kf5_sdk_snap}/current/usr/lib/" + "${CRAFT_ARCH_TRIPLET_BUILD_FOR}/lapack", + # kf6 libs + f"/snap/{kf5_sdk_snap}/current/usr/lib", + # Staged libs + "$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}", + "$CRAFT_STAGE/usr/lib", + "$CRAFT_STAGE/lib/", ], ), }, + { + "CMAKE_PREFIX_PATH": prepend_to_env( + "CMAKE_PREFIX_PATH", + [ + "$CRAFT_STAGE", + f"/snap/{qt5_sdk_snap}/current", + f"/snap/{kf5_sdk_snap}/current", + "/usr", + ], + separator=";", + ), + }, + { + "CMAKE_FIND_ROOT_PATH": prepend_to_env( + "CMAKE_FIND_ROOT_PATH", + [ + "$CRAFT_STAGE", + f"/snap/{qt5_sdk_snap}/current", + f"/snap/{kf5_sdk_snap}/current", + "/usr", + ], + separator=";", + ), + }, ], } @@ -205,15 +343,34 @@ def get_parts_snippet(self) -> Dict[str, Any]: # We can change this to the lightweight command-chain when # the content snap includes the desktop-launch from # https://github.com/canonical/snapcraft-desktop-integration - source = get_extensions_data_dir() / "desktop" / "kde-neon" - if self.kde_snaps.builtin: + source = get_extensions_data_dir() / "desktop" / "command-chain-kde" + + gpu_opts = {} + if self.yaml_data["base"] == "core24": + gpu_opts["make-parameters"] = ["GPU_WRAPPER=gpu-2404-wrapper"] + + if self.kde_snaps.kf5_builtin: return { "kde-neon/sdk": { "source": str(source), "plugin": "make", - "make-parameters": [f"PLATFORM_PLUG={self.kde_snaps.content}"], - "build-snaps": [self.kde_snaps.sdk], + "build-snaps": [ + self.kde_snaps.qt5_sdk_snap, + self.kde_snaps.kf5_sdk_snap, + ], + "build-packages": [ + "gettext", + "doxygen", + "graphviz", + "libxml2-utils", + "docbook-xml", + "docbook-xsl", + "libglx-dev", + "libgl-dev", + "libglvnd-dev", + ], + **gpu_opts, }, } @@ -221,6 +378,6 @@ def get_parts_snippet(self) -> Dict[str, Any]: "kde-neon/sdk": { "source": str(source), "plugin": "make", - "make-parameters": [f"PLATFORM_PLUG={self.kde_snaps.content}"], + **gpu_opts, }, } diff --git a/snapcraft/extensions/kde_neon_6.py b/snapcraft/extensions/kde_neon_6.py index 765b981762..861f3fba71 100644 --- a/snapcraft/extensions/kde_neon_6.py +++ b/snapcraft/extensions/kde_neon_6.py @@ -26,18 +26,33 @@ from .extension import Extension, get_extensions_data_dir, prepend_to_env -_QT6_SDK_SNAP = {"core22": "kde-qt6-core22-sdk"} -_KF6_SDK_SNAP = {"core22": "kf6-core22-sdk"} +_QT6_SDK_SNAP = {"core22": "kde-qt6-core22-sdk", "core24": "kde-qt6-core24-sdk"} +_KF6_SDK_SNAP = {"core22": "kf6-core22-sdk", "core24": "kf6-core24-sdk"} +_QT_VERSION = "6" @dataclasses.dataclass class KDESnaps6: - """A structure of KDE related snaps.""" + """A structure of KDE related snaps. + + :cvar qt6_sdk_snap: The name of the qt6 SDK snap to use. + :cvar kf6_sdk_snap: The name of the kf6 SDK snap to use. + :cvar content_qt6: The name of the qt6 content snap to use. + :cvar content_kf6: The name of the kf6 content snap to use. + :cvar qt_version: The major version of qt to use. + :cvar gpu_plugs: The gpu plugs to use with gpu-2404. + :cvar gpu_layouts: The gpu layouts to use with gpu-2404. + :cvar qt6_builtin: True if the SDK is built into the qt6 content snap. + :cvar kf6_builtin: True if the SDK is built into the kf6 content snap. + """ qt6_sdk_snap: str kf6_sdk_snap: str content_qt6: str content_kf6: str + qt_version: str + gpu_plugs: Dict[str, Any] + gpu_layouts: Dict[str, Any] qt6_builtin: bool = True kf6_builtin: bool = True @@ -51,7 +66,11 @@ class KDENeon6(Extension): It configures each application with the following plugs: \b + - Common GTK themes. + - breeze GTK theme. + - Common Qt themes. - Common Icon Themes. + - Breeze Icon theme. - Common Sound Themes. - The Qt6 and KDE Frameworks 6 runtime libraries and utilities. @@ -73,7 +92,7 @@ class KDENeon6(Extension): @staticmethod @overrides def get_supported_bases() -> Tuple[str, ...]: - return ("core22",) + return ("core22", "core24") @staticmethod @overrides @@ -87,8 +106,11 @@ def is_experimental(base: Optional[str]) -> bool: @overrides def get_app_snippet(self, *, app_name: str) -> Dict[str, Any]: + command_chain = ["snap/command-chain/desktop-launch"] + if self.yaml_data["base"] == "core24": + command_chain.insert(0, "snap/command-chain/gpu-2404-wrapper") return { - "command-chain": ["snap/command-chain/desktop-launch6"], + "command-chain": command_chain, "plugs": [ "desktop", "desktop-legacy", @@ -108,6 +130,28 @@ def kde_snaps(self) -> KDESnaps6: base = self.yaml_data["base"] qt6_sdk_snap = _QT6_SDK_SNAP[base] kf6_sdk_snap = _KF6_SDK_SNAP[base] + qt_version = _QT_VERSION + + match base: + case "core22": + gpu_plugs = {} + gpu_layouts = { + "/usr/share/libdrm": {"bind": "$SNAP/kf6-core22/usr/share/libdrm"}, + } + case "core24": + gpu_plugs = { + "gpu-2404": { + "interface": "content", + "target": "$SNAP/gpu-2404", + "default-provider": "mesa-2404", + }, + } + gpu_layouts = { + "/usr/share/libdrm": {"bind": "$SNAP/gpu-2404/libdrm"}, + "/usr/share/drirc.d": {"symlink": "$SNAP/gpu-2404/drirc.d"}, + } + case _: + raise AssertionError(f"Unsupported base: {base}") build_snaps: List[str] = [] for part in self.yaml_data["parts"].values(): @@ -139,18 +183,34 @@ def kde_snaps(self) -> KDESnaps6: kf6_sdk_snap=kf6_sdk_snap, content_kf6=content_kf6_snap, kf6_builtin=kf6_builtin, + gpu_layouts=gpu_layouts, + gpu_plugs=gpu_plugs, + qt_version=qt_version, ) @overrides def get_root_snippet(self) -> Dict[str, Any]: platform_kf6_snap = self.kde_snaps.content_kf6 content_kf6_snap = self.kde_snaps.content_kf6 + "-all" + gpu_plugs = self.kde_snaps.gpu_plugs + gpu_layouts = self.kde_snaps.gpu_layouts + qt_version = self.kde_snaps.qt_version return { - "assumes": ["snapd2.58.3"], # for 'snapctl is-connected' + "assumes": ["snapd2.58.3"], # for cups support "compression": "lzo", "plugs": { "desktop": {"mount-host-font-cache": False}, + "gtk-2-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, + "gtk-3-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, "icon-themes": { "interface": "content", "target": "$SNAP/data-dir/icons", @@ -167,8 +227,13 @@ def get_root_snippet(self) -> Dict[str, Any]: "default-provider": platform_kf6_snap, "target": "$SNAP/kf6", }, + **gpu_plugs, + }, + "environment": { + "SNAP_DESKTOP_RUNTIME": "$SNAP/kf6", + "GTK_USE_PORTAL": "1", + "QT_VERSION": qt_version, }, - "environment": {"SNAP_DESKTOP_RUNTIME": "$SNAP/kf6"}, "hooks": { "configure": { "plugs": ["desktop"], @@ -178,6 +243,7 @@ def get_root_snippet(self) -> Dict[str, Any]: "layout": { "/usr/share/X11": {"symlink": "$SNAP/kf6/usr/share/X11"}, "/usr/share/qt6": {"symlink": "$SNAP/kf6/usr/share/qt6"}, + **gpu_layouts, }, } @@ -237,6 +303,9 @@ def get_part_snippet(self, *, plugin_name: str) -> Dict[str, Any]: # lapack f"/snap/{kf6_sdk_snap}/current/usr/lib/" "${CRAFT_ARCH_TRIPLET_BUILD_FOR}/lapack", + # libproxy + f"/snap/{kf6_sdk_snap}/current/usr/lib/" + "${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libproxy", # kf6 libs f"/snap/{kf6_sdk_snap}/current/usr/lib", # Staged libs @@ -278,14 +347,18 @@ def get_parts_snippet(self) -> Dict[str, Any]: # We can change this to the lightweight command-chain when # the content snap includes the desktop-launch from # https://github.com/canonical/snapcraft-desktop-integration - source = get_extensions_data_dir() / "desktop" / "kde-neon-6" + + source = get_extensions_data_dir() / "desktop" / "command-chain-kde" + + gpu_opts = {} + if self.yaml_data["base"] == "core24": + gpu_opts["make-parameters"] = ["GPU_WRAPPER=gpu-2404-wrapper"] if self.kde_snaps.kf6_builtin: return { "kde-neon-6/sdk": { "source": str(source), "plugin": "make", - "make-parameters": [f"PLATFORM_PLUG={self.kde_snaps.content_kf6}"], "build-snaps": [ self.kde_snaps.qt6_sdk_snap, self.kde_snaps.kf6_sdk_snap, @@ -301,6 +374,7 @@ def get_parts_snippet(self) -> Dict[str, Any]: "libgl-dev", "libglvnd-dev", ], + **gpu_opts, }, } @@ -308,6 +382,6 @@ def get_parts_snippet(self) -> Dict[str, Any]: "kde-neon-6/sdk": { "source": str(source), "plugin": "make", - "make-parameters": [f"PLATFORM_PLUG={self.kde_snaps.content_kf6}"], + **gpu_opts, }, } diff --git a/tests/spread/extensions/kde-neon-6-core24/task.yaml b/tests/spread/extensions/kde-neon-6-core24/task.yaml new file mode 100644 index 0000000000..0a61d9fe7f --- /dev/null +++ b/tests/spread/extensions/kde-neon-6-core24/task.yaml @@ -0,0 +1,52 @@ +summary: Build and run a basic kde snap using extensions + +# The content snap required for the test to succeed is only +# available on a subset of all the architectures this testbed +# can run on. +systems: + - ubuntu-24.04 + - ubuntu-24.04-64 + - ubuntu-24.04-amd64 + +environment: + SNAP_DIR: ../snaps/neon-hello-6-core24 + +prepare: | + #shellcheck source=tests/spread/tools/snapcraft-yaml.sh + . "$TOOLS_DIR/snapcraft-yaml.sh" + set_base "$SNAP_DIR/snap/snapcraft.yaml" + +restore: | + cd "$SNAP_DIR" + snapcraft clean + rm -f ./*.snap + + #shellcheck source=tests/spread/tools/snapcraft-yaml.sh + . "$TOOLS_DIR/snapcraft-yaml.sh" + restore_yaml "snap/snapcraft.yaml" + +execute: | + cd "$SNAP_DIR" + output="$(snapcraft)" + snap install neon-hello-6_*.snap --dangerous + snap connect neon-hello-6:kf6-core24 kf6-core24:kf6-core24 + + [ "$(neon-hello-6)" = "hello world" ] + + # Verify that the extension command chain went through the proper setup procedure + snap_user_data="$HOME/snap/neon-hello-6/current" + [ -d "$snap_user_data/.config" ] + [ -d "$snap_user_data/.local" ] + [ -f "$snap_user_data/.last_revision" ] + [ "$(cat "$snap_user_data/.last_revision")" = "SNAP_DESKTOP_LAST_REVISION=x1" ] + + + # Verify content snap was installed for dependency checks. + snap list gtk-common-themes + snap list kf6-core24 + + # Verify all dependencies were found. + if echo "$output" | grep -q "part is missing libraries"; then + echo "failed to find content snaps' libraries" + exit 1 + fi diff --git a/tests/spread/extensions/kde-neon/task.yaml b/tests/spread/extensions/kde-neon/task.yaml index 4bf67ece94..c19ee584b9 100644 --- a/tests/spread/extensions/kde-neon/task.yaml +++ b/tests/spread/extensions/kde-neon/task.yaml @@ -29,6 +29,7 @@ execute: | cd "$SNAP_DIR" output="$(snapcraft)" snap install neon-hello_*.snap --dangerous + snap connect neon-hello:kf5-core22 kf5-core22:kf5-core22 [ "$(neon-hello)" = "hello world" ] @@ -45,7 +46,7 @@ execute: | if [[ "$SPREAD_SYSTEM" =~ ubuntu-20.04 ]]; then snap list kde-frameworks-5-99-qt-5-15-7-core20 elif [[ "$SPREAD_SYSTEM" =~ ubuntu-22.04 ]]; then - snap list kf5-5-113-qt-5-15-11-core22 + snap list kf5-core22 fi # Verify all dependencies were found. diff --git a/tests/spread/extensions/snaps/neon-hello-6-core24/CMakeLists.txt b/tests/spread/extensions/snaps/neon-hello-6-core24/CMakeLists.txt new file mode 100644 index 0000000000..cef7cacf85 --- /dev/null +++ b/tests/spread/extensions/snaps/neon-hello-6-core24/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 2.6) +project(hello) + +set (QT_MIN_VERSION "6.6.0") +find_package(Qt6 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core) + +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") + +add_executable(hello hello.cpp) +target_include_directories(hello PRIVATE ${Qt6Core_INCLUDE_DIRS}) +target_link_libraries(hello PRIVATE Qt6::Core) + +install(TARGETS hello RUNTIME DESTINATION bin) diff --git a/tests/spread/extensions/snaps/neon-hello-6-core24/hello.cpp b/tests/spread/extensions/snaps/neon-hello-6-core24/hello.cpp new file mode 100644 index 0000000000..7011be0c9a --- /dev/null +++ b/tests/spread/extensions/snaps/neon-hello-6-core24/hello.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main() +{ + QString s("hello world"); + std::cout << s.toUtf8().constData() << std::endl; +} diff --git a/tests/spread/extensions/snaps/neon-hello-6-core24/snap/snapcraft.yaml b/tests/spread/extensions/snaps/neon-hello-6-core24/snap/snapcraft.yaml new file mode 100644 index 0000000000..84aef36712 --- /dev/null +++ b/tests/spread/extensions/snaps/neon-hello-6-core24/snap/snapcraft.yaml @@ -0,0 +1,18 @@ +name: neon-hello-6 +version: "1.0" +summary: Test the kde-neon extension +description: It simply prints a hello world + +grade: devel +confinement: strict +base: core24 + +apps: + neon-hello-6: + command: usr/local/bin/hello + extensions: [kde-neon-6] + +parts: + hello: + plugin: cmake + source: . diff --git a/tests/spread/extensions/snaps/neon-hello-6/snap/snapcraft.yaml b/tests/spread/extensions/snaps/neon-hello-6/snap/snapcraft.yaml index da6e7e5681..1dc7941ee5 100644 --- a/tests/spread/extensions/snaps/neon-hello-6/snap/snapcraft.yaml +++ b/tests/spread/extensions/snaps/neon-hello-6/snap/snapcraft.yaml @@ -5,6 +5,7 @@ description: It simply prints a hello world grade: devel confinement: strict +base: core22 apps: neon-hello-6: diff --git a/tests/unit/commands/test_list_extensions.py b/tests/unit/commands/test_list_extensions.py index 07bc97c1ec..43d1f0b451 100644 --- a/tests/unit/commands/test_list_extensions.py +++ b/tests/unit/commands/test_list_extensions.py @@ -37,7 +37,7 @@ def test_command(emitter, command): dedent( """\ Extension name Supported bases - ---------------------- ---------------------- + ---------------------- ------------------------------ env-injector core24 fake-extension core22, core24 flutter-beta core18 @@ -48,8 +48,8 @@ def test_command(emitter, command): gnome-3-28 core18 gnome-3-34 core18 gnome-3-38 core20 - kde-neon core18, core20, core22 - kde-neon-6 core22 + kde-neon core18, core20, core22, core24 + kde-neon-6 core22, core24 ros1-noetic core20 ros1-noetic-desktop core20 ros1-noetic-perception core20 @@ -87,7 +87,7 @@ def test_command_extension_dups(emitter, command): dedent( """\ Extension name Supported bases - ---------------------- ---------------------- + ---------------------- ------------------------------ env-injector core24 flutter-beta core18 flutter-dev core18 @@ -97,8 +97,8 @@ def test_command_extension_dups(emitter, command): gnome-3-28 core18 gnome-3-34 core18 gnome-3-38 core20 - kde-neon core18, core20, core22 - kde-neon-6 core22 + kde-neon core18, core20, core22, core24 + kde-neon-6 core22, core24 ros1-noetic core20 ros1-noetic-desktop core20 ros1-noetic-perception core20 diff --git a/tests/unit/extensions/test_kde_neon.py b/tests/unit/extensions/test_kde_neon.py index 35387a2a62..cc7d5fd16f 100644 --- a/tests/unit/extensions/test_kde_neon.py +++ b/tests/unit/extensions/test_kde_neon.py @@ -31,14 +31,36 @@ def kde_neon_extension(): ) +@pytest.fixture +def kde_neon_extension_core24(): + return kde_neon.KDENeon( + yaml_data={"base": "core24", "parts": {}}, arch="amd64", target_arch="amd64" + ) + + @pytest.fixture def kde_neon_extension_with_build_snap(): return kde_neon.KDENeon( yaml_data={ "base": "core22", + "parts": {"part1": {"build-snaps": ["kf5-core22-sdk/latest/stable"]}}, + }, + arch="amd64", + target_arch="amd64", + ) + + +@pytest.fixture +def kde_neon_extension_with_build_snap_core24(): + return kde_neon.KDENeon( + yaml_data={ + "base": "core24", "parts": { "part1": { - "build-snaps": ["kf5-5-108-qt-5-15-10-core22-sdk/latest/stable"] + "build-snaps": [ + "kde-qt5-core24-sdk/latest/stable", + "kf5-core24-sdk/latest/stable", + ] } }, }, @@ -54,7 +76,29 @@ def kde_neon_extension_with_default_build_snap_from_latest_edge(): "base": "core22", "parts": { "part1": { - "build-snaps": ["kf5-5-113-qt-5-15-11-core22-sdk/latest/edge"] + "build-snaps": [ + "kde-qt5-core22-sdk/latest/edge", + "kf5-core22-sdk/latest/edge", + ] + } + }, + }, + arch="amd64", + target_arch="amd64", + ) + + +@pytest.fixture +def kde_neon_extension_with_default_build_snap_from_latest_edge_core24(): + return kde_neon.KDENeon( + yaml_data={ + "base": "core24", + "parts": { + "part1": { + "build-snaps": [ + "kde-qt5-core24-sdk/latest/edge", + "kf5-core24-sdk/latest/edge", + ] } }, }, @@ -69,7 +113,7 @@ def kde_neon_extension_with_default_build_snap_from_latest_edge(): def test_get_supported_bases(kde_neon_extension): - assert kde_neon_extension.get_supported_bases() == ("core22",) + assert kde_neon_extension.get_supported_bases() == ("core22", "core24") def test_get_supported_confinement(kde_neon_extension): @@ -83,24 +127,126 @@ def test_is_experimental(): def test_get_app_snippet(kde_neon_extension): assert kde_neon_extension.get_app_snippet(app_name="test-app") == { "command-chain": ["snap/command-chain/desktop-launch"], - "plugs": ["desktop", "desktop-legacy", "opengl", "wayland", "x11"], + "plugs": [ + "desktop", + "desktop-legacy", + "opengl", + "wayland", + "x11", + "audio-playback", + "unity7", + "network", + "network-bind", + ], + } + + +def test_get_app_snippet_core24(kde_neon_extension_core24): + assert kde_neon_extension_core24.get_app_snippet(app_name="test-app") == { + "command-chain": [ + "snap/command-chain/gpu-2404-wrapper", + "snap/command-chain/desktop-launch", + ], + "plugs": [ + "desktop", + "desktop-legacy", + "opengl", + "wayland", + "x11", + "audio-playback", + "unity7", + "network", + "network-bind", + ], } def test_get_root_snippet(kde_neon_extension): assert kde_neon_extension.get_root_snippet() == { - "assumes": ["snapd2.43"], + "assumes": ["snapd2.58.3"], + "compression": "lzo", + "environment": { + "SNAP_DESKTOP_RUNTIME": "$SNAP/kf5", + "GTK_USE_PORTAL": "1", + "QT_VERSION": "5", + }, + "hooks": { + "configure": { + "plugs": ["desktop"], + "command-chain": ["snap/command-chain/hooks-configure-desktop"], + } + }, + "layout": { + "/usr/share/X11": {"symlink": "$SNAP/kf5/usr/share/X11"}, + "/usr/share/qt5": {"symlink": "$SNAP/kf5/usr/share/qt5"}, + "/usr/share/libdrm": {"bind": "$SNAP/kf5-core22/usr/share/libdrm"}, + }, + "plugs": { + "desktop": {"mount-host-font-cache": False}, + "gtk-2-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, + "gtk-3-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, + "icon-themes": { + "interface": "content", + "target": "$SNAP/data-dir/icons", + "default-provider": "gtk-common-themes", + }, + "sound-themes": { + "interface": "content", + "target": "$SNAP/data-dir/sounds", + "default-provider": "gtk-common-themes", + }, + "kf5-core22": { + "content": "kf5-core22-all", + "interface": "content", + "default-provider": "kf5-core22", + "target": "$SNAP/kf5", + }, + }, + } + + +def test_get_root_snippet_core24(kde_neon_extension_core24): + assert kde_neon_extension_core24.get_root_snippet() == { + "assumes": ["snapd2.58.3"], "compression": "lzo", - "environment": {"SNAP_DESKTOP_RUNTIME": "$SNAP/kf5"}, + "environment": { + "SNAP_DESKTOP_RUNTIME": "$SNAP/kf5", + "GTK_USE_PORTAL": "1", + "QT_VERSION": "5", + }, "hooks": { "configure": { "plugs": ["desktop"], "command-chain": ["snap/command-chain/hooks-configure-desktop"], } }, - "layout": {"/usr/share/X11": {"symlink": "$SNAP/kf5/usr/share/X11"}}, + "layout": { + "/usr/share/X11": {"symlink": "$SNAP/kf5/usr/share/X11"}, + "/usr/share/qt5": {"symlink": "$SNAP/kf5/usr/share/qt5"}, + "/usr/share/libdrm": {"bind": "$SNAP/gpu-2404/libdrm"}, + "/usr/share/drirc.d": {"symlink": "$SNAP/gpu-2404/drirc.d"}, + "/usr/share/X11/XErrorDB": {"symlink": "$SNAP/gpu-2404/X11/XErrorDB"}, + }, "plugs": { "desktop": {"mount-host-font-cache": False}, + "gtk-2-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, + "gtk-3-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, "icon-themes": { "interface": "content", "target": "$SNAP/data-dir/icons", @@ -111,30 +257,83 @@ def test_get_root_snippet(kde_neon_extension): "target": "$SNAP/data-dir/sounds", "default-provider": "gtk-common-themes", }, - "kf5-5-113-qt-5-15-11-core22": { - "content": "kf5-5-113-qt-5-15-11-core22-all", + "kf5-core24": { + "content": "kf5-core24-all", "interface": "content", - "default-provider": "kf5-5-113-qt-5-15-11-core22", + "default-provider": "kf5-core24", "target": "$SNAP/kf5", }, + "gpu-2404": { + "default-provider": "mesa-2404", + "interface": "content", + "target": "$SNAP/gpu-2404", + }, }, } +def test_get_root_snippet_with_gpu(kde_neon_extension_core24): + snippet = kde_neon_extension_core24.get_root_snippet() + assert snippet["plugs"]["gpu-2404"] == { + "default-provider": "mesa-2404", + "interface": "content", + "target": "$SNAP/gpu-2404", + } + assert snippet["layout"]["/usr/share/libdrm"] == { + "bind": "$SNAP/gpu-2404/libdrm", + } + assert snippet["layout"]["/usr/share/drirc.d"] == { + "symlink": "$SNAP/gpu-2404/drirc.d", + } + assert snippet["layout"]["/usr/share/X11/XErrorDB"] == { + "symlink": "$SNAP/gpu-2404/X11/XErrorDB", + } + + +def test_get_root_snippet_without_gpu(kde_neon_extension): + snippet = kde_neon_extension.get_root_snippet() + assert snippet["layout"]["/usr/share/libdrm"] == { + "bind": "$SNAP/kf5-core22/usr/share/libdrm", + } + + +def test_get_root_snippet_no_exceptions(kde_neon_extension): + with pytest.raises(AssertionError): + assert not kde_neon_extension.get_root_snippet() + + def test_get_root_snippet_with_external_sdk(kde_neon_extension_with_build_snap): assert kde_neon_extension_with_build_snap.get_root_snippet() == { - "assumes": ["snapd2.43"], + "assumes": ["snapd2.58.3"], "compression": "lzo", - "environment": {"SNAP_DESKTOP_RUNTIME": "$SNAP/kf5"}, + "environment": { + "SNAP_DESKTOP_RUNTIME": "$SNAP/kf5", + "GTK_USE_PORTAL": "1", + "QT_VERSION": "5", + }, "hooks": { "configure": { "plugs": ["desktop"], "command-chain": ["snap/command-chain/hooks-configure-desktop"], } }, - "layout": {"/usr/share/X11": {"symlink": "$SNAP/kf5/usr/share/X11"}}, + "layout": { + "/usr/share/X11": {"symlink": "$SNAP/kf5/usr/share/X11"}, + "/usr/share/qt5": {"symlink": "$SNAP/kf5/usr/share/qt5"}, + "/usr/share/libdrm": {"bind": "$SNAP/kf5-core22/usr/share/libdrm"}, + }, "plugs": { "desktop": {"mount-host-font-cache": False}, + "gtk-2-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, + "gtk-3-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, "icon-themes": { "interface": "content", "target": "$SNAP/data-dir/icons", @@ -145,16 +344,77 @@ def test_get_root_snippet_with_external_sdk(kde_neon_extension_with_build_snap): "target": "$SNAP/data-dir/sounds", "default-provider": "gtk-common-themes", }, - "kf5-5-108-qt-5-15-10-core22": { - "content": "kf5-5-108-qt-5-15-10-core22-all", + "kf5-core22": { + "content": "kf5-core22-all", "interface": "content", - "default-provider": "kf5-5-108-qt-5-15-10-core22", + "default-provider": "kf5-core22", "target": "$SNAP/kf5", }, }, } +def test_get_root_snippet_with_external_sdk_core24( + kde_neon_extension_with_build_snap_core24, +): + assert kde_neon_extension_with_build_snap_core24.get_root_snippet() == { + "assumes": ["snapd2.58.3"], + "compression": "lzo", + "environment": { + "SNAP_DESKTOP_RUNTIME": "$SNAP/kf5", + "GTK_USE_PORTAL": "1", + "QT_VERSION": "5", + }, + "hooks": { + "configure": { + "plugs": ["desktop"], + "command-chain": ["snap/command-chain/hooks-configure-desktop"], + } + }, + "layout": { + "/usr/share/X11": {"symlink": "$SNAP/kf5/usr/share/X11"}, + "/usr/share/qt5": {"symlink": "$SNAP/kf5/usr/share/qt5"}, + "/usr/share/libdrm": {"bind": "$SNAP/gpu-2404/libdrm"}, + "/usr/share/drirc.d": {"symlink": "$SNAP/gpu-2404/drirc.d"}, + "/usr/share/X11/XErrorDB": {"symlink": "$SNAP/gpu-2404/X11/XErrorDB"}, + }, + "plugs": { + "desktop": {"mount-host-font-cache": False}, + "gtk-2-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, + "gtk-3-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, + "icon-themes": { + "interface": "content", + "target": "$SNAP/data-dir/icons", + "default-provider": "gtk-common-themes", + }, + "sound-themes": { + "interface": "content", + "target": "$SNAP/data-dir/sounds", + "default-provider": "gtk-common-themes", + }, + "kf5-core24": { + "content": "kf5-core24-all", + "interface": "content", + "default-provider": "kf5-core24", + "target": "$SNAP/kf5", + }, + "gpu-2404": { + "default-provider": "mesa-2404", + "interface": "content", + "target": "$SNAP/gpu-2404", + }, + }, + } + + class TestGetPartSnippet: """Tests for KDENeon.get_part_snippet when using the default sdk snap name.""" @@ -174,20 +434,59 @@ def assert_get_part_snippet(kde_neon_instance): "build-environment": [ { "PATH": ( - "/snap/kf5-5-113-qt-5-15-11-core22-sdk/current/usr/bin${PATH:+:$PATH}" + "/snap/kde-qt5-core22-sdk/current/usr/bin:" + "/snap/kf5-core22-sdk/current/usr/bin" + "${PATH:+:$PATH}" ) }, { "XDG_DATA_DIRS": ( - "$CRAFT_STAGE/usr/share:/snap/kf5-5-113-qt-5-15-11-core22-sdk" - "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" + "$CRAFT_STAGE/usr/share:" + "/snap/kde-qt5-core22-sdk/current/usr/share:" + "/snap/kf5-core22-sdk/current/usr/share:" + "/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" ) }, { - "SNAPCRAFT_CMAKE_ARGS": ( - "-DCMAKE_FIND_ROOT_PATH=" - "/snap/kf5-5-113-qt-5-15-11-core22-sdk/current" - "${SNAPCRAFT_CMAKE_ARGS:+:$SNAPCRAFT_CMAKE_ARGS}" + "XDG_CONFIG_HOME": ( + "$CRAFT_STAGE/etc/xdg:" + "/snap/kde-qt5-core22-sdk/current/etc/xdg:" + "/snap/kf5-core22-sdk/current/etc/xdg:" + "/etc/xdg${XDG_CONFIG_HOME:+:$XDG_CONFIG_HOME}" + ) + }, + { + "LD_LIBRARY_PATH": ( + "/snap/kde-qt5-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:" + "/snap/kde-qt5-core22-sdk/current/usr/lib:" + "/snap/kf5-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:" + "/snap/kf5-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}" + "/blas:" + "/snap/kf5-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}" + "/lapack:" + "/snap/kf5-core22-sdk/current/usr/lib:" + "$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:" + "$CRAFT_STAGE/usr/lib:" + "$CRAFT_STAGE/lib/" + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + ) + }, + { + "CMAKE_PREFIX_PATH": ( + "$CRAFT_STAGE;" + "/snap/kde-qt5-core22-sdk/current;" + "/snap/kf5-core22-sdk/current;" + "/usr" + "${CMAKE_PREFIX_PATH:+;$CMAKE_PREFIX_PATH}" + ) + }, + { + "CMAKE_FIND_ROOT_PATH": ( + "$CRAFT_STAGE;" + "/snap/kde-qt5-core22-sdk/current;" + "/snap/kf5-core22-sdk/current;" + "/usr" + "${CMAKE_FIND_ROOT_PATH:+;$CMAKE_FIND_ROOT_PATH}" ) }, ] @@ -199,21 +498,124 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): "build-environment": [ { "PATH": ( - "/snap/kf5-5-108-qt-5-15-10-core22-sdk/current/" - "usr/bin${PATH:+:$PATH}" + "/snap/kde-qt5-core22-sdk/current/usr/bin:" + "/snap/kf5-core22-sdk/current/usr/bin" + "${PATH:+:$PATH}" ) }, { "XDG_DATA_DIRS": ( - "$CRAFT_STAGE/usr/share:/snap/kf5-5-108-qt-5-15-10-core22-sdk" - "/current/usr/share:/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" + "$CRAFT_STAGE/usr/share:" + "/snap/kde-qt5-core22-sdk/current/usr/share:" + "/snap/kf5-core22-sdk/current/usr/share:" + "/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" ) }, { - "SNAPCRAFT_CMAKE_ARGS": ( - "-DCMAKE_FIND_ROOT_PATH=" - "/snap/kf5-5-108-qt-5-15-10-core22-sdk/current" - "${SNAPCRAFT_CMAKE_ARGS:+:$SNAPCRAFT_CMAKE_ARGS}" + "XDG_CONFIG_HOME": ( + "$CRAFT_STAGE/etc/xdg:" + "/snap/kde-qt5-core22-sdk/current/etc/xdg:" + "/snap/kf5-core22-sdk/current/etc/xdg:" + "/etc/xdg${XDG_CONFIG_HOME:+:$XDG_CONFIG_HOME}" + ) + }, + { + "LD_LIBRARY_PATH": ( + "/snap/kde-qt5-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:" + "/snap/kde-qt5-core22-sdk/current/usr/lib:" + "/snap/kf5-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:" + "/snap/kf5-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/blas:" + "/snap/kf5-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/lapack:" + "/snap/kf5-core22-sdk/current/usr/lib:" + "$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:" + "$CRAFT_STAGE/usr/lib:" + "$CRAFT_STAGE/lib/" + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + ), + }, + { + "CMAKE_PREFIX_PATH": ( + "$CRAFT_STAGE;" + "/snap/kde-qt5-core22-sdk/current;" + "/snap/kf5-core22-sdk/current;" + "/usr" + "${CMAKE_PREFIX_PATH:+;$CMAKE_PREFIX_PATH}" + ) + }, + { + "CMAKE_FIND_ROOT_PATH": ( + "$CRAFT_STAGE;" + "/snap/kde-qt5-core22-sdk/current;" + "/snap/kf5-core22-sdk/current;" + "/usr" + "${CMAKE_FIND_ROOT_PATH:+;$CMAKE_FIND_ROOT_PATH}" + ) + }, + ] + } + + def test_get_part_snippet_core24(self, kde_neon_extension_core24): + self.assert_get_part_snippet(kde_neon_extension_core24) + + +def assert_get_part_snippet(kde_neon_instance): + assert kde_neon_instance.get_part_snippet(plugin_name="cmake") == { + "build-environment": [ + { + "PATH": ( + "/snap/kde-qt5-core24-sdk/current/usr/bin:" + "/snap/kf5-core24-sdk/current/usr/bin" + "${PATH:+:$PATH}" + ) + }, + { + "XDG_DATA_DIRS": ( + "$CRAFT_STAGE/usr/share:" + "/snap/kde-qt5-core24-sdk/current/usr/share:" + "/snap/kf5-core24-sdk/current/usr/share:" + "/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" + ) + }, + { + "XDG_CONFIG_HOME": ( + "$CRAFT_STAGE/etc/xdg:" + "/snap/kde-qt5-core24-sdk/current/etc/xdg:" + "/snap/kf5-core24-sdk/current/etc/xdg:" + "/etc/xdg${XDG_CONFIG_HOME:+:$XDG_CONFIG_HOME}" + ) + }, + { + "LD_LIBRARY_PATH": ( + "/snap/kde-qt5-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:" + "/snap/kde-qt5-core24-sdk/current/usr/lib:" + "/snap/kf5-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:" + "/snap/kf5-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}" + "/blas:" + "/snap/kf5-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}" + "/lapack:" + "/snap/kf5-core24-sdk/current/usr/lib:" + "$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:" + "$CRAFT_STAGE/usr/lib:" + "$CRAFT_STAGE/lib/" + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + ) + }, + { + "CMAKE_PREFIX_PATH": ( + "$CRAFT_STAGE;" + "/snap/kde-qt5-core24-sdk/current;" + "/snap/kf5-core24-sdk/current;" + "/usr" + "${CMAKE_PREFIX_PATH:+;$CMAKE_PREFIX_PATH}" + ) + }, + { + "CMAKE_FIND_ROOT_PATH": ( + "$CRAFT_STAGE;" + "/snap/kde-qt5-core24-sdk/current;" + "/snap/kf5-core24-sdk/current;" + "/usr" + "${CMAKE_FIND_ROOT_PATH:+;$CMAKE_FIND_ROOT_PATH}" ) }, ] @@ -221,41 +623,75 @@ def test_get_part_snippet_with_external_sdk(kde_neon_extension_with_build_snap): def test_get_parts_snippet(kde_neon_extension): - source = get_extensions_data_dir() / "desktop" / "kde-neon" + source = get_extensions_data_dir() / "desktop" / "command-chain-kde" assert kde_neon_extension.get_parts_snippet() == { "kde-neon/sdk": { "source": str(source), "plugin": "make", - "make-parameters": ["PLATFORM_PLUG=kf5-5-113-qt-5-15-11-core22"], - "build-snaps": ["kf5-5-113-qt-5-15-11-core22-sdk"], + "build-snaps": ["kde-qt5-core22-sdk", "kf5-core22-sdk"], + "build-packages": [ + "gettext", + "doxygen", + "graphviz", + "libxml2-utils", + "docbook-xml", + "docbook-xsl", + "libglx-dev", + "libgl-dev", + "libglvnd-dev", + ], + } + } + + +def test_get_parts_snippet_core24(kde_neon_extension_core24): + source = get_extensions_data_dir() / "desktop" / "command-chain-kde" + + assert kde_neon_extension_core24.get_parts_snippet() == { + "kde-neon/sdk": { + "source": str(source), + "plugin": "make", + "make-parameters": [ + "GPU_WRAPPER=gpu-2404-wrapper", + ], + "build-snaps": ["kde-qt5-core24-sdk", "kf5-core24-sdk"], + "build-packages": [ + "gettext", + "doxygen", + "graphviz", + "libxml2-utils", + "docbook-xml", + "docbook-xsl", + "libglx-dev", + "libgl-dev", + "libglvnd-dev", + ], } } def test_get_parts_snippet_with_external_sdk(kde_neon_extension_with_build_snap): - source = get_extensions_data_dir() / "desktop" / "kde-neon" + source = get_extensions_data_dir() / "desktop" / "command-chain-kde" assert kde_neon_extension_with_build_snap.get_parts_snippet() == { "kde-neon/sdk": { "source": str(source), "plugin": "make", - "make-parameters": ["PLATFORM_PLUG=kf5-5-108-qt-5-15-10-core22"], } } def test_get_parts_snippet_with_external_sdk_different_channel( - kde_neon_extension_with_default_build_snap_from_latest_edge, + kde_neon_extension_with_default_build_snap_from_latest_edge_core24, ): - source = get_extensions_data_dir() / "desktop" / "kde-neon" - assert ( - kde_neon_extension_with_default_build_snap_from_latest_edge.get_parts_snippet() - == { - "kde-neon/sdk": { - "source": str(source), - "plugin": "make", - "make-parameters": ["PLATFORM_PLUG=kf5-5-113-qt-5-15-11-core22"], - } + source = get_extensions_data_dir() / "desktop" / "command-chain-kde" + assert kde_neon_extension_with_default_build_snap_from_latest_edge_core24.get_parts_snippet() == { + "kde-neon/sdk": { + "source": str(source), + "plugin": "make", + "make-parameters": [ + "GPU_WRAPPER=gpu-2404-wrapper", + ], } - ) + } diff --git a/tests/unit/extensions/test_kde_neon_6.py b/tests/unit/extensions/test_kde_neon_6.py index b59d474d6e..173b7f5dc6 100644 --- a/tests/unit/extensions/test_kde_neon_6.py +++ b/tests/unit/extensions/test_kde_neon_6.py @@ -32,6 +32,13 @@ def kde_neon_6_extension(): ) +@pytest.fixture +def kde_neon_6_extension_core24(): + return kde_neon_6.KDENeon6( + yaml_data={"base": "core24", "parts": {}}, arch="amd64", target_arch="amd64" + ) + + @pytest.fixture def kde_neon_6_extension_with_build_snap(): return kde_neon_6.KDENeon6( @@ -51,6 +58,25 @@ def kde_neon_6_extension_with_build_snap(): ) +@pytest.fixture +def kde_neon_6_extension_with_build_snap_core24(): + return kde_neon_6.KDENeon6( + yaml_data={ + "base": "core24", + "parts": { + "part1": { + "build-snaps": [ + "kde-qt6-core24-sdk/latest/stable", + "kf6-core24-sdk/latest/stable", + ] + } + }, + }, + arch="amd64", + target_arch="amd64", + ) + + @pytest.fixture def kde_neon_6_extension_with_default_build_snap_from_latest_edge(): return kde_neon_6.KDENeon6( @@ -70,13 +96,32 @@ def kde_neon_6_extension_with_default_build_snap_from_latest_edge(): ) +@pytest.fixture +def kde_neon_6_extension_with_default_build_snap_from_latest_edge_core24(): + return kde_neon_6.KDENeon6( + yaml_data={ + "base": "core24", + "parts": { + "part1": { + "build-snaps": [ + "kde-qt6-core24-sdk/latest/edge", + "kf6-core24-sdk/latest/edge", + ] + } + }, + }, + arch="amd64", + target_arch="amd64", + ) + + ################### # KDENeon6 Extension # ################### def test_get_supported_bases(kde_neon_6_extension): - assert kde_neon_6_extension.get_supported_bases() == ("core22",) + assert kde_neon_6_extension.get_supported_bases() == ("core22", "core24") def test_get_supported_confinement(kde_neon_6_extension): @@ -89,7 +134,27 @@ def test_is_experimental(): def test_get_app_snippet(kde_neon_6_extension): assert kde_neon_6_extension.get_app_snippet(app_name="test-app") == { - "command-chain": ["snap/command-chain/desktop-launch6"], + "command-chain": ["snap/command-chain/desktop-launch"], + "plugs": [ + "desktop", + "desktop-legacy", + "opengl", + "wayland", + "x11", + "audio-playback", + "unity7", + "network", + "network-bind", + ], + } + + +def test_get_app_snippet_core24(kde_neon_6_extension_core24): + assert kde_neon_6_extension_core24.get_app_snippet(app_name="test-app") == { + "command-chain": [ + "snap/command-chain/gpu-2404-wrapper", + "snap/command-chain/desktop-launch", + ], "plugs": [ "desktop", "desktop-legacy", @@ -108,7 +173,11 @@ def test_get_root_snippet(kde_neon_6_extension): assert kde_neon_6_extension.get_root_snippet() == { "assumes": ["snapd2.58.3"], "compression": "lzo", - "environment": {"SNAP_DESKTOP_RUNTIME": "$SNAP/kf6"}, + "environment": { + "SNAP_DESKTOP_RUNTIME": "$SNAP/kf6", + "GTK_USE_PORTAL": "1", + "QT_VERSION": "6", + }, "hooks": { "configure": { "plugs": ["desktop"], @@ -118,9 +187,20 @@ def test_get_root_snippet(kde_neon_6_extension): "layout": { "/usr/share/X11": {"symlink": "$SNAP/kf6/usr/share/X11"}, "/usr/share/qt6": {"symlink": "$SNAP/kf6/usr/share/qt6"}, + "/usr/share/libdrm": {"bind": "$SNAP/kf6-core22/usr/share/libdrm"}, }, "plugs": { "desktop": {"mount-host-font-cache": False}, + "gtk-2-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, + "gtk-3-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, "icon-themes": { "interface": "content", "target": "$SNAP/data-dir/icons", @@ -141,11 +221,100 @@ def test_get_root_snippet(kde_neon_6_extension): } +def test_get_root_snippet_core24(kde_neon_6_extension_core24): + assert kde_neon_6_extension_core24.get_root_snippet() == { + "assumes": ["snapd2.58.3"], + "compression": "lzo", + "environment": { + "SNAP_DESKTOP_RUNTIME": "$SNAP/kf6", + "GTK_USE_PORTAL": "1", + "QT_VERSION": "6", + }, + "hooks": { + "configure": { + "plugs": ["desktop"], + "command-chain": ["snap/command-chain/hooks-configure-desktop"], + } + }, + "layout": { + "/usr/share/X11": {"symlink": "$SNAP/kf6/usr/share/X11"}, + "/usr/share/qt6": {"symlink": "$SNAP/kf6/usr/share/qt6"}, + "/usr/share/libdrm": {"bind": "$SNAP/gpu-2404/libdrm"}, + "/usr/share/drirc.d": {"symlink": "$SNAP/gpu-2404/drirc.d"}, + }, + "plugs": { + "desktop": {"mount-host-font-cache": False}, + "gtk-2-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, + "gtk-3-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, + "icon-themes": { + "interface": "content", + "target": "$SNAP/data-dir/icons", + "default-provider": "gtk-common-themes", + }, + "sound-themes": { + "interface": "content", + "target": "$SNAP/data-dir/sounds", + "default-provider": "gtk-common-themes", + }, + "kf6-core24": { + "content": "kf6-core24-all", + "interface": "content", + "default-provider": "kf6-core24", + "target": "$SNAP/kf6", + }, + "gpu-2404": { + "default-provider": "mesa-2404", + "interface": "content", + "target": "$SNAP/gpu-2404", + }, + }, + } + + +def test_get_root_snippet_with_gpu(kde_neon_6_extension_core24): + snippet = kde_neon_6_extension_core24.get_root_snippet() + assert snippet["plugs"]["gpu-2404"] == { + "default-provider": "mesa-2404", + "interface": "content", + "target": "$SNAP/gpu-2404", + } + assert snippet["layout"]["/usr/share/libdrm"] == { + "bind": "$SNAP/gpu-2404/libdrm", + } + assert snippet["layout"]["/usr/share/drirc.d"] == { + "symlink": "$SNAP/gpu-2404/drirc.d", + } + + +def test_get_root_snippet_without_gpu(kde_neon_6_extension): + snippet = kde_neon_6_extension.get_root_snippet() + assert snippet["layout"]["/usr/share/libdrm"] == { + "bind": "$SNAP/kf6-core22/usr/share/libdrm", + } + + +def test_get_root_snippet_no_exceptions(kde_neon_6_extension): + with pytest.raises(AssertionError): + assert not kde_neon_6_extension.get_root_snippet() + + def test_get_root_snippet_with_external_sdk(kde_neon_6_extension_with_build_snap): assert kde_neon_6_extension_with_build_snap.get_root_snippet() == { "assumes": ["snapd2.58.3"], "compression": "lzo", - "environment": {"SNAP_DESKTOP_RUNTIME": "$SNAP/kf6"}, + "environment": { + "SNAP_DESKTOP_RUNTIME": "$SNAP/kf6", + "GTK_USE_PORTAL": "1", + "QT_VERSION": "6", + }, "hooks": { "configure": { "plugs": ["desktop"], @@ -155,9 +324,20 @@ def test_get_root_snippet_with_external_sdk(kde_neon_6_extension_with_build_snap "layout": { "/usr/share/X11": {"symlink": "$SNAP/kf6/usr/share/X11"}, "/usr/share/qt6": {"symlink": "$SNAP/kf6/usr/share/qt6"}, + "/usr/share/libdrm": {"bind": "$SNAP/kf6-core22/usr/share/libdrm"}, }, "plugs": { "desktop": {"mount-host-font-cache": False}, + "gtk-2-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, + "gtk-3-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, "icon-themes": { "interface": "content", "target": "$SNAP/data-dir/icons", @@ -178,6 +358,66 @@ def test_get_root_snippet_with_external_sdk(kde_neon_6_extension_with_build_snap } +def test_get_root_snippet_with_external_sdk_core24( + kde_neon_6_extension_with_build_snap_core24, +): + assert kde_neon_6_extension_with_build_snap_core24.get_root_snippet() == { + "assumes": ["snapd2.58.3"], + "compression": "lzo", + "environment": { + "SNAP_DESKTOP_RUNTIME": "$SNAP/kf6", + "GTK_USE_PORTAL": "1", + "QT_VERSION": "6", + }, + "hooks": { + "configure": { + "plugs": ["desktop"], + "command-chain": ["snap/command-chain/hooks-configure-desktop"], + } + }, + "layout": { + "/usr/share/X11": {"symlink": "$SNAP/kf6/usr/share/X11"}, + "/usr/share/qt6": {"symlink": "$SNAP/kf6/usr/share/qt6"}, + "/usr/share/libdrm": {"bind": "$SNAP/gpu-2404/libdrm"}, + "/usr/share/drirc.d": {"symlink": "$SNAP/gpu-2404/drirc.d"}, + }, + "plugs": { + "desktop": {"mount-host-font-cache": False}, + "gtk-2-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, + "gtk-3-themes": { + "interface": "content", + "target": "$SNAP/data-dir/themes", + "default-provider": "gtk-common-themes", + }, + "icon-themes": { + "interface": "content", + "target": "$SNAP/data-dir/icons", + "default-provider": "gtk-common-themes", + }, + "sound-themes": { + "interface": "content", + "target": "$SNAP/data-dir/sounds", + "default-provider": "gtk-common-themes", + }, + "kf6-core24": { + "content": "kf6-core24-all", + "interface": "content", + "default-provider": "kf6-core24", + "target": "$SNAP/kf6", + }, + "gpu-2404": { + "default-provider": "mesa-2404", + "interface": "content", + "target": "$SNAP/gpu-2404", + }, + }, + } + + class TestGetPartSnippet: """Tests for KDENeon6.get_part_snippet when using the default sdk snap name.""" @@ -227,6 +467,8 @@ def assert_get_part_snippet(kde_neon_6_instance): "/blas:" "/snap/kf6-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}" "/lapack:" + "/snap/kf6-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}" + "/libproxy:" "/snap/kf6-core22-sdk/current/usr/lib:" "$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:" "$CRAFT_STAGE/usr/lib:" @@ -291,6 +533,7 @@ def test_get_part_snippet_with_external_sdk(kde_neon_6_extension_with_build_snap "/snap/kf6-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:" "/snap/kf6-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/blas:" "/snap/kf6-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/lapack:" + "/snap/kf6-core22-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}/libproxy:" "/snap/kf6-core22-sdk/current/usr/lib:" "$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:" "$CRAFT_STAGE/usr/lib:" @@ -319,15 +562,83 @@ def test_get_part_snippet_with_external_sdk(kde_neon_6_extension_with_build_snap ] } + def test_get_part_snippet_core24(self, kde_neon_6_extension_core24): + self.assert_get_part_snippet(kde_neon_6_extension_core24) + + +def assert_get_part_snippet(kde_neon_6_instance): + assert kde_neon_6_instance.get_part_snippet(plugin_name="cmake") == { + "build-environment": [ + { + "PATH": ( + "/snap/kde-qt6-core24-sdk/current/usr/bin:" + "/snap/kf6-core24-sdk/current/usr/bin" + "${PATH:+:$PATH}" + ) + }, + { + "XDG_DATA_DIRS": ( + "$CRAFT_STAGE/usr/share:" + "/snap/kde-qt6-core24-sdk/current/usr/share:" + "/snap/kf6-core24-sdk/current/usr/share:" + "/usr/share${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" + ) + }, + { + "XDG_CONFIG_HOME": ( + "$CRAFT_STAGE/etc/xdg:" + "/snap/kde-qt6-core24-sdk/current/etc/xdg:" + "/snap/kf6-core24-sdk/current/etc/xdg:" + "/etc/xdg${XDG_CONFIG_HOME:+:$XDG_CONFIG_HOME}" + ) + }, + { + "LD_LIBRARY_PATH": ( + "/snap/kde-qt6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:" + "/snap/kde-qt6-core24-sdk/current/usr/lib:" + "/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:" + "/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}" + "/blas:" + "/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}" + "/lapack:" + "/snap/kf6-core24-sdk/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}" + "/libproxy:" + "/snap/kf6-core24-sdk/current/usr/lib:" + "$CRAFT_STAGE/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:" + "$CRAFT_STAGE/usr/lib:" + "$CRAFT_STAGE/lib/" + "${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + ) + }, + { + "CMAKE_PREFIX_PATH": ( + "$CRAFT_STAGE;" + "/snap/kde-qt6-core24-sdk/current;" + "/snap/kf6-core24-sdk/current;" + "/usr" + "${CMAKE_PREFIX_PATH:+;$CMAKE_PREFIX_PATH}" + ) + }, + { + "CMAKE_FIND_ROOT_PATH": ( + "$CRAFT_STAGE;" + "/snap/kde-qt6-core24-sdk/current;" + "/snap/kf6-core24-sdk/current;" + "/usr" + "${CMAKE_FIND_ROOT_PATH:+;$CMAKE_FIND_ROOT_PATH}" + ) + }, + ] + } + def test_get_parts_snippet(kde_neon_6_extension): - source = get_extensions_data_dir() / "desktop" / "kde-neon-6" + source = get_extensions_data_dir() / "desktop" / "command-chain-kde" assert kde_neon_6_extension.get_parts_snippet() == { "kde-neon-6/sdk": { "source": str(source), "plugin": "make", - "make-parameters": ["PLATFORM_PLUG=kf6-core22"], "build-snaps": ["kde-qt6-core22-sdk", "kf6-core22-sdk"], "build-packages": [ "gettext", @@ -344,26 +655,53 @@ def test_get_parts_snippet(kde_neon_6_extension): } +def test_get_parts_snippet_core24(kde_neon_6_extension_core24): + source = get_extensions_data_dir() / "desktop" / "command-chain-kde" + + assert kde_neon_6_extension_core24.get_parts_snippet() == { + "kde-neon-6/sdk": { + "source": str(source), + "plugin": "make", + "make-parameters": [ + "GPU_WRAPPER=gpu-2404-wrapper", + ], + "build-snaps": ["kde-qt6-core24-sdk", "kf6-core24-sdk"], + "build-packages": [ + "gettext", + "doxygen", + "graphviz", + "libxml2-utils", + "docbook-xml", + "docbook-xsl", + "libglx-dev", + "libgl-dev", + "libglvnd-dev", + ], + } + } + + def test_get_parts_snippet_with_external_sdk(kde_neon_6_extension_with_build_snap): - source = get_extensions_data_dir() / "desktop" / "kde-neon-6" + source = get_extensions_data_dir() / "desktop" / "command-chain-kde" assert kde_neon_6_extension_with_build_snap.get_parts_snippet() == { "kde-neon-6/sdk": { "source": str(source), "plugin": "make", - "make-parameters": ["PLATFORM_PLUG=kf6-core22"], } } def test_get_parts_snippet_with_external_sdk_different_channel( - kde_neon_6_extension_with_default_build_snap_from_latest_edge, + kde_neon_6_extension_with_default_build_snap_from_latest_edge_core24, ): - source = get_extensions_data_dir() / "desktop" / "kde-neon-6" - assert kde_neon_6_extension_with_default_build_snap_from_latest_edge.get_parts_snippet() == { + source = get_extensions_data_dir() / "desktop" / "command-chain-kde" + assert kde_neon_6_extension_with_default_build_snap_from_latest_edge_core24.get_parts_snippet() == { "kde-neon-6/sdk": { "source": str(source), "plugin": "make", - "make-parameters": ["PLATFORM_PLUG=kf6-core22"], + "make-parameters": [ + "GPU_WRAPPER=gpu-2404-wrapper", + ], } }