about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/fetchdebianpatch
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/build-support/fetchdebianpatch')
-rw-r--r--nixpkgs/pkgs/build-support/fetchdebianpatch/default.nix19
-rw-r--r--nixpkgs/pkgs/build-support/fetchdebianpatch/tests.nix19
2 files changed, 38 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/build-support/fetchdebianpatch/default.nix b/nixpkgs/pkgs/build-support/fetchdebianpatch/default.nix
new file mode 100644
index 000000000000..c058b416d381
--- /dev/null
+++ b/nixpkgs/pkgs/build-support/fetchdebianpatch/default.nix
@@ -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";
+  }
+)
diff --git a/nixpkgs/pkgs/build-support/fetchdebianpatch/tests.nix b/nixpkgs/pkgs/build-support/fetchdebianpatch/tests.nix
new file mode 100644
index 000000000000..58f3b395d1fc
--- /dev/null
+++ b/nixpkgs/pkgs/build-support/fetchdebianpatch/tests.nix
@@ -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=";
+  };
+}