diff --git a/pkgs/build-support/fetchpatch/tests.nix b/pkgs/build-support/fetchpatch/tests.nix new file mode 100644 index 000000000000..4240b325d656 --- /dev/null +++ b/pkgs/build-support/fetchpatch/tests.nix @@ -0,0 +1,8 @@ +{ invalidateFetcherByDrvHash, fetchpatch, ... }: + +{ + simple = invalidateFetcherByDrvHash fetchpatch { + url = "https://github.com/facebook/zstd/pull/2724/commits/e1f85dbca3a0ed5ef06c8396912a0914db8dea6a.patch"; + sha256 = "sha256-PuYAqnJWAE+L9bsroOnnBGJhERW8LHrGSLtIEkKU9vg="; + }; +} diff --git a/pkgs/tools/text/patchutils/0.4.2.nix b/pkgs/tools/text/patchutils/0.4.2.nix new file mode 100644 index 000000000000..1b2c0d6b1f3e --- /dev/null +++ b/pkgs/tools/text/patchutils/0.4.2.nix @@ -0,0 +1,8 @@ +{ callPackage, python3, ... } @ args: + +callPackage ./generic.nix (args // { + version = "0.4.2"; + sha256 = "sha256-iHWwll/jPeYriQ9s15O+f6/kGk5VLtv2QfH+1eu/Re0="; + # for gitdiff + extraBuildInputs = [ python3 ]; +}) diff --git a/pkgs/tools/text/patchutils/generic.nix b/pkgs/tools/text/patchutils/generic.nix index d3e9da242e2e..923dd06d1826 100644 --- a/pkgs/tools/text/patchutils/generic.nix +++ b/pkgs/tools/text/patchutils/generic.nix @@ -1,5 +1,5 @@ -{ lib, stdenv, fetchurl, perl -, version, sha256, patches ? [] +{ lib, stdenv, fetchurl, perl, makeWrapper +, version, sha256, patches ? [], extraBuildInputs ? [] , ... }: stdenv.mkDerivation rec { @@ -11,18 +11,32 @@ stdenv.mkDerivation rec { inherit sha256; }; - buildInputs = [ perl ]; + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ perl ] ++ extraBuildInputs; hardeningDisable = [ "format" ]; - doCheck = false; # fails + postInstall = '' + for bin in $out/bin/{splitdiff,rediff,editdiff,dehtmldiff}; do + wrapProgram "$bin" \ + --prefix PATH : "$out/bin" + done + ''; + + doCheck = lib.versionAtLeast version "0.3.4"; + + preCheck = '' + patchShebangs tests + chmod +x scripts/* + '' + lib.optionalString (lib.versionOlder version "0.4.2") '' + find tests -type f -name 'run-test' \ + -exec sed -i '{}' -e 's|/bin/echo|echo|g' \; + ''; meta = with lib; { description = "Tools to manipulate patch files"; homepage = "http://cyberelk.net/tim/software/patchutils"; license = licenses.gpl2Plus; platforms = platforms.all; - executables = [ "combinediff" "dehtmldiff" "editdiff" "espdiff" - "filterdiff" "fixcvsdiff" "flipdiff" "grepdiff" "interdiff" "lsdiff" - "recountdiff" "rediff" "splitdiff" "unwrapdiff" ]; + maintainers = with maintainers; [ artturin ]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index eac377f9aa28..b83938c39ff3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -507,7 +507,10 @@ with pkgs; mht2htm = callPackage ../tools/misc/mht2htm { }; - fetchpatch = callPackage ../build-support/fetchpatch { }; + fetchpatch = callPackage ../build-support/fetchpatch { } + // { + tests = callPackages ../build-support/fetchpatch/tests.nix { }; + }; fetchs3 = callPackage ../build-support/fetchs3 { }; @@ -8296,6 +8299,8 @@ with pkgs; patchutils_0_3_3 = callPackage ../tools/text/patchutils/0.3.3.nix { }; + patchutils_0_4_2 = callPackage ../tools/text/patchutils/0.4.2.nix { }; + parted = callPackage ../tools/misc/parted { }; passh = callPackage ../tools/networking/passh { };