From 137eae0b55949bcfd6a2f4ba12964db8bdfae954 Mon Sep 17 00:00:00 2001 From: Vladimír Čunát Date: Sat, 17 May 2014 07:27:29 +0200 Subject: 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 --- pkgs/applications/video/gnash/default.nix | 6 +- pkgs/build-support/fetchpatch/default.nix | 22 ++++++ pkgs/development/libraries/haskell/HSH/default.nix | 4 +- .../libraries/haskell/gitit/default.nix | 11 +-- pkgs/development/tools/haskell/BNFC/default.nix | 4 +- pkgs/development/tools/parsing/alex/3.0.5.nix | 4 +- pkgs/servers/x11/xorg/overrides.nix | 4 +- pkgs/tools/text/patchutils/default.nix | 7 +- pkgs/tools/text/patchutils/drop-comments.patch | 84 ++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 +- 10 files changed, 131 insertions(+), 19 deletions(-) create mode 100644 pkgs/build-support/fetchpatch/default.nix create mode 100644 pkgs/tools/text/patchutils/drop-comments.patch (limited to 'pkgs') diff --git a/pkgs/applications/video/gnash/default.nix b/pkgs/applications/video/gnash/default.nix index ef40d614a397d..2e8b7e63cb82a 100644 --- a/pkgs/applications/video/gnash/default.nix +++ b/pkgs/applications/video/gnash/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl +{ stdenv, fetchurl, fetchpatch , SDL, SDL_mixer, gstreamer, gst_plugins_base, gst_plugins_good , gst_ffmpeg, speex , libogg, libxml2, libjpeg, mesa, libpng, libungif, libtool @@ -11,9 +11,9 @@ assert stdenv ? glibc; let version = "0.8.10"; - patch_CVE = fetchurl { + patch_CVE = fetchpatch { url = "http://git.savannah.gnu.org/cgit/gnash.git/patch/?id=bb4dc77eecb6ed1b967e3ecbce3dac6c5e6f1527"; - sha256 = "1g7ymbq9vxi0mwcgs2dpyd2sf30gaam7blza0ywiwj32f5wk62v1"; + sha256 = "0ghnki5w7xf3qwfl1x6vhijpd6q608niyxrvh0g8dw5xavkvallk"; name = "CVE-2012-1175.patch"; }; in diff --git a/pkgs/build-support/fetchpatch/default.nix b/pkgs/build-support/fetchpatch/default.nix new file mode 100644 index 0000000000000..768d173934d56 --- /dev/null +++ b/pkgs/build-support/fetchpatch/default.nix @@ -0,0 +1,22 @@ +# This function downloads and normalizes a patch/diff file. +# This is primarily useful for dynamically generated patches, +# such as GitHub's or cgit's, where the non-significant content parts +# often change with updating of git or cgit. +# stripLen acts as the -p parameter when applying a patch. + +{ fetchurl, patchutils }: +{ stripLen ? 0, ... }@args: + +fetchurl ({ + postFetch = '' + tmpfile="$TMPDIR/${args.sha256}" + "${patchutils}/bin/lsdiff" "$out" \ + | sort -u | sed -e 's/[*?]/\\&/g' \ + | xargs -I{} \ + "${patchutils}/bin/filterdiff" \ + --include={} \ + --strip=${toString stripLen} \ + --clean "$out" > "$tmpfile" + mv "$tmpfile" "$out" + ''; +} // args) diff --git a/pkgs/development/libraries/haskell/HSH/default.nix b/pkgs/development/libraries/haskell/HSH/default.nix index 107e3df979b20..bcc2978121040 100644 --- a/pkgs/development/libraries/haskell/HSH/default.nix +++ b/pkgs/development/libraries/haskell/HSH/default.nix @@ -1,5 +1,5 @@ { cabal, filepath, hslogger, MissingH, mtl, regexBase, regexCompat -, regexPosix, fetchurl +, regexPosix, fetchpatch }: cabal.mkDerivation (self: { @@ -11,7 +11,7 @@ cabal.mkDerivation (self: { buildDepends = [ filepath hslogger MissingH mtl regexBase regexCompat regexPosix ]; - patches = [ (fetchurl { url = "https://github.com/jgoerzen/hsh/pull/10.patch"; sha256 = "0fw2ihl4hlncggwf3v4d7aydm3rzgzpcxplfbwq7janysix4q950"; }) ]; + patches = [ (fetchpatch { url = "https://github.com/jgoerzen/hsh/pull/10.patch"; sha256 = "0ddb3vf8ipf37zg4hkqh0frff1a7sv9ils3lw6qd3irpbwna1hdz"; }) ]; meta = { homepage = "http://software.complete.org/hsh"; description = "Library to mix shell scripting with Haskell programs"; diff --git a/pkgs/development/libraries/haskell/gitit/default.nix b/pkgs/development/libraries/haskell/gitit/default.nix index 69f611cfe74c2..6c30ca18b883b 100644 --- a/pkgs/development/libraries/haskell/gitit/default.nix +++ b/pkgs/development/libraries/haskell/gitit/default.nix @@ -2,7 +2,7 @@ , filepath, filestore, ghcPaths, happstackServer, highlightingKate , hslogger, HStringTemplate, HTTP, json, mtl, network, pandoc , pandocTypes, parsec, random, recaptcha, safe, SHA, syb, tagsoup -, text, time, url, utf8String, xhtml, xml, xssSanitize, zlib, fetchurl +, text, time, url, utf8String, xhtml, xml, xssSanitize, zlib, fetchpatch }: cabal.mkDerivation (self: { @@ -19,10 +19,11 @@ cabal.mkDerivation (self: { zlib ]; jailbreak = true; - patches = [ (fetchurl { url = "https://github.com/jgm/gitit/commit/48155008397bdaed4f97c5678d83c70d4bc3f0ff.patch"; - sha256 = "0xdg9frr8lany8ry6vj4vpskmhkpww8jswnb05pzl8a4xfqxh9gd"; - }) - ]; + patches = [ (fetchpatch { + url = "https://github.com/jgm/gitit/commit/48155008397bdaed4f97c5678d83c70d4bc3f0ff.patch"; + sha256 = "16n372wrikwb3g4pb3zljxnp19in0828wp40diqgkplhlnwww6nw"; + }) + ]; preConfigure = '' sed -i -e 's|network .*< 2.5|network|' gitit.cabal ''; diff --git a/pkgs/development/tools/haskell/BNFC/default.nix b/pkgs/development/tools/haskell/BNFC/default.nix index ebe8d2c3e24c7..f335aebc570be 100644 --- a/pkgs/development/tools/haskell/BNFC/default.nix +++ b/pkgs/development/tools/haskell/BNFC/default.nix @@ -1,4 +1,4 @@ -{ cabal, mtl, fetchurl, alex, happy }: +{ cabal, mtl, fetchpatch, alex, happy }: cabal.mkDerivation (self: { pname = "BNFC"; @@ -8,7 +8,7 @@ cabal.mkDerivation (self: { isExecutable = true; buildDepends = [ mtl ]; buildTools = [ alex happy ]; - patches = [ (fetchurl { url = "https://github.com/BNFC/bnfc/pull/3.patch"; sha256 = "103l04ylzswgxrmpv5zy6dd0jyr96z21mdkpgk1z4prvn8wjl624"; }) ]; + patches = [ (fetchpatch { url = "https://github.com/BNFC/bnfc/pull/3.patch"; sha256 = "1i87crwva5m3v095lv3zxs38pr6nmly58krlr6sxpwnakpr0pxsp"; }) ]; patchFlags = "-p2"; preConfigure = "runhaskell Setup.lhs clean"; meta = { diff --git a/pkgs/development/tools/parsing/alex/3.0.5.nix b/pkgs/development/tools/parsing/alex/3.0.5.nix index f85aa42d1653a..c4458f7b8297c 100644 --- a/pkgs/development/tools/parsing/alex/3.0.5.nix +++ b/pkgs/development/tools/parsing/alex/3.0.5.nix @@ -1,4 +1,4 @@ -{ cabal, fetchurl, perl, QuickCheck }: +{ cabal, fetchpatch, perl, QuickCheck }: cabal.mkDerivation (self: { pname = "alex"; @@ -8,7 +8,7 @@ cabal.mkDerivation (self: { isExecutable = true; buildDepends = [ QuickCheck ]; buildTools = [ perl ]; - patches = [ (fetchurl { url="https://github.com/simonmar/alex/pull/21.patch"; sha256="0apv3rk00gwkf5rqw3467bg6pnamr07zdksbp9khhzzi73k9aq4f"; }) ]; + patches = [ (fetchpatch { url="http://github.com/simonmar/alex/pull/21.patch"; sha256="050psfwmjlxhyxiy65jsn3v6b9rnfzy8x5q9mmhzwbirqwi0zkfm"; }) ]; meta = { homepage = "http://www.haskell.org/alex/"; description = "Alex is a tool for generating lexical analysers in Haskell"; diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix index 3f591cb7c0e3c..bb97eadef4628 100644 --- a/pkgs/servers/x11/xorg/overrides.nix +++ b/pkgs/servers/x11/xorg/overrides.nix @@ -178,9 +178,9 @@ in }; xf86videonv = attrs: attrs // { - patches = [( args.fetchurl { + patches = [( args.fetchpatch { url = http://cgit.freedesktop.org/xorg/driver/xf86-video-nv/patch/?id=fc78fe98222b0204b8a2872a529763d6fe5048da; - sha256 = "0ikbnz6048ygs1qahb6ylnxkyjhfjcqr2gm9bk95ca90v57j7i0f"; + sha256 = "0i2ddgqwj6cfnk8f4r73kkq3cna7hfnz7k3xj3ifx5v8mfiva6gw"; })]; }; diff --git a/pkgs/tools/text/patchutils/default.nix b/pkgs/tools/text/patchutils/default.nix index 50232c5a41d80..4df52eef669eb 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 0000000000000..e02693a5683d1 --- /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 +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 ++ * Copyright (C) 2001, 2002, 2003, 2004, 2008, 2009, 2011, 2013, 2014 Tim Waugh + * + * 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 + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 09c14b89a2a25..b3ee044e9b6bf 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -327,6 +327,8 @@ let fetchmtn = callPackage ../build-support/fetchmtn (config.fetchmtn or {}); + fetchpatch = callPackage ../build-support/fetchpatch { }; + fetchsvn = import ../build-support/fetchsvn { inherit stdenv subversion openssh; sshSupport = true; @@ -6778,7 +6780,7 @@ let xinetd = callPackage ../servers/xinetd { }; xorg = recurseIntoAttrs (import ../servers/x11/xorg/default.nix { - inherit fetchurl fetchgit stdenv pkgconfig intltool freetype fontconfig + inherit fetchurl fetchgit fetchpatch stdenv pkgconfig intltool freetype fontconfig libxslt expat libdrm libpng zlib perl mesa_drivers dbus libuuid openssl gperf m4 autoconf automake libtool xmlto asciidoc udev flex bison python mtdev pixman; -- cgit 1.4.1