summary refs log tree commit diff
path: root/pkgs/tools/text/patchutils
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2014-05-17 07:27:29 +0200
committerVladimír Čunát <vcunat@gmail.com>2014-05-17 07:31:03 +0200
commit137eae0b55949bcfd6a2f4ba12964db8bdfae954 (patch)
tree66dd96bbf6ea56cd007e9900b1cacf39a18743cb /pkgs/tools/text/patchutils
parent4ac818601e5b38c2be4add23a2932810f977210b (diff)
downloadnixpkgs-137eae0b55949bcfd6a2f4ba12964db8bdfae954.tar
nixpkgs-137eae0b55949bcfd6a2f4ba12964db8bdfae954.tar.gz
nixpkgs-137eae0b55949bcfd6a2f4ba12964db8bdfae954.tar.bz2
nixpkgs-137eae0b55949bcfd6a2f4ba12964db8bdfae954.tar.lz
nixpkgs-137eae0b55949bcfd6a2f4ba12964db8bdfae954.tar.xz
nixpkgs-137eae0b55949bcfd6a2f4ba12964db8bdfae954.tar.zst
nixpkgs-137eae0b55949bcfd6a2f4ba12964db8bdfae954.zip
Merge #2630: add and use fetchpatch
fetchpatch is fetchurl that determinizes the patch.
Some parts of generated patches change from time to time, e.g. see #1983 and
http://comments.gmane.org/gmane.linux.distributions.nixos/12815
Using fetchpatch should prevent the hash from changing.

Conflicts (auto-solved):
	pkgs/development/libraries/haskell/gitit/default.nix
Diffstat (limited to 'pkgs/tools/text/patchutils')
-rw-r--r--pkgs/tools/text/patchutils/default.nix7
-rw-r--r--pkgs/tools/text/patchutils/drop-comments.patch84
2 files changed, 89 insertions, 2 deletions
diff --git a/pkgs/tools/text/patchutils/default.nix b/pkgs/tools/text/patchutils/default.nix
index 50232c5a41d..4df52eef669 100644
--- a/pkgs/tools/text/patchutils/default.nix
+++ b/pkgs/tools/text/patchutils/default.nix
@@ -8,10 +8,13 @@ stdenv.mkDerivation rec {
     sha256 = "0g5df00cj4nczrmr4k791l7la0sq2wnf8rn981fsrz1f3d2yix4i";
   };
 
-  meta = {
+  patches = [ ./drop-comments.patch ]; # we would get into a cycle when using fetchpatch on this one
+
+  meta = with stdenv.lib; {
     description = "Tools to manipulate patch files";
     homepage = http://cyberelk.net/tim/software/patchutils;
-    license = "GPLv2";
+    license = licenses.gpl2Plus;
+    platforms = platforms.all;
     executables = [ "combinediff" "dehtmldiff" "editdiff" "espdiff"
       "filterdiff" "fixcvsdiff" "flipdiff" "grepdiff" "interdiff" "lsdiff"
       "recountdiff" "rediff" "splitdiff" "unwrapdiff" ];
diff --git a/pkgs/tools/text/patchutils/drop-comments.patch b/pkgs/tools/text/patchutils/drop-comments.patch
new file mode 100644
index 00000000000..e02693a5683
--- /dev/null
+++ b/pkgs/tools/text/patchutils/drop-comments.patch
@@ -0,0 +1,84 @@
+From 58987954647f51dc42fb13b7759923c6170dd905 Mon Sep 17 00:00:00 2001
+From: Tim Waugh <twaugh@redhat.com>
+Date: Fri, 9 May 2014 16:23:27 +0100
+Subject: Make --clean drop comments after '@@' lines as well (trac #29).
+
+
+diff --git a/Makefile.am b/Makefile.am
+index 99ad2a3..f3c6dbc 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -198,6 +198,7 @@ TESTS = tests/newline1/run-test \
+ 	tests/convert1/run-test \
+ 	tests/convert2/run-test \
+ 	tests/clean1/run-test \
++	tests/clean2/run-test \
+ 	tests/stdin/run-test
+ 
+ # These ones don't work yet.
+diff --git a/src/filterdiff.c b/src/filterdiff.c
+index 383e72b..6ca2316 100644
+--- a/src/filterdiff.c
++++ b/src/filterdiff.c
+@@ -2,7 +2,7 @@
+  * filterdiff - extract (or exclude) a diff from a diff file
+  * lsdiff - show which files are modified by a patch
+  * grepdiff - show files modified by a patch containing a regexp
+- * Copyright (C) 2001, 2002, 2003, 2004, 2008, 2009, 2011 Tim Waugh <twaugh@redhat.com>
++ * Copyright (C) 2001, 2002, 2003, 2004, 2008, 2009, 2011, 2013, 2014 Tim Waugh <twaugh@redhat.com>
+  *
+  * This program is free software; you can redistribute it and/or modify
+  * it under the terms of the GNU General Public License as published by
+@@ -408,7 +408,8 @@ do_unified (FILE *f, char *header[2], int match, char **line,
+ 							 " Hunk #%lu, %s",
+ 							 hunknum, bestname);
+ 
+-					fputs (trailing, output_to);
++					fputs (clean_comments ? "\n" : trailing,
++					       output_to);
+ 					break;
+ 				case Before:
+ 					// Note the initial line number
+diff --git a/tests/clean2/run-test b/tests/clean2/run-test
+new file mode 100755
+index 0000000..42320df
+--- /dev/null
++++ b/tests/clean2/run-test
+@@ -0,0 +1,34 @@
++#!/bin/sh
++
++# This is a filterdiff(1) testcase.
++# Test: Make sure --clean removes hunk-level comments.
++
++
++. ${top_srcdir-.}/tests/common.sh
++
++cat << EOF > diff
++non-diff line
++--- a/file1
+++++ b/file1
++@@ -0,0 +1 @@ this is a hunk-level comment
+++a
++EOF
++
++${FILTERDIFF} --clean diff 2>errors >filtered || exit 1
++[ -s errors ] && exit 1
++
++cat << EOF | cmp - filtered || exit 1
++--- a/file1
+++++ b/file1
++@@ -0,0 +1 @@
+++a
++EOF
++
++${FILTERDIFF} --clean -x file1 diff 2>errors >filtered || exit 1
++[ -s errors ] && exit 1
++cat << EOF | cmp - filtered || exit 1
++--- a/file1
+++++ b/file1
++@@ -0,0 +1 @@
+++a
++EOF
+-- 
+cgit v0.10.1
+