about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libgudev
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-02-13 12:25:07 +0100
committerAlyssa Ross <hi@alyssa.is>2024-02-13 12:25:07 +0100
commita5e1520e4538e29ecfbd4b168306f890566d7bfd (patch)
tree28099c268b5d4b1e33c2b29f0714c45f0b961382 /nixpkgs/pkgs/development/libraries/libgudev
parent822f7c15c04567fbdc27020e862ea2b70cfbf8eb (diff)
parent3560d1c8269d0091b9aae10731b5e85274b7bbc1 (diff)
downloadnixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.gz
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.bz2
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.lz
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.xz
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.zst
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/nixos/modules/services/mail/rss2email.nix
	nixpkgs/pkgs/build-support/go/module.nix
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libgudev')
-rw-r--r--nixpkgs/pkgs/development/libraries/libgudev/default.nix13
-rw-r--r--nixpkgs/pkgs/development/libraries/libgudev/tests-skip-double-test-on-stub-locale-impls.patch41
2 files changed, 53 insertions, 1 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libgudev/default.nix b/nixpkgs/pkgs/development/libraries/libgudev/default.nix
index 5098bd9f65ca..fd21c9e7f85e 100644
--- a/nixpkgs/pkgs/development/libraries/libgudev/default.nix
+++ b/nixpkgs/pkgs/development/libraries/libgudev/default.nix
@@ -9,7 +9,6 @@
 , gnome
 , vala
 , gobject-introspection
-, fetchpatch
 , glibcLocales
 , umockdev
 }:
@@ -25,6 +24,18 @@ stdenv.mkDerivation (finalAttrs: {
     hash = "sha256-YSZqsa/J1z28YKiyr3PpnS/f9H2ZVE0IV2Dk+mZ7XdE=";
   };
 
+  patches = [
+    # Conditionally disable one test that requires a locale implementation
+    # https://gitlab.gnome.org/GNOME/libgudev/-/merge_requests/31
+    ./tests-skip-double-test-on-stub-locale-impls.patch
+  ];
+
+  postPatch = ''
+    # The relative location of LD_PRELOAD works for Glibc but not for other loaders (e.g. pkgsMusl)
+    substituteInPlace tests/meson.build \
+      --replace "LD_PRELOAD=libumockdev-preload.so.0" "LD_PRELOAD=${lib.getLib umockdev}/lib/libumockdev-preload.so.0"
+  '';
+
   strictDeps = true;
 
   nativeBuildInputs = [
diff --git a/nixpkgs/pkgs/development/libraries/libgudev/tests-skip-double-test-on-stub-locale-impls.patch b/nixpkgs/pkgs/development/libraries/libgudev/tests-skip-double-test-on-stub-locale-impls.patch
new file mode 100644
index 000000000000..277670aeed2b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libgudev/tests-skip-double-test-on-stub-locale-impls.patch
@@ -0,0 +1,41 @@
+From ad8b10870ee2092268f87144d8e5ab7db2011139 Mon Sep 17 00:00:00 2001
+From: Alyssa Ross <hi@alyssa.is>
+Date: Tue, 30 Jan 2024 20:47:21 +0100
+Subject: [PATCH] tests: Skip double test on stub locale impls
+
+On musl, setlocale() with an unknown locale name will succeed, but
+treat the requested locale as if it were C.UTF-8.  Therefore, to
+properly check whether the locale is supported, we need to actually
+verify whether it works the way we expect when deciding whether to
+skip the test.
+---
+ tests/test-double.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/tests/test-double.c b/tests/test-double.c
+index 91e77c9..e9d9232 100644
+--- a/tests/test-double.c
++++ b/tests/test-double.c
+@@ -39,8 +39,6 @@ fixture_teardown (Fixture *f, G_GNUC_UNUSED const void *data)
+ static void
+ test_double (Fixture *f, G_GNUC_UNUSED const void *data)
+ {
+-	g_assert_cmpstr (nl_langinfo(RADIXCHAR), ==, ",");
+-
+ 	umockdev_testbed_add_device (f->testbed, "platform", "dev1", NULL,
+ 				     "in_accel_scale", "0.0000098", NULL,
+ 				     "ID_MODEL", "KoolGadget", "SCALE", "0.0000098", NULL);
+@@ -73,6 +71,10 @@ int main(int argc, char **argv)
+ 	if (setlocale (LC_NUMERIC, "fr_FR.UTF-8") == NULL)
+ 		return GNU_SKIP_RETURNCODE;
+ 
++	/* Skip if locale doesn't work how we expect. */
++	if (strcmp (nl_langinfo(RADIXCHAR), ","))
++		return GNU_SKIP_RETURNCODE;
++
+ 	g_test_init (&argc, &argv, NULL);
+ 
+ 	g_test_add ("/gudev/double", Fixture, NULL,
+-- 
+GitLab
+