mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-17 14:19:58 +03:00
Merge pull request #252225 from nbraud/fetchDebianPatch
This commit is contained in:
commit
edfb18664a
@ -82,6 +82,53 @@ Note that because the checksum is computed after applying these effects, using o
|
||||
|
||||
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,
|
||||
and its hash after normalization by `fetchpatch` ;
|
||||
- `pname`: the Debian source package's name ;
|
||||
- `version`: the upstream version number ;
|
||||
- `debianRevision`: the [Debian revision number] if applicable ;
|
||||
- the `area` of the Debian archive: `main` (default), `contrib`, or `non-free`.
|
||||
|
||||
Here is an example of `fetchDebianPatch` in action:
|
||||
|
||||
```nix
|
||||
{ lib
|
||||
, fetchDebianPatch
|
||||
, buildPythonPackage
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "pysimplesoap";
|
||||
version = "1.16.2";
|
||||
src = ...;
|
||||
|
||||
patches = [
|
||||
(fetchDebianPatch {
|
||||
inherit pname version;
|
||||
debianRevision = "5";
|
||||
name = "Add-quotes-to-SOAPAction-header-in-SoapClient";
|
||||
hash = "sha256-xA8Wnrpr31H8wy3zHSNfezFNjUJt1HbSXn3qUMzeKc0=";
|
||||
})
|
||||
];
|
||||
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Patches are fetched from `sources.debian.org`, and so must come from a
|
||||
package version that was uploaded to the Debian archive. Packages may
|
||||
be removed from there once that specific version isn't in any suite
|
||||
anymore (stable, testing, unstable, etc.), so maintainers should use
|
||||
`copy-tarballs.pl` to archive the patch if it needs to be available
|
||||
longer-term.
|
||||
|
||||
[Debian revision number]: https://www.debian.org/doc/debian-policy/ch-controlfields.html#version
|
||||
|
||||
|
||||
## `fetchsvn` {#fetchsvn}
|
||||
|
||||
Used with Subversion. Expects `url` to a Subversion directory, `rev`, and `hash`.
|
||||
|
19
pkgs/build-support/fetchdebianpatch/default.nix
Normal file
19
pkgs/build-support/fetchdebianpatch/default.nix
Normal file
@ -0,0 +1,19 @@
|
||||
{ lib, fetchpatch }:
|
||||
|
||||
lib.makeOverridable (
|
||||
{ pname, version, debianRevision ? null, patch, hash,
|
||||
area ? "main", name ? "${patch}.patch" }:
|
||||
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}/${prefix}/"
|
||||
+ "${pname}/${versionString}/debian/patches/${patch}.patch";
|
||||
}
|
||||
)
|
19
pkgs/build-support/fetchdebianpatch/tests.nix
Normal file
19
pkgs/build-support/fetchdebianpatch/tests.nix
Normal file
@ -0,0 +1,19 @@
|
||||
{ testers, fetchDebianPatch, ... }:
|
||||
|
||||
{
|
||||
simple = testers.invalidateFetcherByDrvHash fetchDebianPatch {
|
||||
pname = "pysimplesoap";
|
||||
version = "1.16.2";
|
||||
debianRevision = "5";
|
||||
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=";
|
||||
};
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
{ lib
|
||||
, fetchpatch
|
||||
, fetchDebianPatch
|
||||
, fetchPypi
|
||||
, buildPythonPackage
|
||||
, m2crypto
|
||||
@ -20,28 +20,24 @@ buildPythonPackage rec {
|
||||
m2crypto
|
||||
];
|
||||
|
||||
patches =
|
||||
let
|
||||
debianRevision = "5"; # The Debian package revision we get patches from
|
||||
fetchDebianPatch = { name, hash }: fetchpatch {
|
||||
url = "https://salsa.debian.org/python-team/packages/pysimplesoap/-/raw/debian/${version}-${debianRevision}/debian/patches/${name}.patch";
|
||||
inherit hash;
|
||||
};
|
||||
in map fetchDebianPatch [
|
||||
# Merged upstream: f5f96210e1483f81cb5c582a6619e3ec4b473027
|
||||
{ name = "Add-quotes-to-SOAPAction-header-in-SoapClient";
|
||||
hash = "sha256-xA8Wnrpr31H8wy3zHSNfezFNjUJt1HbSXn3qUMzeKc0="; }
|
||||
# Merged upstream: ad03a21cafab982eed321553c4bfcda1755182eb
|
||||
{ name = "fix-httplib2-version-check";
|
||||
hash = "sha256-zUeF3v0N/eMyRVRH3tQLfuUfMKOD/B/aqEwFh/7HxH4="; }
|
||||
{ name = "reorder-type-check-to-avoid-a-TypeError";
|
||||
hash = "sha256-2p5Cqvh0SPfJ8B38wb/xq7jWGYgpI9pavA6qkMUb6hA="; }
|
||||
# Merged upstream: 033e5899e131a2c1bdf7db5852f816f42aac9227
|
||||
{ name = "Support-integer-values-in-maxOccurs-attribute";
|
||||
hash = "sha256-IZ0DP7io+ihcnB5547cR53FAdnpRLR6z4J5KsNrkfaI="; }
|
||||
{ name = "PR204";
|
||||
hash = "sha256-JlxeTnKDFxvEMFBthZsaYRbNOoBvLJhBnXCRoiL/nVw="; }
|
||||
] ++ [ ./stringIO.patch ];
|
||||
patches = map (args: fetchDebianPatch ({
|
||||
inherit pname version;
|
||||
debianRevision = "5";
|
||||
} // args)) [
|
||||
# Merged upstream: f5f96210e1483f81cb5c582a6619e3ec4b473027
|
||||
{ patch = "Add-quotes-to-SOAPAction-header-in-SoapClient";
|
||||
hash = "sha256-xA8Wnrpr31H8wy3zHSNfezFNjUJt1HbSXn3qUMzeKc0="; }
|
||||
# Merged upstream: ad03a21cafab982eed321553c4bfcda1755182eb
|
||||
{ patch = "fix-httplib2-version-check";
|
||||
hash = "sha256-zUeF3v0N/eMyRVRH3tQLfuUfMKOD/B/aqEwFh/7HxH4="; }
|
||||
{ patch = "reorder-type-check-to-avoid-a-TypeError";
|
||||
hash = "sha256-2p5Cqvh0SPfJ8B38wb/xq7jWGYgpI9pavA6qkMUb6hA="; }
|
||||
# Merged upstream: 033e5899e131a2c1bdf7db5852f816f42aac9227
|
||||
{ patch = "Support-integer-values-in-maxOccurs-attribute";
|
||||
hash = "sha256-IZ0DP7io+ihcnB5547cR53FAdnpRLR6z4J5KsNrkfaI="; }
|
||||
{ patch = "PR204";
|
||||
hash = "sha256-JlxeTnKDFxvEMFBthZsaYRbNOoBvLJhBnXCRoiL/nVw="; }
|
||||
] ++ [ ./stringIO.patch ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Python simple and lightweight SOAP Library";
|
||||
|
@ -35,6 +35,7 @@ with pkgs;
|
||||
fetchurl = callPackages ../build-support/fetchurl/tests.nix { };
|
||||
fetchpatch = callPackages ../build-support/fetchpatch/tests.nix { };
|
||||
fetchpatch2 = callPackages ../build-support/fetchpatch/tests.nix { fetchpatch = fetchpatch2; };
|
||||
fetchDebianPatch = callPackages ../build-support/fetchdebianpatch/tests.nix { };
|
||||
fetchzip = callPackages ../build-support/fetchzip/tests.nix { };
|
||||
fetchgit = callPackages ../build-support/fetchgit/tests.nix { };
|
||||
fetchFirefoxAddon = callPackages ../build-support/fetchfirefoxaddon/tests.nix { };
|
||||
|
@ -1175,6 +1175,11 @@ with pkgs;
|
||||
tests = pkgs.tests.fetchzip;
|
||||
};
|
||||
|
||||
fetchDebianPatch = callPackage ../build-support/fetchdebianpatch { }
|
||||
// {
|
||||
tests = pkgs.tests.fetchDebianPatch;
|
||||
};
|
||||
|
||||
fetchCrate = callPackage ../build-support/rust/fetchcrate.nix { };
|
||||
|
||||
fetchFromGitea = callPackage ../build-support/fetchgitea { };
|
||||
|
Loading…
Reference in New Issue
Block a user