diff --git a/pkgs/by-name/jq/jq/musl.patch b/pkgs/by-name/jq/jq/musl.patch new file mode 100644 index 000000000000..3632899882e7 --- /dev/null +++ b/pkgs/by-name/jq/jq/musl.patch @@ -0,0 +1,31 @@ +From 63e9449a8142ce30c83fcd7e9396e5de9843774e Mon Sep 17 00:00:00 2001 +From: Alyssa Ross +Date: Thu, 3 Jul 2025 11:00:13 +0200 +Subject: [PATCH] jq.test: drop non-portable %F test + +%F is a non-portable GNU extension, not supported by all strptime +implementations (for example musl's). + +Link: https://github.com/jqlang/jq/pull/3365 +--- + tests/jq.test | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/tests/jq.test b/tests/jq.test +index 4ecf72f..6bfb6f8 100644 +--- a/tests/jq.test ++++ b/tests/jq.test +@@ -1848,10 +1848,6 @@ try ["OK", strflocaltime({})] catch ["KO", .] + "2015-03-05T23:51:47Z" + [[2015,2,5,23,51,47,4,63],1425599507] + +-[strptime("%FT%T")|(.,mktime)] +-"2025-06-07T08:09:10" +-[[2025,5,7,8,9,10,6,157],1749283750] +- + # Check day-of-week and day of year computations + # (should trip an assert if this fails) + last(range(365 * 67)|("1970-03-01T01:02:03Z"|strptime("%Y-%m-%dT%H:%M:%SZ")|mktime) + (86400 * .)|strftime("%Y-%m-%dT%H:%M:%SZ")|strptime("%Y-%m-%dT%H:%M:%SZ")) +-- +2.49.0 + diff --git a/pkgs/by-name/jq/jq/package.nix b/pkgs/by-name/jq/jq/package.nix index 5193a5f5263a..66cae1f2c1b1 100644 --- a/pkgs/by-name/jq/jq/package.nix +++ b/pkgs/by-name/jq/jq/package.nix @@ -30,14 +30,15 @@ stdenv.mkDerivation (finalAttrs: { "out" ]; - # tortured syntax to avoid rebuilds - # needed because epoch conversion test here is right at the end of 32 bit integer space - # See also: https://github.com/jqlang/jq/blob/859a8073ee8a21f2133154eea7c2bd5e0d60837f/tests/optional.test#L15-L18 - # "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64" would be preferrable, but breaks with dynamic linking, - # unless done globally in stdenv for all of 32 bit. - ${if stdenv.hostPlatform.is32bit then "patches" else null} = [ - ./disable-end-of-epoch-conversion-test.patch - ]; + patches = + [ ./musl.patch ] + ++ lib.optionals stdenv.hostPlatform.is32bit [ + # needed because epoch conversion test here is right at the end of 32 bit integer space + # See also: https://github.com/jqlang/jq/blob/859a8073ee8a21f2133154eea7c2bd5e0d60837f/tests/optional.test#L15-L18 + # "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64" would be preferrable, but breaks with dynamic linking, + # unless done globally in stdenv for all of 32 bit. + ./disable-end-of-epoch-conversion-test.patch + ]; # https://github.com/jqlang/jq/issues/2871 postPatch = lib.optionalString stdenv.hostPlatform.isFreeBSD ''