lomiri.history-service: nixfmt

This commit is contained in:
OPNA2608 2024-11-11 22:36:30 +01:00
parent 2fdce28dab
commit 4fd4d62c11

View File

@ -1,30 +1,33 @@
{ stdenv {
, lib stdenv,
, fetchFromGitLab lib,
, gitUpdater fetchFromGitLab,
, testers gitUpdater,
, cmake testers,
, dbus cmake,
, dbus-test-runner dbus,
, dconf dbus-test-runner,
, gnome-keyring dconf,
, libphonenumber gnome-keyring,
, libqtdbustest libphonenumber,
, pkg-config libqtdbustest,
, protobuf pkg-config,
, qtbase protobuf,
, qtdeclarative qtbase,
, qtpim qtdeclarative,
, sqlite qtpim,
, telepathy sqlite,
, telepathy-mission-control telepathy,
, validatePkgConfig telepathy-mission-control,
, wrapQtAppsHook validatePkgConfig,
, xvfb-run wrapQtAppsHook,
xvfb-run,
}: }:
let let
replaceDbusService = pkg: name: "--replace-fail \"\\\${DBUS_SERVICES_DIR}/${name}\" \"${pkg}/share/dbus-1/services/${name}\""; replaceDbusService =
pkg: name:
"--replace-fail \"\\\${DBUS_SERVICES_DIR}/${name}\" \"${pkg}/share/dbus-1/services/${name}\"";
in in
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "history-service"; pname = "history-service";
@ -42,46 +45,48 @@ stdenv.mkDerivation (finalAttrs: {
"dev" "dev"
]; ];
postPatch = '' postPatch =
# Upstream's way of generating their schema doesn't work for us, don't quite understand why. ''
# (gdb) bt # Upstream's way of generating their schema doesn't work for us, don't quite understand why.
# #0 QSQLiteResult::prepare (this=0x4a4650, query=...) at qsql_sqlite.cpp:406 # (gdb) bt
# #1 0x00007ffff344bcf4 in QSQLiteResult::reset (this=0x4a4650, query=...) at qsql_sqlite.cpp:378 # #0 QSQLiteResult::prepare (this=0x4a4650, query=...) at qsql_sqlite.cpp:406
# #2 0x00007ffff7f95f39 in QSqlQuery::exec (this=this@entry=0x7fffffffaad8, query=...) at kernel/qsqlquery.cpp:406 # #1 0x00007ffff344bcf4 in QSQLiteResult::reset (this=0x4a4650, query=...) at qsql_sqlite.cpp:378
# #3 0x00000000004084cb in SQLiteDatabase::dumpSchema (this=<optimized out>) at /build/source/plugins/sqlite/sqlitedatabase.cpp:148 # #2 0x00007ffff7f95f39 in QSqlQuery::exec (this=this@entry=0x7fffffffaad8, query=...) at kernel/qsqlquery.cpp:406
# #4 0x0000000000406d70 in main (argc=<optimized out>, argv=<optimized out>) # #3 0x00000000004084cb in SQLiteDatabase::dumpSchema (this=<optimized out>) at /build/source/plugins/sqlite/sqlitedatabase.cpp:148
# at /build/source/plugins/sqlite/schema/generate_schema.cpp:56 # #4 0x0000000000406d70 in main (argc=<optimized out>, argv=<optimized out>)
# (gdb) p lastError().driverText().toStdString() # at /build/source/plugins/sqlite/schema/generate_schema.cpp:56
# $17 = {_M_dataplus = {<std::allocator<char>> = {<std::__new_allocator<char>> = {<No data fields>}, <No data fields>}, # (gdb) p lastError().driverText().toStdString()
# _M_p = 0x4880d0 "Unable to execute statement"}, _M_string_length = 27, { # $17 = {_M_dataplus = {<std::allocator<char>> = {<std::__new_allocator<char>> = {<No data fields>}, <No data fields>},
# _M_local_buf = "\033\000\000\000\000\000\000\000+\344\371\367\377\177\000", _M_allocated_capacity = 27}} # _M_p = 0x4880d0 "Unable to execute statement"}, _M_string_length = 27, {
# (gdb) p lastError().databaseText().toStdString() # _M_local_buf = "\033\000\000\000\000\000\000\000+\344\371\367\377\177\000", _M_allocated_capacity = 27}}
# $18 = {_M_dataplus = {<std::allocator<char>> = {<std::__new_allocator<char>> = {<No data fields>}, <No data fields>}, # (gdb) p lastError().databaseText().toStdString()
# _M_p = 0x48c480 "no such column: rowid"}, _M_string_length = 21, { # $18 = {_M_dataplus = {<std::allocator<char>> = {<std::__new_allocator<char>> = {<No data fields>}, <No data fields>},
# _M_local_buf = "\025\000\000\000\000\000\000\000A\344\371\367\377\177\000", _M_allocated_capacity = 21}} # _M_p = 0x48c480 "no such column: rowid"}, _M_string_length = 21, {
# # _M_local_buf = "\025\000\000\000\000\000\000\000A\344\371\367\377\177\000", _M_allocated_capacity = 21}}
# This makes the tests stall indefinitely and breaks history-service usage. #
# This replacement script should hopefully achieve the same / a similar-enough result with just sqlite # This makes the tests stall indefinitely and breaks history-service usage.
cp ${./update_schema.sh.in} plugins/sqlite/schema/update_schema.sh.in # This replacement script should hopefully achieve the same / a similar-enough result with just sqlite
cp ${./update_schema.sh.in} plugins/sqlite/schema/update_schema.sh.in
# Uses pkg_get_variable, cannot substitute prefix with that # Uses pkg_get_variable, cannot substitute prefix with that
substituteInPlace daemon/CMakeLists.txt \ substituteInPlace daemon/CMakeLists.txt \
--replace-fail 'pkg_get_variable(SYSTEMD_USER_UNIT_DIR systemd systemduserunitdir)' 'set(SYSTEMD_USER_UNIT_DIR "''${CMAKE_INSTALL_PREFIX}/lib/systemd/user")' --replace-fail 'pkg_get_variable(SYSTEMD_USER_UNIT_DIR systemd systemduserunitdir)' 'set(SYSTEMD_USER_UNIT_DIR "''${CMAKE_INSTALL_PREFIX}/lib/systemd/user")'
# Queries qmake for the QML installation path, which returns a reference to Qt5's build directory # Queries qmake for the QML installation path, which returns a reference to Qt5's build directory
substituteInPlace CMakeLists.txt \ substituteInPlace CMakeLists.txt \
--replace-fail "\''${QMAKE_EXECUTABLE} -query QT_INSTALL_QML" "echo $out/${qtbase.qtQmlPrefix}" --replace-fail "\''${QMAKE_EXECUTABLE} -query QT_INSTALL_QML" "echo $out/${qtbase.qtQmlPrefix}"
'' + lib.optionalString finalAttrs.finalPackage.doCheck '' ''
# Tests launch these DBus services, fix paths related to them + lib.optionalString finalAttrs.finalPackage.doCheck ''
substituteInPlace tests/common/dbus-services/CMakeLists.txt \ # Tests launch these DBus services, fix paths related to them
${replaceDbusService telepathy-mission-control "org.freedesktop.Telepathy.MissionControl5.service"} \ substituteInPlace tests/common/dbus-services/CMakeLists.txt \
${replaceDbusService telepathy-mission-control "org.freedesktop.Telepathy.AccountManager.service"} \ ${replaceDbusService telepathy-mission-control "org.freedesktop.Telepathy.MissionControl5.service"} \
${replaceDbusService dconf "ca.desrt.dconf.service"} ${replaceDbusService telepathy-mission-control "org.freedesktop.Telepathy.AccountManager.service"} \
${replaceDbusService dconf "ca.desrt.dconf.service"}
substituteInPlace cmake/modules/GenerateTest.cmake \ substituteInPlace cmake/modules/GenerateTest.cmake \
--replace-fail '/usr/lib/dconf' '${lib.getLib dconf}/libexec' \ --replace-fail '/usr/lib/dconf' '${lib.getLib dconf}/libexec' \
--replace-fail '/usr/lib/telepathy' '${lib.getLib telepathy-mission-control}/libexec' --replace-fail '/usr/lib/telepathy' '${lib.getLib telepathy-mission-control}/libexec'
''; '';
strictDeps = true; strictDeps = true;
@ -114,11 +119,14 @@ stdenv.mkDerivation (finalAttrs: {
cmakeFlags = [ cmakeFlags = [
# Many deprecation warnings with Qt 5.15 # Many deprecation warnings with Qt 5.15
(lib.cmakeBool "ENABLE_WERROR" false) (lib.cmakeBool "ENABLE_WERROR" false)
(lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" (lib.concatStringsSep ";" [ (lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" (
# DaemonTest is flaky lib.concatStringsSep ";" [
# https://gitlab.com/ubports/development/core/history-service/-/issues/13 # DaemonTest is flaky
"-E" "^DaemonTest" # https://gitlab.com/ubports/development/core/history-service/-/issues/13
])) "-E"
"^DaemonTest"
]
))
]; ];
preBuild = '' preBuild = ''
@ -156,8 +164,6 @@ stdenv.mkDerivation (finalAttrs: {
license = lib.licenses.gpl3Only; license = lib.licenses.gpl3Only;
maintainers = lib.teams.lomiri.members; maintainers = lib.teams.lomiri.members;
platforms = lib.platforms.linux; platforms = lib.platforms.linux;
pkgConfigModules = [ pkgConfigModules = [ "lomiri-history-service" ];
"lomiri-history-service"
];
}; };
}) })