lomiri: Fix builds after staging-next merge (#493457)

This commit is contained in:
Cosima Neidahl
2026-02-26 12:54:49 +00:00
committed by GitHub
10 changed files with 177 additions and 48 deletions
+37 -16
View File
@@ -9,7 +9,18 @@ let
# In case it ever shows up in the VM, we could OCR for it instead
wallpaperText = "Lorem ipsum";
# tmpfiles setup to make OCRing on terminal output more reliable
# setup to make OCRing on terminal output more reliable
terminalTextColour = {
r = 91;
g = 113;
b = 102;
};
terminalTextColourString =
lib:
let
toHex = component: lib.optionalString (component < 16) "0" + lib.trivial.toHexString component;
in
"#${toHex terminalTextColour.r}${toHex terminalTextColour.g}${toHex terminalTextColour.b}";
terminalOcrTmpfilesSetup =
{
pkgs,
@@ -18,7 +29,7 @@ let
}:
let
white = "255, 255, 255";
black = "0, 0, 0";
foreground = "${toString terminalTextColour.r}, ${toString terminalTextColour.g}, ${toString terminalTextColour.b}";
colorSection = color: {
Color = color;
Bold = true;
@@ -27,9 +38,9 @@ let
terminalColors = pkgs.writeText "customized.colorscheme" (
lib.generators.toINI { } {
Background = colorSection white;
Foreground = colorSection black;
Color2 = colorSection black;
Color2Intense = colorSection black;
Foreground = colorSection foreground;
Color2 = colorSection foreground;
Color2Intense = colorSection foreground;
}
);
terminalConfig = pkgs.writeText "terminal.ubports.conf" (
@@ -75,7 +86,7 @@ let
};
};
sharedTestFunctions = ''
sharedTestFunctions = lib: ''
from collections.abc import Callable
import tempfile
import subprocess
@@ -120,6 +131,17 @@ let
)
return check_for_color_continued_presence_retry
def ensure_terminal_running() -> None:
"""
Ensure that lomiri-terminal-app has finished starting up.
"""
terminalTextColor: str = "${terminalTextColourString lib}"
with machine.nested("Waiting for the screen to have terminalTextColor {} on it:".format(terminalTextColor)):
retry(check_for_color(terminalTextColor))
with machine.nested("Ensuring terminalTextColor {} stays present on the screen:".format(terminalTextColor)):
retry(fn=check_for_color_continued_presence(terminalTextColor), timeout_seconds=5)
def ensure_lomiri_running() -> None:
"""
Ensure that Lomiri has finished starting up.
@@ -183,7 +205,6 @@ let
# Using the keybind has a chance of instantly closing the menu again? Just click the button
mouse_click(15, 15)
'';
makeIndicatorTest =
@@ -237,7 +258,7 @@ let
testScript =
{ nodes, ... }:
sharedTestFunctions
(sharedTestFunctions lib)
+ ''
start_all()
machine.wait_for_unit("multi-user.target")
@@ -330,7 +351,7 @@ in
testScript =
{ nodes, ... }:
sharedTestFunctions
(sharedTestFunctions lib)
+ ''
start_all()
machine.wait_for_unit("multi-user.target")
@@ -451,7 +472,7 @@ in
testScript =
{ nodes, ... }:
sharedTestFunctions
(sharedTestFunctions lib)
+ ''
start_all()
machine.wait_for_unit("multi-user.target")
@@ -463,7 +484,7 @@ in
# Working terminal keybind is good
with subtest("terminal keybind works"):
machine.send_key("ctrl-alt-t")
wait_for_text(r"(${user}|machine)")
ensure_terminal_running()
machine.screenshot("terminal_opens")
machine.send_key("alt-f4")
@@ -474,7 +495,7 @@ in
# Just try the terminal again, we know that it should work
machine.send_chars("Terminal\n")
wait_for_text(r"(${user}|machine)")
ensure_terminal_running()
machine.send_key("alt-f4")
# We want support for X11 apps
@@ -598,7 +619,7 @@ in
testScript =
{ nodes, ... }:
sharedTestFunctions
(sharedTestFunctions lib)
+ ''
start_all()
machine.wait_for_unit("multi-user.target")
@@ -610,7 +631,7 @@ in
# Working terminal keybind is good
with subtest("terminal keybind works"):
machine.send_key("ctrl-alt-t")
wait_for_text(r"(${user}|machine)")
ensure_terminal_running()
machine.screenshot("terminal_opens")
# for the LSS lomiri-content-hub test to work reliably, we need to kick off peer collecting
@@ -744,7 +765,7 @@ in
testScript =
{ nodes, ... }:
sharedTestFunctions
(sharedTestFunctions lib)
+ ''
start_all()
machine.wait_for_unit("multi-user.target")
@@ -773,7 +794,7 @@ in
# Lomiri in desktop mode should use the correct keymap
with subtest("lomiri session keymap works"):
machine.send_key("ctrl-alt-t")
wait_for_text(r"(${user}|machine)")
ensure_terminal_running()
machine.screenshot("terminal_opens")
machine.send_chars("touch ${pwInput}\n")
+23 -8
View File
@@ -2,11 +2,11 @@
stdenv,
lib,
fetchFromGitLab,
fetchpatch,
gitUpdater,
makeFontsConf,
testers,
# https://gitlab.com/ubports/development/core/lib-cpp/net-cpp/-/issues/5
boost186,
boost,
cmake,
curl,
doxygen,
@@ -46,11 +46,26 @@ stdenv.mkDerivation (finalAttrs: {
"doc"
];
postPatch = lib.optionalString finalAttrs.finalPackage.doCheck ''
# Use wrapped python. Removing just the /usr/bin doesn't seem to work?
substituteInPlace tests/httpbin.h.in \
--replace '/usr/bin/python3' '${lib.getExe pythonEnv}'
'';
patches = [
# Remove when version > 3.2.0
(fetchpatch {
name = "0001-net-cpp-fix-compatibility-with-Boost-1.88.patch";
url = "https://gitlab.com/ubports/development/core/lib-cpp/net-cpp/-/commit/9ff8651b11eb9dc0f64147001e10a57d1546a626.patch";
hash = "sha256-IEa3nhnv0oa5WmhIDG3OMrZmmoAZFeedAzKXAKVTIQg=";
})
];
postPatch =
# https://gitlab.com/ubports/development/core/lib-cpp/net-cpp/-/merge_requests/22, too basic to bother with fetchpatch
''
substituteInPlace src/CMakeLists.txt \
--replace-fail 'find_package(Boost COMPONENTS system' 'find_package(Boost COMPONENTS'
''
+ lib.optionalString finalAttrs.finalPackage.doCheck ''
# Use wrapped python. Removing just the /usr/bin doesn't seem to work?
substituteInPlace tests/httpbin.h.in \
--replace '/usr/bin/python3' '${lib.getExe pythonEnv}'
'';
strictDeps = true;
@@ -63,7 +78,7 @@ stdenv.mkDerivation (finalAttrs: {
];
buildInputs = [
boost186
boost
curl
];
@@ -2,6 +2,7 @@
stdenv,
lib,
fetchFromGitLab,
fetchpatch,
gitUpdater,
testers,
boost,
@@ -32,6 +33,15 @@ stdenv.mkDerivation (finalAttrs: {
"doc"
];
patches = [
# Remove when version > 1.0.9
(fetchpatch {
name = "0001-persistent-cache-cpp-Fix-compatibility-with-Boost-1.89.patch";
url = "https://gitlab.com/ubports/development/core/lib-cpp/persistent-cache-cpp/-/commit/121397b58bdb2d6750a41bec0cf1676e4e9b8cf5.patch";
hash = "sha256-QKPf5E49NNZ+rzCCknJNQjcd/bEgHuh23RBM892Xz1o=";
})
];
postPatch = ''
# Wrong concatenation
substituteInPlace data/libpersistent-cache-cpp.pc.in \
@@ -2,10 +2,10 @@
stdenv,
lib,
fetchFromGitLab,
fetchpatch,
gitUpdater,
testers,
# https://gitlab.com/ubports/development/core/biometryd/-/issues/8
boost186,
boost,
cmake,
cmake-extras,
dbus,
@@ -39,6 +39,15 @@ stdenv.mkDerivation (finalAttrs: {
"dev"
];
patches = [
# Remove when version > 0.4.0
(fetchpatch {
name = "0001-biometryd-Fix-compatibility-with-Boost-1.87.patch";
url = "https://gitlab.com/ubports/development/core/biometryd/-/commit/8def6dfb18ee56971f0f64e3622af2a5a39ab0f6.patch";
hash = "sha256-PddZRML4Gc+s4aNeOyZwJJjmPSixMGFVFNcrO9dNDSI=";
})
];
postPatch = ''
# Substitute systemd's prefix in pkg-config call
substituteInPlace data/CMakeLists.txt \
@@ -66,7 +75,7 @@ stdenv.mkDerivation (finalAttrs: {
];
buildInputs = [
boost186
boost
cmake-extras
dbus
dbus-cpp
@@ -0,0 +1,36 @@
From df28165c0955ab963aeda41ffda86651115f4efb Mon Sep 17 00:00:00 2001
From: OPNA2608 <opna2608@protonmail.com>
Date: Tue, 24 Feb 2026 21:04:37 +0100
Subject: [PATCH] tests/authentication-test.cpp: Fix compat with libnotify
0.8.8
---
tests/authentication-test.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tests/authentication-test.cpp b/tests/authentication-test.cpp
index 8c74867..2fee42d 100644
--- a/tests/authentication-test.cpp
+++ b/tests/authentication-test.cpp
@@ -245,12 +245,16 @@ TEST_F(AuthenticationTest, BasicRequest)
EXPECT_EQ("Cancel", dialogs[0].actions[3]);
/* Hints */
-#if (NOTIFY_VERSION_MAJOR >= 0) && (NOTIFY_VERSION_MINOR >= 8)
+#if NOTIFY_CHECK_VERSION(0, 8, 0)
+#if NOTIFY_CHECK_VERSION(0, 8, 8)
+ EXPECT_EQ(4, dialogs[0].hints.size());
+#else
EXPECT_EQ(3, dialogs[0].hints.size());
+#endif // NOTIFY_CHECK_VERSION(0, 8, 8)
EXPECT_NE(dialogs[0].hints.end(), dialogs[0].hints.find("sender-pid"));
#else
EXPECT_EQ(2, dialogs[0].hints.size());
-#endif
+#endif // NOTIFY_CHECK_VERSION(0, 8, 0)
EXPECT_NE(dialogs[0].hints.end(), dialogs[0].hints.find("x-lomiri-snap-decisions"));
EXPECT_NE(dialogs[0].hints.end(), dialogs[0].hints.find("x-lomiri-private-menu-model"));
--
2.51.2
@@ -27,6 +27,11 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-JKU2lm5wco9aC2cu3lgJ9OfGAzKQO/wQXFPEdb9Uz3Y=";
};
patches = [
# Remove when https://gitlab.com/ubports/development/core/lomiri-polkit-agent/-/merge_requests/17 merged & in release
./1001-Fix-compat-with-libnotify-0.8.8.patch
];
strictDeps = true;
nativeBuildInputs = [
@@ -8,6 +8,7 @@
ayatana-indicator-messages,
bash,
cmake,
ctestCheckHook,
dbus,
dbus-glib,
dbus-test-runner,
@@ -111,6 +112,7 @@ stdenv.mkDerivation (finalAttrs: {
];
nativeCheckInputs = [
ctestCheckHook
dbus-test-runner
dconf
gnome-keyring
@@ -124,27 +126,6 @@ stdenv.mkDerivation (finalAttrs: {
# These rely on libphonenumber reformatting inputs to certain results
# Seem to be broken for a small amount of numbers, maybe libphonenumber version change?
(lib.cmakeBool "SKIP_QML_TESTS" true)
(lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" (
lib.concatStringsSep ";" [
# Exclude tests
"-E"
(lib.strings.escapeShellArg "(${
lib.concatStringsSep "|" [
# Flaky, randomly failing to launch properly & stuck until test timeout
# https://gitlab.com/ubports/development/core/lomiri-telephony-service/-/issues/70
"^HandlerTest"
"^OfonoAccountEntryTest"
"^TelepathyHelperSetupTest"
"^AuthHandlerTest"
"^ChatManagerTest"
"^AccountEntryTest"
"^AccountEntryFactoryTest"
"^PresenceRequestTest"
"^CallEntryTest"
]
})")
]
))
];
env.NIX_CFLAGS_COMPILE = toString [
@@ -158,6 +139,25 @@ stdenv.mkDerivation (finalAttrs: {
# Starts & talks to D-Bus services, breaks with parallelism
enableParallelChecking = false;
disabledTests = [
# Flaky, randomly failing to launch properly & stuck until test timeout
# https://gitlab.com/ubports/development/core/lomiri-telephony-service/-/issues/70
"AccountEntryTest"
"AccountEntryFactoryTest"
"AuthHandlerTest"
"CallEntryTest"
"ChatManagerTest"
"HandlerTest"
"OfonoAccountEntryTest"
"PresenceRequestTest"
"TelepathyHelperSetupTest"
# Failing most of the time since libnotify 0.8.8
# https://gitlab.com/ubports/development/core/lomiri-telephony-service/-/issues/75
"ApproverTest"
"MessagingMenuTest"
];
preCheck = ''
export QT_QPA_PLATFORM=minimal
export QT_PLUGIN_PATH=${
@@ -76,6 +76,14 @@ stdenv.mkDerivation (finalAttrs: {
# Tests run in parallel to other builds, don't suck up cores
substituteInPlace tests/headers/compile_headers.py \
--replace-fail 'max_workers=multiprocessing.cpu_count()' "max_workers=1"
''
# https://gitlab.com/ubports/development/core/lomiri-thumbnailer/-/merge_requests/31
# Too simple to bother with fetchpatch
+ ''
substituteInPlace CMakeLists.txt \
--replace-fail \
'find_package(Boost COMPONENTS filesystem iostreams regex system REQUIRED)' \
'find_package(Boost COMPONENTS filesystem iostreams regex REQUIRED)'
'';
strictDeps = true;
+8
View File
@@ -96,6 +96,14 @@ stdenv.mkDerivation (
substituteInPlace src/platform/graphics/CMakeLists.txt \
--replace-fail "/usr/include/drm/drm_fourcc.h" "${lib.getDev libdrm}/include/libdrm/drm_fourcc.h" \
--replace-fail "/usr/include/libdrm/drm_fourcc.h" "${lib.getDev libdrm}/include/libdrm/drm_fourcc.h"
''
# Boost.System was deprecated & dropped
+ lib.optionalString (lib.strings.versionOlder version "2.23.0") ''
substituteInPlace \
tests/CMakeLists.txt \
tests/unit-tests/CMakeLists.txt \
tests/mir_test_framework/CMakeLists.txt \
--replace-fail 'Boost::system' ""
'';
strictDeps = true;
+17
View File
@@ -110,6 +110,23 @@ in
];
hash = "sha256-gzLVQW9Z6y+s2D7pKtp0ondQrjkzZ5iUYhGDPqFXD5M=";
})
# Drop deprecated & removed Boost.System
# Remove when version > 2.22.2
(fetchpatch {
name = "0301-mir-Disable-boost_system.patch";
url = "https://github.com/canonical/mir/commit/0261aa6ce700311ee2b8723294451cdade1bc219.patch";
excludes = [
# hunk errors
"tests/CMakeLists.txt"
"tests/mir_test_framework/CMakeLists.txt"
"tests/unit-tests/CMakeLists.txt"
# doesn't exist
"tests/window_management_tests/CMakeLists.txt"
];
hash = "sha256-UqClQFHzA1th2P7NH67dMJtncw8n/ey9RlPD5Z3VPk0=";
})
];
};
}