Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

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

+131 -19
+3 -3
pkgs/applications/video/gnash/default.nix
··· 1 - { stdenv, fetchurl 1 + { stdenv, fetchurl, fetchpatch 2 2 , SDL, SDL_mixer, gstreamer, gst_plugins_base, gst_plugins_good 3 3 , gst_ffmpeg, speex 4 4 , libogg, libxml2, libjpeg, mesa, libpng, libungif, libtool ··· 11 11 assert stdenv ? glibc; 12 12 13 13 let version = "0.8.10"; 14 - patch_CVE = fetchurl { 14 + patch_CVE = fetchpatch { 15 15 url = "http://git.savannah.gnu.org/cgit/gnash.git/patch/?id=bb4dc77eecb6ed1b967e3ecbce3dac6c5e6f1527"; 16 - sha256 = "1g7ymbq9vxi0mwcgs2dpyd2sf30gaam7blza0ywiwj32f5wk62v1"; 16 + sha256 = "0ghnki5w7xf3qwfl1x6vhijpd6q608niyxrvh0g8dw5xavkvallk"; 17 17 name = "CVE-2012-1175.patch"; 18 18 }; 19 19 in
+22
pkgs/build-support/fetchpatch/default.nix
··· 1 + # This function downloads and normalizes a patch/diff file. 2 + # This is primarily useful for dynamically generated patches, 3 + # such as GitHub's or cgit's, where the non-significant content parts 4 + # often change with updating of git or cgit. 5 + # stripLen acts as the -p parameter when applying a patch. 6 + 7 + { fetchurl, patchutils }: 8 + { stripLen ? 0, ... }@args: 9 + 10 + fetchurl ({ 11 + postFetch = '' 12 + tmpfile="$TMPDIR/${args.sha256}" 13 + "${patchutils}/bin/lsdiff" "$out" \ 14 + | sort -u | sed -e 's/[*?]/\\&/g' \ 15 + | xargs -I{} \ 16 + "${patchutils}/bin/filterdiff" \ 17 + --include={} \ 18 + --strip=${toString stripLen} \ 19 + --clean "$out" > "$tmpfile" 20 + mv "$tmpfile" "$out" 21 + ''; 22 + } // args)
+2 -2
pkgs/development/libraries/haskell/HSH/default.nix
··· 1 1 { cabal, filepath, hslogger, MissingH, mtl, regexBase, regexCompat 2 - , regexPosix, fetchurl 2 + , regexPosix, fetchpatch 3 3 }: 4 4 5 5 cabal.mkDerivation (self: { ··· 11 11 buildDepends = [ 12 12 filepath hslogger MissingH mtl regexBase regexCompat regexPosix 13 13 ]; 14 - patches = [ (fetchurl { url = "https://github.com/jgoerzen/hsh/pull/10.patch"; sha256 = "0fw2ihl4hlncggwf3v4d7aydm3rzgzpcxplfbwq7janysix4q950"; }) ]; 14 + patches = [ (fetchpatch { url = "https://github.com/jgoerzen/hsh/pull/10.patch"; sha256 = "0ddb3vf8ipf37zg4hkqh0frff1a7sv9ils3lw6qd3irpbwna1hdz"; }) ]; 15 15 meta = { 16 16 homepage = "http://software.complete.org/hsh"; 17 17 description = "Library to mix shell scripting with Haskell programs";
+6 -5
pkgs/development/libraries/haskell/gitit/default.nix
··· 2 2 , filepath, filestore, ghcPaths, happstackServer, highlightingKate 3 3 , hslogger, HStringTemplate, HTTP, json, mtl, network, pandoc 4 4 , pandocTypes, parsec, random, recaptcha, safe, SHA, syb, tagsoup 5 - , text, time, url, utf8String, xhtml, xml, xssSanitize, zlib, fetchurl 5 + , text, time, url, utf8String, xhtml, xml, xssSanitize, zlib, fetchpatch 6 6 }: 7 7 8 8 cabal.mkDerivation (self: { ··· 19 19 zlib 20 20 ]; 21 21 jailbreak = true; 22 - patches = [ (fetchurl { url = "https://github.com/jgm/gitit/commit/48155008397bdaed4f97c5678d83c70d4bc3f0ff.patch"; 23 - sha256 = "0xdg9frr8lany8ry6vj4vpskmhkpww8jswnb05pzl8a4xfqxh9gd"; 24 - }) 25 - ]; 22 + patches = [ (fetchpatch { 23 + url = "https://github.com/jgm/gitit/commit/48155008397bdaed4f97c5678d83c70d4bc3f0ff.patch"; 24 + sha256 = "16n372wrikwb3g4pb3zljxnp19in0828wp40diqgkplhlnwww6nw"; 25 + }) 26 + ]; 26 27 preConfigure = '' 27 28 sed -i -e 's|network .*< 2.5|network|' gitit.cabal 28 29 '';
+2 -2
pkgs/development/tools/haskell/BNFC/default.nix
··· 1 - { cabal, mtl, fetchurl, alex, happy }: 1 + { cabal, mtl, fetchpatch, alex, happy }: 2 2 3 3 cabal.mkDerivation (self: { 4 4 pname = "BNFC"; ··· 8 8 isExecutable = true; 9 9 buildDepends = [ mtl ]; 10 10 buildTools = [ alex happy ]; 11 - patches = [ (fetchurl { url = "https://github.com/BNFC/bnfc/pull/3.patch"; sha256 = "103l04ylzswgxrmpv5zy6dd0jyr96z21mdkpgk1z4prvn8wjl624"; }) ]; 11 + patches = [ (fetchpatch { url = "https://github.com/BNFC/bnfc/pull/3.patch"; sha256 = "1i87crwva5m3v095lv3zxs38pr6nmly58krlr6sxpwnakpr0pxsp"; }) ]; 12 12 patchFlags = "-p2"; 13 13 preConfigure = "runhaskell Setup.lhs clean"; 14 14 meta = {
+2 -2
pkgs/development/tools/parsing/alex/3.0.5.nix
··· 1 - { cabal, fetchurl, perl, QuickCheck }: 1 + { cabal, fetchpatch, perl, QuickCheck }: 2 2 3 3 cabal.mkDerivation (self: { 4 4 pname = "alex"; ··· 8 8 isExecutable = true; 9 9 buildDepends = [ QuickCheck ]; 10 10 buildTools = [ perl ]; 11 - patches = [ (fetchurl { url="https://github.com/simonmar/alex/pull/21.patch"; sha256="0apv3rk00gwkf5rqw3467bg6pnamr07zdksbp9khhzzi73k9aq4f"; }) ]; 11 + patches = [ (fetchpatch { url="http://github.com/simonmar/alex/pull/21.patch"; sha256="050psfwmjlxhyxiy65jsn3v6b9rnfzy8x5q9mmhzwbirqwi0zkfm"; }) ]; 12 12 meta = { 13 13 homepage = "http://www.haskell.org/alex/"; 14 14 description = "Alex is a tool for generating lexical analysers in Haskell";
+2 -2
pkgs/servers/x11/xorg/overrides.nix
··· 178 178 }; 179 179 180 180 xf86videonv = attrs: attrs // { 181 - patches = [( args.fetchurl { 181 + patches = [( args.fetchpatch { 182 182 url = http://cgit.freedesktop.org/xorg/driver/xf86-video-nv/patch/?id=fc78fe98222b0204b8a2872a529763d6fe5048da; 183 - sha256 = "0ikbnz6048ygs1qahb6ylnxkyjhfjcqr2gm9bk95ca90v57j7i0f"; 183 + sha256 = "0i2ddgqwj6cfnk8f4r73kkq3cna7hfnz7k3xj3ifx5v8mfiva6gw"; 184 184 })]; 185 185 }; 186 186
+5 -2
pkgs/tools/text/patchutils/default.nix
··· 8 8 sha256 = "0g5df00cj4nczrmr4k791l7la0sq2wnf8rn981fsrz1f3d2yix4i"; 9 9 }; 10 10 11 - meta = { 11 + patches = [ ./drop-comments.patch ]; # we would get into a cycle when using fetchpatch on this one 12 + 13 + meta = with stdenv.lib; { 12 14 description = "Tools to manipulate patch files"; 13 15 homepage = http://cyberelk.net/tim/software/patchutils; 14 - license = "GPLv2"; 16 + license = licenses.gpl2Plus; 17 + platforms = platforms.all; 15 18 executables = [ "combinediff" "dehtmldiff" "editdiff" "espdiff" 16 19 "filterdiff" "fixcvsdiff" "flipdiff" "grepdiff" "interdiff" "lsdiff" 17 20 "recountdiff" "rediff" "splitdiff" "unwrapdiff" ];
+84
pkgs/tools/text/patchutils/drop-comments.patch
··· 1 + From 58987954647f51dc42fb13b7759923c6170dd905 Mon Sep 17 00:00:00 2001 2 + From: Tim Waugh <twaugh@redhat.com> 3 + Date: Fri, 9 May 2014 16:23:27 +0100 4 + Subject: Make --clean drop comments after '@@' lines as well (trac #29). 5 + 6 + 7 + diff --git a/Makefile.am b/Makefile.am 8 + index 99ad2a3..f3c6dbc 100644 9 + --- a/Makefile.am 10 + +++ b/Makefile.am 11 + @@ -198,6 +198,7 @@ TESTS = tests/newline1/run-test \ 12 + tests/convert1/run-test \ 13 + tests/convert2/run-test \ 14 + tests/clean1/run-test \ 15 + + tests/clean2/run-test \ 16 + tests/stdin/run-test 17 + 18 + # These ones don't work yet. 19 + diff --git a/src/filterdiff.c b/src/filterdiff.c 20 + index 383e72b..6ca2316 100644 21 + --- a/src/filterdiff.c 22 + +++ b/src/filterdiff.c 23 + @@ -2,7 +2,7 @@ 24 + * filterdiff - extract (or exclude) a diff from a diff file 25 + * lsdiff - show which files are modified by a patch 26 + * grepdiff - show files modified by a patch containing a regexp 27 + - * Copyright (C) 2001, 2002, 2003, 2004, 2008, 2009, 2011 Tim Waugh <twaugh@redhat.com> 28 + + * Copyright (C) 2001, 2002, 2003, 2004, 2008, 2009, 2011, 2013, 2014 Tim Waugh <twaugh@redhat.com> 29 + * 30 + * This program is free software; you can redistribute it and/or modify 31 + * it under the terms of the GNU General Public License as published by 32 + @@ -408,7 +408,8 @@ do_unified (FILE *f, char *header[2], int match, char **line, 33 + " Hunk #%lu, %s", 34 + hunknum, bestname); 35 + 36 + - fputs (trailing, output_to); 37 + + fputs (clean_comments ? "\n" : trailing, 38 + + output_to); 39 + break; 40 + case Before: 41 + // Note the initial line number 42 + diff --git a/tests/clean2/run-test b/tests/clean2/run-test 43 + new file mode 100755 44 + index 0000000..42320df 45 + --- /dev/null 46 + +++ b/tests/clean2/run-test 47 + @@ -0,0 +1,34 @@ 48 + +#!/bin/sh 49 + + 50 + +# This is a filterdiff(1) testcase. 51 + +# Test: Make sure --clean removes hunk-level comments. 52 + + 53 + + 54 + +. ${top_srcdir-.}/tests/common.sh 55 + + 56 + +cat << EOF > diff 57 + +non-diff line 58 + +--- a/file1 59 + ++++ b/file1 60 + +@@ -0,0 +1 @@ this is a hunk-level comment 61 + ++a 62 + +EOF 63 + + 64 + +${FILTERDIFF} --clean diff 2>errors >filtered || exit 1 65 + +[ -s errors ] && exit 1 66 + + 67 + +cat << EOF | cmp - filtered || exit 1 68 + +--- a/file1 69 + ++++ b/file1 70 + +@@ -0,0 +1 @@ 71 + ++a 72 + +EOF 73 + + 74 + +${FILTERDIFF} --clean -x file1 diff 2>errors >filtered || exit 1 75 + +[ -s errors ] && exit 1 76 + +cat << EOF | cmp - filtered || exit 1 77 + +--- a/file1 78 + ++++ b/file1 79 + +@@ -0,0 +1 @@ 80 + ++a 81 + +EOF 82 + -- 83 + cgit v0.10.1 84 +
+3 -1
pkgs/top-level/all-packages.nix
··· 327 327 328 328 fetchmtn = callPackage ../build-support/fetchmtn (config.fetchmtn or {}); 329 329 330 + fetchpatch = callPackage ../build-support/fetchpatch { }; 331 + 330 332 fetchsvn = import ../build-support/fetchsvn { 331 333 inherit stdenv subversion openssh; 332 334 sshSupport = true; ··· 6778 6780 xinetd = callPackage ../servers/xinetd { }; 6779 6781 6780 6782 xorg = recurseIntoAttrs (import ../servers/x11/xorg/default.nix { 6781 - inherit fetchurl fetchgit stdenv pkgconfig intltool freetype fontconfig 6783 + inherit fetchurl fetchgit fetchpatch stdenv pkgconfig intltool freetype fontconfig 6782 6784 libxslt expat libdrm libpng zlib perl mesa_drivers 6783 6785 dbus libuuid openssl gperf m4 6784 6786 autoconf automake libtool xmlto asciidoc udev flex bison python mtdev pixman;