Unverified Commit 6797dba3 authored by Cosima Neidahl's avatar Cosima Neidahl Committed by GitHub
Browse files

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

parents 1fa8310d 773e580c
Loading
Loading
Loading
Loading
+37 −16
Original line number Diff line number Diff line
@@ -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
Original line number Diff line number Diff line
@@ -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,7 +46,22 @@ stdenv.mkDerivation (finalAttrs: {
    "doc"
  ];

  postPatch = lib.optionalString finalAttrs.finalPackage.doCheck ''
  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}'
@@ -63,7 +78,7 @@ stdenv.mkDerivation (finalAttrs: {
  ];

  buildInputs = [
    boost186
    boost
    curl
  ];

+10 −0
Original line number Diff line number Diff line
@@ -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 \
+12 −3
Original line number Diff line number Diff line
@@ -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
+36 −0
Original line number Diff line number Diff line
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
Loading