fetchDebianPatch: Require patch names with extensions

Otherwise the fetcher is unuseable with patches
whose filename (in Debian) doesn't end in `.patch`.
This commit is contained in:
Weijia Wang 2023-09-06 19:47:59 +02:00 committed by nicoo
parent 4fdb5e275d
commit 0cfc319f83
2 changed files with 5 additions and 5 deletions

View file

@ -86,7 +86,7 @@ Most other fetchers return a directory rather than a single file.
## `fetchDebianPatch` {#fetchdebianpatch} ## `fetchDebianPatch` {#fetchdebianpatch}
A wrapper around `fetchpatch`, which takes: A wrapper around `fetchpatch`, which takes:
- `patch` and `hash`: the patch's filename without the `.patch` suffix, - `patch` and `hash`: the patch's filename,
and its hash after normalization by `fetchpatch` ; and its hash after normalization by `fetchpatch` ;
- `pname`: the Debian source package's name ; - `pname`: the Debian source package's name ;
- `version`: the upstream version number ; - `version`: the upstream version number ;
@ -110,7 +110,7 @@ buildPythonPackage rec {
(fetchDebianPatch { (fetchDebianPatch {
inherit pname version; inherit pname version;
debianRevision = "5"; debianRevision = "5";
name = "Add-quotes-to-SOAPAction-header-in-SoapClient"; name = "Add-quotes-to-SOAPAction-header-in-SoapClient.patch";
hash = "sha256-xA8Wnrpr31H8wy3zHSNfezFNjUJt1HbSXn3qUMzeKc0="; hash = "sha256-xA8Wnrpr31H8wy3zHSNfezFNjUJt1HbSXn3qUMzeKc0=";
}) })
]; ];

View file

@ -1,8 +1,8 @@
{ lib, fetchpatch }: { lib, fetchpatch }:
lib.makeOverridable ( lib.makeOverridable (
{ pname, version, debianRevision ? null, patch, hash, { pname, version, debianRevision ? null, area ? "main",
area ? "main", name ? "${patch}.patch" }: patch, name ? patch, hash }:
let let
inherit (lib.strings) hasPrefix substring; inherit (lib.strings) hasPrefix substring;
prefix = prefix =
@ -14,6 +14,6 @@ lib.makeOverridable (
inherit name hash; inherit name hash;
url = url =
"https://sources.debian.org/data/${area}/${prefix}/" "https://sources.debian.org/data/${area}/${prefix}/"
+ "${pname}/${versionString}/debian/patches/${patch}.patch"; + "${pname}/${versionString}/debian/patches/${patch}";
} }
) )