diff --git a/snapcraft/extensions/qt_framework.py b/snapcraft/extensions/qt_framework.py index 96d9af160fb..5f978f94abe 100644 --- a/snapcraft/extensions/qt_framework.py +++ b/snapcraft/extensions/qt_framework.py @@ -26,6 +26,7 @@ _SDK_SNAP = {"core22": "qt-framework-sdk"} _CONTENT_SNAP = { + "qt6-6": {"core22": "qt-framework-6-6-core22"}, "qt6-5": {"core22": "qt-framework-6-5-core22"}, "qt5-15": {"core22": "qt-framework-5-15-core22"}, } diff --git a/snapcraft/extensions/registry.py b/snapcraft/extensions/registry.py index a580d5022b5..a93a807b39d 100644 --- a/snapcraft/extensions/registry.py +++ b/snapcraft/extensions/registry.py @@ -40,6 +40,7 @@ "ros2-humble-ros-base": ROS2HumbleRosBaseExtension, "ros2-humble-desktop": ROS2HumbleDesktopExtension, "kde-neon": KDENeon, + "qt6-6": QTFramework, "qt6-5": QTFramework, "qt5-15": QTFramework, } diff --git a/tests/spread/extensions/qt6-6/task.yaml b/tests/spread/extensions/qt6-6/task.yaml new file mode 100644 index 00000000000..0c315336eef --- /dev/null +++ b/tests/spread/extensions/qt6-6/task.yaml @@ -0,0 +1,51 @@ +summary: Build and run a basic qt 6.5 snap using extensions + +systems: + - ubuntu-22.04 + - ubuntu-22.04-64 + - ubuntu-22.04-amd64 + +environment: + SNAP_DIR: ../snaps/qt6-6-hello + +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 qt6-6-hello_*.snap --dangerous + + [ "$(qt6-6-hello)" = "hello world" ] + + # Verify that the extension command chain went through the proper setup procedure + snap_user_data="$HOME/snap/qt6-6-hello/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 + if [[ "$SPREAD_SYSTEM" =~ ubuntu-22.04 ]]; then + snap list qt-framework-6-6-core22 + fi + + + # 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/snaps/qt6-6-hello/CMakeLists.txt b/tests/spread/extensions/snaps/qt6-6-hello/CMakeLists.txt new file mode 100644 index 00000000000..244fca5599c --- /dev/null +++ b/tests/spread/extensions/snaps/qt6-6-hello/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 2.6) +project(hello) + +set (QT_MIN_VERSION "6.5.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/qt6-6-hello/hello.cpp b/tests/spread/extensions/snaps/qt6-6-hello/hello.cpp new file mode 100644 index 00000000000..7011be0c9a0 --- /dev/null +++ b/tests/spread/extensions/snaps/qt6-6-hello/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/qt6-6-hello/snap/snapcraft.yaml b/tests/spread/extensions/snaps/qt6-6-hello/snap/snapcraft.yaml new file mode 100644 index 00000000000..46607320df3 --- /dev/null +++ b/tests/spread/extensions/snaps/qt6-6-hello/snap/snapcraft.yaml @@ -0,0 +1,17 @@ +name: qt6-6-hello +version: "1.0" +summary: Test the qt6-6 extension +description: It simply prints a hello world + +grade: devel +confinement: strict + +apps: + qt6-6-hello: + command: usr/local/bin/hello + extensions: [qt6-6] + +parts: + hello: + plugin: cmake + source: . diff --git a/tests/unit/commands/test_list_extensions.py b/tests/unit/commands/test_list_extensions.py index d1de322481a..5fd2e90916d 100644 --- a/tests/unit/commands/test_list_extensions.py +++ b/tests/unit/commands/test_list_extensions.py @@ -44,6 +44,7 @@ def test_command(emitter, command): kde-neon core18, core20, core22 qt5-15 core22 qt6-5 core22 + qt6-6 core22 ros1-noetic core20 ros1-noetic-desktop core20 ros1-noetic-perception core20 @@ -83,6 +84,7 @@ def test_command_extension_dups(emitter, command): kde-neon core18, core20, core22 qt5-15 core22 qt6-5 core22 + qt6-6 core22 ros1-noetic core20 ros1-noetic-desktop core20 ros1-noetic-perception core20 diff --git a/tests/unit/extensions/test_qt_framework.py b/tests/unit/extensions/test_qt_framework.py index 93a99b204a5..2477237b917 100644 --- a/tests/unit/extensions/test_qt_framework.py +++ b/tests/unit/extensions/test_qt_framework.py @@ -26,6 +26,12 @@ fixture_variables = "name,yaml_data,arch,target_arch" base_values = [ + ( + "qt6-6", + {"base": "core22", "parts": {}}, + "amd64", + "amd64", + ), ( "qt6-5", {"base": "core22", "parts": {}}, @@ -41,6 +47,15 @@ ] builtin_stable_values = [ + ( + "qt6-6", + { + "base": "core22", + "parts": {"part1": {"build-snaps": ["qt-framework-sdk/6.5/stable"]}}, + }, + "amd64", + "amd64", + ), ( "qt6-5", { @@ -62,6 +77,15 @@ ] builtin_edge_values = [ + ( + "qt6-6", + { + "base": "core22", + "parts": {"part1": {"build-snaps": ["qt-framework-sdk/6.5/edge"]}}, + }, + "amd64", + "amd64", + ), ( "qt6-5", { @@ -149,7 +173,7 @@ def test_get_root_snippet(qt_framework_extension, name, yaml_data): "target": "$SNAP/data-dir/sounds", "default-provider": "gtk-common-themes", }, - "qt-framework": { + f"qt-framework-{qt_framework_extension.name[2:]}-core22": { "interface": "content", "default-provider": _CONTENT_SNAP[name][yaml_data["base"]], "target": "$SNAP/qt-framework", @@ -183,7 +207,7 @@ def test_get_root_snippet_with_external_sdk(qt_framework_extension, name, yaml_d "target": "$SNAP/data-dir/sounds", "default-provider": "gtk-common-themes", }, - "qt-framework": { + f"qt-framework-{qt_framework_extension.name[2:]}-core22": { "interface": "content", "default-provider": _CONTENT_SNAP[name][yaml_data["base"]], "target": "$SNAP/qt-framework", diff --git a/tests/unit/extensions/test_registry.py b/tests/unit/extensions/test_registry.py index 9ab4c6c606f..3c3967399c0 100644 --- a/tests/unit/extensions/test_registry.py +++ b/tests/unit/extensions/test_registry.py @@ -30,6 +30,7 @@ def test_get_extension_names(): "ros2-humble-ros-base", "ros2-humble-desktop", "kde-neon", + "qt6-6", "qt6-5", "qt5-15", "fake-extension-experimental", diff --git a/tools/version.py b/tools/version.py index b8630b5f4ef..c73dfb48993 100755 --- a/tools/version.py +++ b/tools/version.py @@ -33,7 +33,7 @@ def determine_version(): desc = ( subprocess.run( ["git", "describe", "--always", "--long"], - stdout=subprocess.PIPE, + stdout=subprocess.PIPE, check=False, ) .stdout.decode() .strip()