From 2253728351e712677bff9514ff70cf132b9ce32f Mon Sep 17 00:00:00 2001 From: toonn Date: Mon, 12 Jul 2021 17:37:04 +0200 Subject: [PATCH] sphinx: Patch source file for normalization One of the test files has a different encoding depending on the filesystem's normalization. By picking a character that does not have multiple possible encodings we make the source indifferent to normalization. This allows the FOD hash to match across platforms with differently normalizing filesystems. --- ...e-normalization-equivalent-character.patch | 35 +++++++++++++++++++ .../python-modules/sphinx/default.nix | 8 ++++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/python-modules/sphinx/0001-test-images-Use-normalization-equivalent-character.patch diff --git a/pkgs/development/python-modules/sphinx/0001-test-images-Use-normalization-equivalent-character.patch b/pkgs/development/python-modules/sphinx/0001-test-images-Use-normalization-equivalent-character.patch new file mode 100644 index 000000000000..805e724d0c8c --- /dev/null +++ b/pkgs/development/python-modules/sphinx/0001-test-images-Use-normalization-equivalent-character.patch @@ -0,0 +1,35 @@ +From 181617387841b695ee77b162babf9fb177002fcb Mon Sep 17 00:00:00 2001 +From: toonn +Date: Mon, 20 Sep 2021 11:39:46 +0200 +Subject: [PATCH] test-images: Use normalization equivalent character +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +One of the test images used a combining character `ä` that can be +encoded multiple ways. This means the file's name can end up encoded +differently depending on whether/which normal form the filesystem uses. + +For Nix this causes a different hash for a FOD depending on the +filesystem where it is evaluated. This is problematic because hashes +fail to match up when evaluating the FOD across multiple platforms. +--- + tests/roots/test-images/index.rst | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/roots/test-images/index.rst b/tests/roots/test-images/index.rst +index 14a2987..219842e 100644 +--- a/tests/roots/test-images/index.rst ++++ b/tests/roots/test-images/index.rst +@@ -13,7 +13,7 @@ test-image + + The caption of img + +-.. image:: testimäge.png ++.. image:: testimæge.png + + .. image:: rimg.png + :target: https://www.sphinx-doc.org/ +-- +2.17.2 (Apple Git-113) + diff --git a/pkgs/development/python-modules/sphinx/default.nix b/pkgs/development/python-modules/sphinx/default.nix index 9d82b4c59810..abe303507443 100644 --- a/pkgs/development/python-modules/sphinx/default.nix +++ b/pkgs/development/python-modules/sphinx/default.nix @@ -35,7 +35,13 @@ buildPythonPackage rec { owner = "sphinx-doc"; repo = pname; rev = "v${version}"; - sha256 = "1i38n5bxqiycjwmiv9dl72r3f5ks4zmif30znqg8zilclbx6g16x"; + sha256 = "1bl0k326h32dag41axbsjq1d9w59rm11naj6bfirg116nqw56mk6"; + extraPostFetch = '' + cd $out + mv tests/roots/test-images/testimäge.png \ + tests/roots/test-images/testimæge.png + patch -p1 < ${./0001-test-images-Use-normalization-equivalent-character.patch} + ''; }; propagatedBuildInputs = [