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}
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` ;
- `pname`: the Debian source package's name ;
- `version`: the upstream version number ;
@ -110,7 +110,7 @@ buildPythonPackage rec {
(fetchDebianPatch {
inherit pname version;
debianRevision = "5";
name = "Add-quotes-to-SOAPAction-header-in-SoapClient";
name = "Add-quotes-to-SOAPAction-header-in-SoapClient.patch";
hash = "sha256-xA8Wnrpr31H8wy3zHSNfezFNjUJt1HbSXn3qUMzeKc0=";
})
];

View file

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