fetchDebianPatch: Handle the case of `lib*` packages

nicoo 76aedfaa d613fb52

+16 -3
+8 -3
pkgs/build-support/fetchdebianpatch/default.nix
··· 3 3 lib.makeOverridable ( 4 4 { pname, version, debianRevision ? null, patch, hash, 5 5 area ? "main", name ? "${patch}.patch" }: 6 - let versionString = 7 - if debianRevision == null then version else "${version}-${debianRevision}"; 6 + let 7 + inherit (lib.strings) hasPrefix substring; 8 + prefix = 9 + substring 0 (if hasPrefix "lib" pname then 4 else 1) pname; 10 + versionString = 11 + if debianRevision == null then version 12 + else "${version}-${debianRevision}"; 8 13 in fetchpatch { 9 14 inherit name hash; 10 15 url = 11 - "https://sources.debian.org/data/${area}/${builtins.substring 0 1 pname}/" 16 + "https://sources.debian.org/data/${area}/${prefix}/" 12 17 + "${pname}/${versionString}/debian/patches/${patch}.patch"; 13 18 } 14 19 )
+8
pkgs/build-support/fetchdebianpatch/tests.nix
··· 8 8 patch = "Add-quotes-to-SOAPAction-header-in-SoapClient"; 9 9 hash = "sha256-xA8Wnrpr31H8wy3zHSNfezFNjUJt1HbSXn3qUMzeKc0="; 10 10 }; 11 + 12 + libPackage = testers.invalidateFetcherByDrvHash fetchDebianPatch { 13 + pname = "libfile-pid-perl"; 14 + version = "1.01"; 15 + debianRevision = "2"; 16 + patch = "missing-pidfile"; 17 + hash = "sha256-VBsIYyCnjcZLYQ2Uq2MKPK3kF2wiMKvnq0m727DoavM="; 18 + }; 11 19 }