Skip to content

Commit

Permalink
Add qt6-6
Browse files Browse the repository at this point in the history
  • Loading branch information
jardon committed Jan 25, 2024
1 parent 4dce77d commit e1764c1
Show file tree
Hide file tree
Showing 10 changed files with 121 additions and 3 deletions.
1 change: 1 addition & 0 deletions snapcraft/extensions/qt_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
}
Expand Down
1 change: 1 addition & 0 deletions snapcraft/extensions/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
51 changes: 51 additions & 0 deletions tests/spread/extensions/qt6-6/task.yaml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions tests/spread/extensions/snaps/qt6-6-hello/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 8 additions & 0 deletions tests/spread/extensions/snaps/qt6-6-hello/hello.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include <QString>
#include <iostream>

int main()
{
QString s("hello world");
std::cout << s.toUtf8().constData() << std::endl;
}
17 changes: 17 additions & 0 deletions tests/spread/extensions/snaps/qt6-6-hello/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -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: .
2 changes: 2 additions & 0 deletions tests/unit/commands/test_list_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
28 changes: 26 additions & 2 deletions tests/unit/extensions/test_qt_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {}},
Expand All @@ -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",
{
Expand All @@ -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",
{
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions tests/unit/extensions/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion tools/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit e1764c1

Please sign in to comment.