commit
72bec397fa
|
@ -107,5 +107,6 @@ in
|
||||||
malcontent = callInstalledTest ./malcontent.nix {};
|
malcontent = callInstalledTest ./malcontent.nix {};
|
||||||
ostree = callInstalledTest ./ostree.nix {};
|
ostree = callInstalledTest ./ostree.nix {};
|
||||||
pipewire = callInstalledTest ./pipewire.nix {};
|
pipewire = callInstalledTest ./pipewire.nix {};
|
||||||
|
upower = callInstalledTest ./upower.nix {};
|
||||||
xdg-desktop-portal = callInstalledTest ./xdg-desktop-portal.nix {};
|
xdg-desktop-portal = callInstalledTest ./xdg-desktop-portal.nix {};
|
||||||
}
|
}
|
||||||
|
|
9
nixos/tests/installed-tests/upower.nix
Normal file
9
nixos/tests/installed-tests/upower.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{ pkgs, makeInstalledTest, ... }:
|
||||||
|
|
||||||
|
makeInstalledTest {
|
||||||
|
tested = pkgs.upower;
|
||||||
|
|
||||||
|
testConfig = {
|
||||||
|
services.upower.enable = true;
|
||||||
|
};
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
, stdenv
|
, stdenv
|
||||||
, fetchFromGitLab
|
, fetchFromGitLab
|
||||||
, fetchpatch
|
, fetchpatch
|
||||||
|
, makeWrapper
|
||||||
, pkg-config
|
, pkg-config
|
||||||
, rsync
|
, rsync
|
||||||
, libxslt
|
, libxslt
|
||||||
|
@ -23,27 +24,31 @@
|
||||||
, useIMobileDevice ? true
|
, useIMobileDevice ? true
|
||||||
, libimobiledevice
|
, libimobiledevice
|
||||||
, withDocs ? (stdenv.buildPlatform == stdenv.hostPlatform)
|
, withDocs ? (stdenv.buildPlatform == stdenv.hostPlatform)
|
||||||
|
, nixosTests
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
pname = "upower";
|
pname = "upower";
|
||||||
version = "1.90.0";
|
version = "1.90.2";
|
||||||
|
|
||||||
outputs = [ "out" "dev" ]
|
outputs = [ "out" "dev" "installedTests" ]
|
||||||
++ lib.optionals withDocs [ "devdoc" ];
|
++ lib.optionals withDocs [ "devdoc" ];
|
||||||
|
|
||||||
src = fetchFromGitLab {
|
src = fetchFromGitLab {
|
||||||
domain = "gitlab.freedesktop.org";
|
domain = "gitlab.freedesktop.org";
|
||||||
owner = "upower";
|
owner = "upower";
|
||||||
repo = "upower";
|
repo = "upower";
|
||||||
rev = "v${version}";
|
rev = "v${finalAttrs.version}";
|
||||||
hash = "sha256-+C/4dDg6WTLpBgkpNyxjthSdqYdaTLC8vG6jG1LNJ7w=";
|
hash = "sha256-7WzMAJuf1czU8ZalsEU/NwCXYqTGvcqEqxFt5ocgt48=";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Remove when this is fixed upstream:
|
patches = lib.optionals (stdenv.hostPlatform.system == "i686-linux") [
|
||||||
# https://gitlab.freedesktop.org/upower/upower/-/issues/214
|
# Remove when this is fixed upstream:
|
||||||
patches = lib.optional (stdenv.hostPlatform.system == "i686-linux")
|
# https://gitlab.freedesktop.org/upower/upower/-/issues/214
|
||||||
./i686-test-remove-battery-check.patch;
|
./i686-test-remove-battery-check.patch
|
||||||
|
] ++ [
|
||||||
|
./installed-tests-path.patch
|
||||||
|
];
|
||||||
|
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
|
|
||||||
|
@ -60,6 +65,7 @@ stdenv.mkDerivation rec {
|
||||||
gettext
|
gettext
|
||||||
gobject-introspection
|
gobject-introspection
|
||||||
libxslt
|
libxslt
|
||||||
|
makeWrapper
|
||||||
pkg-config
|
pkg-config
|
||||||
rsync
|
rsync
|
||||||
];
|
];
|
||||||
|
@ -71,6 +77,14 @@ stdenv.mkDerivation rec {
|
||||||
systemd
|
systemd
|
||||||
# Duplicate from nativeCheckInputs until https://github.com/NixOS/nixpkgs/issues/161570 is solved
|
# Duplicate from nativeCheckInputs until https://github.com/NixOS/nixpkgs/issues/161570 is solved
|
||||||
umockdev
|
umockdev
|
||||||
|
|
||||||
|
# For installed tests.
|
||||||
|
(python3.withPackages (pp: [
|
||||||
|
pp.dbus-python
|
||||||
|
pp.python-dbusmock
|
||||||
|
pp.pygobject3
|
||||||
|
pp.packaging
|
||||||
|
]))
|
||||||
] ++ lib.optionals useIMobileDevice [
|
] ++ lib.optionals useIMobileDevice [
|
||||||
libimobiledevice
|
libimobiledevice
|
||||||
];
|
];
|
||||||
|
@ -98,6 +112,7 @@ stdenv.mkDerivation rec {
|
||||||
"-Dudevhwdbdir=${placeholder "out"}/lib/udev/hwdb.d"
|
"-Dudevhwdbdir=${placeholder "out"}/lib/udev/hwdb.d"
|
||||||
"-Dintrospection=${if (stdenv.buildPlatform == stdenv.hostPlatform) then "auto" else "disabled"}"
|
"-Dintrospection=${if (stdenv.buildPlatform == stdenv.hostPlatform) then "auto" else "disabled"}"
|
||||||
"-Dgtk-doc=${lib.boolToString withDocs}"
|
"-Dgtk-doc=${lib.boolToString withDocs}"
|
||||||
|
"-Dinstalled_test_prefix=${placeholder "installedTests"}"
|
||||||
];
|
];
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
|
@ -105,6 +120,9 @@ stdenv.mkDerivation rec {
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
patchShebangs src/linux/integration-test.py
|
patchShebangs src/linux/integration-test.py
|
||||||
patchShebangs src/linux/unittest_inspector.py
|
patchShebangs src/linux/unittest_inspector.py
|
||||||
|
|
||||||
|
substituteInPlace src/linux/integration-test.py \
|
||||||
|
--replace "/usr/share/dbus-1" "$out/share/dbus-1"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preCheck = ''
|
preCheck = ''
|
||||||
|
@ -126,35 +144,62 @@ stdenv.mkDerivation rec {
|
||||||
runHook postCheck
|
runHook postCheck
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
postCheck = ''
|
||||||
|
# Undo patchShebangs from postPatch so that it can be replaced with runtime shebang
|
||||||
|
# unittest_inspector.py intentionally not reverted because it would trigger
|
||||||
|
# meson rebuild during install and it is not used at runtime anyway.
|
||||||
|
sed -Ei 's~#!.+/bin/python3~#!/usr/bin/python3~' \
|
||||||
|
../src/linux/integration-test.py
|
||||||
|
'';
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
# Move stuff from DESTDIR to proper location.
|
# Move stuff from DESTDIR to proper location.
|
||||||
# We use rsync to merge the directories.
|
# We use rsync to merge the directories.
|
||||||
for dir in etc var; do
|
for dir in etc var; do
|
||||||
rsync --archive "${DESTDIR}/$dir" "$out"
|
rsync --archive "$DESTDIR/$dir" "$out"
|
||||||
rm --recursive "${DESTDIR}/$dir"
|
rm --recursive "$DESTDIR/$dir"
|
||||||
done
|
done
|
||||||
for o in out dev; do
|
for o in out dev installedTests; do
|
||||||
rsync --archive "${DESTDIR}/''${!o}" "$(dirname "''${!o}")"
|
rsync --archive "$DESTDIR/''${!o}" "$(dirname "''${!o}")"
|
||||||
rm --recursive "${DESTDIR}/''${!o}"
|
rm --recursive "$DESTDIR/''${!o}"
|
||||||
done
|
done
|
||||||
# Ensure the DESTDIR is removed.
|
# Ensure the DESTDIR is removed.
|
||||||
rmdir "${DESTDIR}/nix/store" "${DESTDIR}/nix" "${DESTDIR}"
|
rmdir "$DESTDIR/nix/store" "$DESTDIR/nix" "$DESTDIR"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# HACK: We want to install configuration files to $out/etc
|
postFixup = ''
|
||||||
# but upower should read them from /etc on a NixOS system.
|
wrapProgram "$installedTests/libexec/upower/integration-test.py" \
|
||||||
# With autotools, it was possible to override Make variables
|
--prefix GI_TYPELIB_PATH : "${lib.makeSearchPath "lib/girepository-1.0" [
|
||||||
# at install time but Meson does not support this
|
"$out"
|
||||||
# so we need to convince it to install all files to a temporary
|
umockdev.out
|
||||||
# location using DESTDIR and then move it to proper one in postInstall.
|
]}" \
|
||||||
DESTDIR = "${placeholder "out"}/dest";
|
--prefix PATH : "${lib.makeBinPath [
|
||||||
|
umockdev
|
||||||
|
]}"
|
||||||
|
'';
|
||||||
|
|
||||||
|
env = {
|
||||||
|
# HACK: We want to install configuration files to $out/etc
|
||||||
|
# but upower should read them from /etc on a NixOS system.
|
||||||
|
# With autotools, it was possible to override Make variables
|
||||||
|
# at install time but Meson does not support this
|
||||||
|
# so we need to convince it to install all files to a temporary
|
||||||
|
# location using DESTDIR and then move it to proper one in postInstall.
|
||||||
|
DESTDIR = "${placeholder "out"}/dest";
|
||||||
|
};
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
tests = {
|
||||||
|
installedTests = nixosTests.installed-tests.upower;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
homepage = "https://upower.freedesktop.org/";
|
homepage = "https://upower.freedesktop.org/";
|
||||||
changelog = "https://gitlab.freedesktop.org/upower/upower/-/blob/v${version}/NEWS";
|
changelog = "https://gitlab.freedesktop.org/upower/upower/-/blob/v${finalAttrs.version}/NEWS";
|
||||||
description = "A D-Bus service for power management";
|
description = "A D-Bus service for power management";
|
||||||
maintainers = teams.freedesktop.members;
|
maintainers = teams.freedesktop.members;
|
||||||
platforms = platforms.linux;
|
platforms = platforms.linux;
|
||||||
license = licenses.gpl2Plus;
|
license = licenses.gpl2Plus;
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
|
|
56
pkgs/os-specific/linux/upower/installed-tests-path.patch
Normal file
56
pkgs/os-specific/linux/upower/installed-tests-path.patch
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
diff --git a/meson_options.txt b/meson_options.txt
|
||||||
|
index eec3659..f064a1b 100644
|
||||||
|
--- a/meson_options.txt
|
||||||
|
+++ b/meson_options.txt
|
||||||
|
@@ -6,6 +6,10 @@ option('gtk-doc',
|
||||||
|
type : 'boolean',
|
||||||
|
value : 'true',
|
||||||
|
description : 'Build developer documentation')
|
||||||
|
+option('installed_test_prefix',
|
||||||
|
+ type: 'string',
|
||||||
|
+ value: '',
|
||||||
|
+ description: 'Prefix for installed tests')
|
||||||
|
option('introspection',
|
||||||
|
type : 'feature',
|
||||||
|
value : 'auto',
|
||||||
|
diff --git a/src/meson.build b/src/meson.build
|
||||||
|
index a2352ac..c1f25ac 100644
|
||||||
|
--- a/src/meson.build
|
||||||
|
+++ b/src/meson.build
|
||||||
|
@@ -85,6 +85,7 @@ install_subdir('does-not-exist', install_dir: historydir, strip_directory : true
|
||||||
|
|
||||||
|
cdata = configuration_data()
|
||||||
|
cdata.set('libexecdir', get_option('prefix') / get_option('libexecdir'))
|
||||||
|
+cdata.set('installed_test_bindir', get_option('installed_test_prefix') / 'libexec' / 'upower')
|
||||||
|
cdata.set('historydir', historydir)
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
@@ -147,16 +148,16 @@ if os_backend == 'linux' and gobject_introspection.found()
|
||||||
|
'linux/integration-test.py',
|
||||||
|
'linux/output_checker.py',
|
||||||
|
],
|
||||||
|
- install_dir: get_option('prefix') / get_option('libexecdir') / 'upower'
|
||||||
|
+ install_dir: get_option('installed_test_prefix') / 'libexec' / 'upower'
|
||||||
|
)
|
||||||
|
install_subdir('linux/tests/',
|
||||||
|
- install_dir: get_option('prefix') / get_option('libexecdir') / 'upower'
|
||||||
|
+ install_dir: get_option('installed_test_prefix') / 'libexec' / 'upower'
|
||||||
|
)
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
input: 'upower-integration.test.in',
|
||||||
|
output: 'upower-integration.test',
|
||||||
|
- install_dir: get_option('datadir') / 'installed-tests' / 'upower',
|
||||||
|
+ install_dir: get_option('installed_test_prefix') / 'share' / 'installed-tests' / 'upower',
|
||||||
|
configuration: cdata
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
diff --git a/src/upower-integration.test.in b/src/upower-integration.test.in
|
||||||
|
index 151ded0..b0a9bec 100644
|
||||||
|
--- a/src/upower-integration.test.in
|
||||||
|
+++ b/src/upower-integration.test.in
|
||||||
|
@@ -1,3 +1,3 @@
|
||||||
|
[Test]
|
||||||
|
Type=session
|
||||||
|
-Exec=@libexecdir@/upower/integration-test.py
|
||||||
|
+Exec=@installed_test_bindir@/integration-test.py
|
Loading…
Reference in a new issue