diff --git a/pkgs/build-support/fetchdebianpatch/default.nix b/pkgs/build-support/fetchdebianpatch/default.nix index ba6aa63a732..c058b416d38 100644 --- a/pkgs/build-support/fetchdebianpatch/default.nix +++ b/pkgs/build-support/fetchdebianpatch/default.nix @@ -3,12 +3,17 @@ lib.makeOverridable ( { pname, version, debianRevision ? null, patch, hash, area ? "main", name ? "${patch}.patch" }: - let versionString = - if debianRevision == null then version else "${version}-${debianRevision}"; + let + inherit (lib.strings) hasPrefix substring; + prefix = + substring 0 (if hasPrefix "lib" pname then 4 else 1) pname; + versionString = + if debianRevision == null then version + else "${version}-${debianRevision}"; in fetchpatch { inherit name hash; url = - "https://sources.debian.org/data/${area}/${builtins.substring 0 1 pname}/" + "https://sources.debian.org/data/${area}/${prefix}/" + "${pname}/${versionString}/debian/patches/${patch}.patch"; } ) diff --git a/pkgs/build-support/fetchdebianpatch/tests.nix b/pkgs/build-support/fetchdebianpatch/tests.nix index 2146f66ce70..58f3b395d1f 100644 --- a/pkgs/build-support/fetchdebianpatch/tests.nix +++ b/pkgs/build-support/fetchdebianpatch/tests.nix @@ -8,4 +8,12 @@ patch = "Add-quotes-to-SOAPAction-header-in-SoapClient"; hash = "sha256-xA8Wnrpr31H8wy3zHSNfezFNjUJt1HbSXn3qUMzeKc0="; }; + + libPackage = testers.invalidateFetcherByDrvHash fetchDebianPatch { + pname = "libfile-pid-perl"; + version = "1.01"; + debianRevision = "2"; + patch = "missing-pidfile"; + hash = "sha256-VBsIYyCnjcZLYQ2Uq2MKPK3kF2wiMKvnq0m727DoavM="; + }; }