From 35b85a126d8a23a6b563bb21308a2c067006153e Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 30 Apr 2022 23:45:49 +0200 Subject: [PATCH 1/4] =?UTF-8?q?umockdev:=200.17.8=20=E2=86=92=200.17.9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/martinpitt/umockdev/releases/tag/0.17.9 --- pkgs/development/libraries/umockdev/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/umockdev/default.nix b/pkgs/development/libraries/umockdev/default.nix index fbf5a71bb4b1..fd35a94922e6 100644 --- a/pkgs/development/libraries/umockdev/default.nix +++ b/pkgs/development/libraries/umockdev/default.nix @@ -19,13 +19,13 @@ stdenv.mkDerivation rec { pname = "umockdev"; - version = "0.17.8"; + version = "0.17.9"; outputs = [ "bin" "out" "dev" "devdoc" ]; src = fetchurl { url = "https://github.com/martinpitt/umockdev/releases/download/${version}/${pname}-${version}.tar.xz"; - sha256 = "sha256-s3zeWJxw5ohUtsv4NZGKcdP8khEYzIXycbBrAzdnVoU="; + sha256 = "sha256-FEmWjJVmKKckC30zULGI/mZ3VNtirnweZq2gKh/Y5VE="; }; nativeBuildInputs = [ From 014b59a4b891ecdec0e162677360d0777dfb5a7a Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sun, 1 May 2022 00:06:19 +0200 Subject: [PATCH 2/4] umockdev: Make library path references absolute This simplifies consumers a lot. --- .../libraries/umockdev/default.nix | 21 ++++++ .../libraries/umockdev/hardcode-paths.patch | 69 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 pkgs/development/libraries/umockdev/hardcode-paths.patch diff --git a/pkgs/development/libraries/umockdev/default.nix b/pkgs/development/libraries/umockdev/default.nix index fd35a94922e6..a389d204a83e 100644 --- a/pkgs/development/libraries/umockdev/default.nix +++ b/pkgs/development/libraries/umockdev/default.nix @@ -28,6 +28,12 @@ stdenv.mkDerivation rec { sha256 = "sha256-FEmWjJVmKKckC30zULGI/mZ3VNtirnweZq2gKh/Y5VE="; }; + patches = [ + # Hardcode absolute paths to libraries so that consumers + # do not need to set LD_LIBRARY_PATH themselves. + ./hardcode-paths.patch + ]; + nativeBuildInputs = [ docbook-xsl-nons gobject-introspection @@ -57,6 +63,21 @@ stdenv.mkDerivation rec { doCheck = true; + postPatch = '' + # Substitute the path to this derivation in the patch we apply. + substituteInPlace src/umockdev-wrapper \ + --subst-var-by 'LIBDIR' "''${!outputLib}/lib" + ''; + + preCheck = '' + # Our patch makes the path to the `LD_PRELOAD`ed library absolute. + # When running tests, the library is not yet installed, though, + # so we need to replace the absolute path with a local one during build. + # We are using a symlink that will be overridden during installation. + mkdir -p "$out/lib" + ln -s "$PWD/libumockdev-preload.so.0" "$out/lib/libumockdev-preload.so.0" + ''; + meta = with lib; { description = "Mock hardware devices for creating unit tests"; license = licenses.lgpl21Plus; diff --git a/pkgs/development/libraries/umockdev/hardcode-paths.patch b/pkgs/development/libraries/umockdev/hardcode-paths.patch new file mode 100644 index 000000000000..91f1e928ec60 --- /dev/null +++ b/pkgs/development/libraries/umockdev/hardcode-paths.patch @@ -0,0 +1,69 @@ +diff --git a/meson.build b/meson.build +index 2ed9027..1f6bbf2 100644 +--- a/meson.build ++++ b/meson.build +@@ -38,6 +38,7 @@ g_ir_compiler = find_program('g-ir-compiler', required: false) + + conf.set('PACKAGE_NAME', meson.project_name()) + conf.set_quoted('VERSION', meson.project_version()) ++conf.set_quoted('LIBDIR', get_option('prefix') / get_option('libdir')) + + # glibc versions somewhere between 2.28 and 2.34 + if cc.has_function('__fxstatat', prefix: '#include ') +@@ -148,7 +149,7 @@ hacked_gir = custom_target('UMockdev-1.0 hacked gir', + + if g_ir_compiler.found() + umockdev_typelib = custom_target('UMockdev-1.0 typelib', +- command: [g_ir_compiler, '--output', '@OUTPUT@', '-l', 'libumockdev.so.0', '@INPUT@'], ++ command: [g_ir_compiler, '--output', '@OUTPUT@', '-l', get_option('prefix') / get_option('libdir') / 'libumockdev.so.0', '@INPUT@'], + input: hacked_gir, + output: 'UMockdev-1.0.typelib', + install: true, +diff --git a/src/config.vapi b/src/config.vapi +index 5269dd0..a2ec46d 100644 +--- a/src/config.vapi ++++ b/src/config.vapi +@@ -2,5 +2,6 @@ + namespace Config { + public const string PACKAGE_NAME; + public const string VERSION; ++ public const string LIBDIR; + } + +diff --git a/src/umockdev-record.vala b/src/umockdev-record.vala +index 8434d32..68c7f8e 100644 +--- a/src/umockdev-record.vala ++++ b/src/umockdev-record.vala +@@ -435,7 +435,7 @@ main (string[] args) + preload = ""; + else + preload = preload + ":"; +- Environment.set_variable("LD_PRELOAD", preload + "libumockdev-preload.so.0", true); ++ Environment.set_variable("LD_PRELOAD", preload + Config.LIBDIR + "/libumockdev-preload.so.0", true); + + try { + root_dir = DirUtils.make_tmp("umockdev.XXXXXX"); +diff --git a/src/umockdev-run.vala b/src/umockdev-run.vala +index 9a1ba10..6df2522 100644 +--- a/src/umockdev-run.vala ++++ b/src/umockdev-run.vala +@@ -95,7 +95,7 @@ main (string[] args) + preload = ""; + else + preload = preload + ":"; +- Environment.set_variable ("LD_PRELOAD", preload + "libumockdev-preload.so.0", true); ++ Environment.set_variable ("LD_PRELOAD", preload + Config.LIBDIR + "/libumockdev-preload.so.0", true); + + var testbed = new UMockdev.Testbed (); + +diff --git a/src/umockdev-wrapper b/src/umockdev-wrapper +index 6ce4dcd..706c49a 100755 +--- a/src/umockdev-wrapper ++++ b/src/umockdev-wrapper +@@ -1,5 +1,5 @@ + #!/bin/sh + # Wrapper program to preload the libumockdev library, so that test programs can + # set $UMOCKDEV_DIR for redirecting sysfs and other queries to a test bed. +-exec env LD_PRELOAD=libumockdev-preload.so.0:$LD_PRELOAD "$@" ++exec env LD_PRELOAD=@LIBDIR@/libumockdev-preload.so.0:$LD_PRELOAD "$@" + From b8b17d9b8e00eb6da4e2f8d67a393f7670000fb1 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 30 Apr 2022 23:23:31 +0200 Subject: [PATCH 3/4] =?UTF-8?q?power-profiles-daemon:=200.10.1=20=E2=86=92?= =?UTF-8?q?=200.11.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/releases/0.11 https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/releases/0.11.1 --- nixos/tests/installed-tests/default.nix | 1 - .../installed-tests/power-profiles-daemon.nix | 9 --- .../linux/power-profiles-daemon/default.nix | 71 ++++++------------- .../installed-tests-path.patch | 37 ---------- 4 files changed, 21 insertions(+), 97 deletions(-) delete mode 100644 nixos/tests/installed-tests/power-profiles-daemon.nix delete mode 100644 pkgs/os-specific/linux/power-profiles-daemon/installed-tests-path.patch diff --git a/nixos/tests/installed-tests/default.nix b/nixos/tests/installed-tests/default.nix index fd16b481168f..c6fb37cfe584 100644 --- a/nixos/tests/installed-tests/default.nix +++ b/nixos/tests/installed-tests/default.nix @@ -106,6 +106,5 @@ in malcontent = callInstalledTest ./malcontent.nix {}; ostree = callInstalledTest ./ostree.nix {}; pipewire = callInstalledTest ./pipewire.nix {}; - power-profiles-daemon = callInstalledTest ./power-profiles-daemon.nix {}; xdg-desktop-portal = callInstalledTest ./xdg-desktop-portal.nix {}; } diff --git a/nixos/tests/installed-tests/power-profiles-daemon.nix b/nixos/tests/installed-tests/power-profiles-daemon.nix deleted file mode 100644 index 43629a0155d2..000000000000 --- a/nixos/tests/installed-tests/power-profiles-daemon.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ pkgs, lib, makeInstalledTest, ... }: - -makeInstalledTest { - tested = pkgs.power-profiles-daemon; - - testConfig = { - services.power-profiles-daemon.enable = true; - }; -} diff --git a/pkgs/os-specific/linux/power-profiles-daemon/default.nix b/pkgs/os-specific/linux/power-profiles-daemon/default.nix index 9f96eb2576dc..253c3caf6aad 100644 --- a/pkgs/os-specific/linux/power-profiles-daemon/default.nix +++ b/pkgs/os-specific/linux/power-profiles-daemon/default.nix @@ -8,6 +8,7 @@ , libgudev , glib , polkit +, dbus , gobject-introspection , gettext , gtk-doc @@ -29,34 +30,21 @@ let dbus-python python-dbusmock ]; - testTypelibPath = lib.makeSearchPathOutput "lib" "lib/girepository-1.0" [ umockdev ]; in stdenv.mkDerivation rec { pname = "power-profiles-daemon"; - version = "0.10.1"; + version = "0.11.1"; - outputs = [ "out" "devdoc" "installedTests" ]; + outputs = [ "out" "devdoc" ]; src = fetchFromGitLab { domain = "gitlab.freedesktop.org"; owner = "hadess"; repo = "power-profiles-daemon"; rev = version; - sha256 = "sha256-sQWiCHc0kEELdmPq9Qdk7OKDUgbM5R44639feC7gjJc="; + sha256 = "sha256-qU9A9U2R3UioC7bo8Pc0IIsHIjghb6gsG4pTAg6tp9E="; }; - patches = [ - # Enable installed tests. - # https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/merge_requests/92 - (fetchpatch { - url = "https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/commit/3c64d9e1732eb6425e33013c452f1c4aa7a26f7e.patch"; - sha256 = "din5VuZZwARNDInHtl44yJK8pLmlxr5eoD4iMT4a8HA="; - }) - - # Install installed tests to separate output. - ./installed-tests-path.patch - ]; - nativeBuildInputs = [ pkg-config meson @@ -70,9 +58,6 @@ stdenv.mkDerivation rec { gobject-introspection wrapGAppsNoGuiHook python3.pkgs.wrapPython - - # For finding tests. - (python3.withPackages testPythonPkgs) ]; buildInputs = [ @@ -91,31 +76,28 @@ stdenv.mkDerivation rec { python3.pkgs.pygobject3 ]; + checkInputs = [ + umockdev + dbus + (python3.withPackages testPythonPkgs) + ]; + mesonFlags = [ - "-Dinstalled_test_prefix=${placeholder "installedTests"}" "-Dsystemdsystemunitdir=${placeholder "out"}/lib/systemd/system" "-Dgtk_doc=true" ]; + doCheck = true; + PKG_CONFIG_POLKIT_GOBJECT_1_POLICYDIR = "${placeholder "out"}/share/polkit-1/actions"; # Avoid double wrapping dontWrapGApps = true; postPatch = '' - patchShebangs tests/unittest_inspector.py - ''; - - preConfigure = '' - # For finding tests. - GI_TYPELIB_PATH_original=$GI_TYPELIB_PATH - addToSearchPath GI_TYPELIB_PATH "${testTypelibPath}" - ''; - - postConfigure = '' - # Restore the original value to prevent the program from depending on umockdev. - export GI_TYPELIB_PATH=$GI_TYPELIB_PATH_original - unset GI_TYPELIB_PATH_original + patchShebangs --build \ + tests/integration-test.py \ + tests/unittest_inspector.py ''; preInstall = '' @@ -128,33 +110,22 @@ stdenv.mkDerivation rec { export PKEXEC_UID=-1 ''; + postCheck = '' + # Do not contaminate the wrapper with test dependencies. + unset GI_TYPELIB_PATH + unset XDG_DATA_DIRS + ''; + postFixup = '' # Avoid double wrapping makeWrapperArgs+=("''${gappsWrapperArgs[@]}") # Make Python libraries available wrapPythonProgramsIn "$out/bin" "$pythonPath" - - # Make Python libraries available for installed tests - makeWrapperArgs+=( - --prefix GI_TYPELIB_PATH : "${testTypelibPath}" - --prefix PATH : "${lib.makeBinPath [ umockdev ]}" - # Vala does not use absolute paths in typelibs - # https://github.com/NixOS/nixpkgs/issues/47226 - # Also umockdev binaries use relative paths for LD_PRELOAD. - --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ umockdev ]}" - # dbusmock calls its templates using exec so our regular patching of Python scripts - # to add package directories to site will not carry over. - # https://github.com/martinpitt/python-dbusmock/blob/2254e69279a02fb3027b500ed7288b77c7a80f2a/dbusmock/mockobject.py#L51 - # https://github.com/martinpitt/python-dbusmock/blob/2254e69279a02fb3027b500ed7288b77c7a80f2a/dbusmock/__main__.py#L60-L62 - --prefix PYTHONPATH : "${lib.makeSearchPath python3.sitePackages (testPythonPkgs python3.pkgs)}" - ) - wrapPythonProgramsIn "$installedTests/libexec/installed-tests" "$pythonPath ${lib.concatStringsSep " " (testPythonPkgs python3.pkgs)}" ''; passthru = { tests = { nixos = nixosTests.power-profiles-daemon; - installed-tests = nixosTests.installed-tests.power-profiles-daemon; }; }; diff --git a/pkgs/os-specific/linux/power-profiles-daemon/installed-tests-path.patch b/pkgs/os-specific/linux/power-profiles-daemon/installed-tests-path.patch deleted file mode 100644 index 63059f3ac73c..000000000000 --- a/pkgs/os-specific/linux/power-profiles-daemon/installed-tests-path.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff --git a/meson_options.txt b/meson_options.txt -index 7e89619..76497db 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -1,3 +1,4 @@ -+option('installed_test_prefix', type: 'string', description: 'Prefix for installed tests') - option('systemdsystemunitdir', - description: 'systemd unit directory', - type: 'string', -diff --git a/tests/meson.build b/tests/meson.build -index b306a7f..7670e1b 100644 ---- a/tests/meson.build -+++ b/tests/meson.build -@@ -2,8 +2,8 @@ envs = environment() - envs.set ('top_builddir', meson.build_root()) - envs.set ('top_srcdir', meson.source_root()) - --installed_test_bindir = libexecdir / 'installed-tests' / meson.project_name() --installed_test_datadir = datadir / 'installed-tests' / meson.project_name() -+installed_test_bindir = get_option('installed_test_prefix') / 'libexec' / 'installed-tests' / meson.project_name() -+installed_test_datadir = get_option('installed_test_prefix') / 'share' / 'installed-tests' / meson.project_name() - - python3 = find_program('python3') - unittest_inspector = find_program('unittest_inspector.py') -diff --git a/tests/integration-test.py b/tests/integration-test.py -index 22dc42c..0f92b76 100755 ---- a/tests/integration-test.py -+++ b/tests/integration-test.py -@@ -67,7 +67,7 @@ class Tests(dbusmock.DBusTestCase): - print('Testing binaries from JHBuild (%s)' % cls.daemon_path) - else: - cls.daemon_path = None -- with open('/usr/lib/systemd/system/power-profiles-daemon.service') as f: -+ with open('/run/current-system/sw/lib/systemd/system/power-profiles-daemon.service') as f: - for line in f: - if line.startswith('ExecStart='): - cls.daemon_path = line.split('=', 1)[1].strip() From d487bcce32a697842e2c6ed7d848995311dac66c Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sun, 1 May 2022 00:12:27 +0200 Subject: [PATCH 4/4] =?UTF-8?q?bolt:=200.9.1=20=E2=86=92=200.9.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://gitlab.freedesktop.org/bolt/bolt/-/tags/0.9.2 --- pkgs/os-specific/linux/bolt/default.nix | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/pkgs/os-specific/linux/bolt/default.nix b/pkgs/os-specific/linux/bolt/default.nix index dd9436d9b0ea..d424f89fdfb3 100644 --- a/pkgs/os-specific/linux/bolt/default.nix +++ b/pkgs/os-specific/linux/bolt/default.nix @@ -13,7 +13,7 @@ , libxml2 , libxslt , docbook_xml_dtd_45 -, docbook_xsl +, docbook-xsl-nons , glib , systemd , polkit @@ -21,39 +21,33 @@ stdenv.mkDerivation rec { pname = "bolt"; - version = "0.9.1"; + version = "0.9.2"; src = fetchFromGitLab { domain = "gitlab.freedesktop.org"; owner = "bolt"; repo = "bolt"; rev = version; - sha256 = "1phgp8fs0dlj74kbkqlvfniwc32daz47b3pvsxlfxqzyrp77xrfm"; + sha256 = "eXjj7oD5HOW/AG2uxDa0tSleKmbouFd2fwlL2HHFiMA="; }; patches = [ # meson install tries to create /var/lib/boltd ./0001-skip-mkdir.patch - # https://github.com/NixOS/nixpkgs/issues/104429 + # Test does not work on ZFS with atime disabled. # Upstream issue: https://gitlab.freedesktop.org/bolt/bolt/-/issues/167 (fetchpatch { - name = "disable-atime-tests.diff"; - url = "https://gitlab.freedesktop.org/roberth/bolt/-/commit/1f672a7de2ebc4dd51590bb90f3b873a8ac0f4e6.diff"; - sha256 = "134f5s6kjqs6612pwq5pm1miy58crn1kxbyyqhzjnzmf9m57fnc8"; - }) - - # Fix tests with newer umockdev - (fetchpatch { - url = "https://gitlab.freedesktop.org/bolt/bolt/-/commit/130e09d1c7ff02c09e4ad1c9c36e9940b68e58d8.patch"; - sha256 = "HycuM7z4VvtBuZZLU68tBxGT1YjaqJRS4sKyoTGHZEk="; + url = "https://gitlab.freedesktop.org/bolt/bolt/-/commit/c2f1d5c40ad71b20507e02faa11037b395fac2f8.diff"; + revert = true; + sha256 = "6w7ll65W/CydrWAVi/qgzhrQeDv1PWWShulLxoglF+I="; }) ]; nativeBuildInputs = [ asciidoc docbook_xml_dtd_45 - docbook_xsl + docbook-xsl-nons libxml2 libxslt meson