mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-24 20:02:58 +03:00
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
This commit is contained in:
parent
4ac818601e
commit
137eae0b55
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, fetchurl
|
{ stdenv, fetchurl, fetchpatch
|
||||||
, SDL, SDL_mixer, gstreamer, gst_plugins_base, gst_plugins_good
|
, SDL, SDL_mixer, gstreamer, gst_plugins_base, gst_plugins_good
|
||||||
, gst_ffmpeg, speex
|
, gst_ffmpeg, speex
|
||||||
, libogg, libxml2, libjpeg, mesa, libpng, libungif, libtool
|
, libogg, libxml2, libjpeg, mesa, libpng, libungif, libtool
|
||||||
@ -11,9 +11,9 @@
|
|||||||
assert stdenv ? glibc;
|
assert stdenv ? glibc;
|
||||||
|
|
||||||
let version = "0.8.10";
|
let version = "0.8.10";
|
||||||
patch_CVE = fetchurl {
|
patch_CVE = fetchpatch {
|
||||||
url = "http://git.savannah.gnu.org/cgit/gnash.git/patch/?id=bb4dc77eecb6ed1b967e3ecbce3dac6c5e6f1527";
|
url = "http://git.savannah.gnu.org/cgit/gnash.git/patch/?id=bb4dc77eecb6ed1b967e3ecbce3dac6c5e6f1527";
|
||||||
sha256 = "1g7ymbq9vxi0mwcgs2dpyd2sf30gaam7blza0ywiwj32f5wk62v1";
|
sha256 = "0ghnki5w7xf3qwfl1x6vhijpd6q608niyxrvh0g8dw5xavkvallk";
|
||||||
name = "CVE-2012-1175.patch";
|
name = "CVE-2012-1175.patch";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
22
pkgs/build-support/fetchpatch/default.nix
Normal file
22
pkgs/build-support/fetchpatch/default.nix
Normal file
@ -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)
|
@ -1,5 +1,5 @@
|
|||||||
{ cabal, filepath, hslogger, MissingH, mtl, regexBase, regexCompat
|
{ cabal, filepath, hslogger, MissingH, mtl, regexBase, regexCompat
|
||||||
, regexPosix, fetchurl
|
, regexPosix, fetchpatch
|
||||||
}:
|
}:
|
||||||
|
|
||||||
cabal.mkDerivation (self: {
|
cabal.mkDerivation (self: {
|
||||||
@ -11,7 +11,7 @@ cabal.mkDerivation (self: {
|
|||||||
buildDepends = [
|
buildDepends = [
|
||||||
filepath hslogger MissingH mtl regexBase regexCompat regexPosix
|
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 = {
|
meta = {
|
||||||
homepage = "http://software.complete.org/hsh";
|
homepage = "http://software.complete.org/hsh";
|
||||||
description = "Library to mix shell scripting with Haskell programs";
|
description = "Library to mix shell scripting with Haskell programs";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
, filepath, filestore, ghcPaths, happstackServer, highlightingKate
|
, filepath, filestore, ghcPaths, happstackServer, highlightingKate
|
||||||
, hslogger, HStringTemplate, HTTP, json, mtl, network, pandoc
|
, hslogger, HStringTemplate, HTTP, json, mtl, network, pandoc
|
||||||
, pandocTypes, parsec, random, recaptcha, safe, SHA, syb, tagsoup
|
, 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: {
|
cabal.mkDerivation (self: {
|
||||||
@ -19,10 +19,11 @@ cabal.mkDerivation (self: {
|
|||||||
zlib
|
zlib
|
||||||
];
|
];
|
||||||
jailbreak = true;
|
jailbreak = true;
|
||||||
patches = [ (fetchurl { url = "https://github.com/jgm/gitit/commit/48155008397bdaed4f97c5678d83c70d4bc3f0ff.patch";
|
patches = [ (fetchpatch {
|
||||||
sha256 = "0xdg9frr8lany8ry6vj4vpskmhkpww8jswnb05pzl8a4xfqxh9gd";
|
url = "https://github.com/jgm/gitit/commit/48155008397bdaed4f97c5678d83c70d4bc3f0ff.patch";
|
||||||
})
|
sha256 = "16n372wrikwb3g4pb3zljxnp19in0828wp40diqgkplhlnwww6nw";
|
||||||
];
|
})
|
||||||
|
];
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
sed -i -e 's|network .*< 2.5|network|' gitit.cabal
|
sed -i -e 's|network .*< 2.5|network|' gitit.cabal
|
||||||
'';
|
'';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ cabal, mtl, fetchurl, alex, happy }:
|
{ cabal, mtl, fetchpatch, alex, happy }:
|
||||||
|
|
||||||
cabal.mkDerivation (self: {
|
cabal.mkDerivation (self: {
|
||||||
pname = "BNFC";
|
pname = "BNFC";
|
||||||
@ -8,7 +8,7 @@ cabal.mkDerivation (self: {
|
|||||||
isExecutable = true;
|
isExecutable = true;
|
||||||
buildDepends = [ mtl ];
|
buildDepends = [ mtl ];
|
||||||
buildTools = [ alex happy ];
|
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";
|
patchFlags = "-p2";
|
||||||
preConfigure = "runhaskell Setup.lhs clean";
|
preConfigure = "runhaskell Setup.lhs clean";
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ cabal, fetchurl, perl, QuickCheck }:
|
{ cabal, fetchpatch, perl, QuickCheck }:
|
||||||
|
|
||||||
cabal.mkDerivation (self: {
|
cabal.mkDerivation (self: {
|
||||||
pname = "alex";
|
pname = "alex";
|
||||||
@ -8,7 +8,7 @@ cabal.mkDerivation (self: {
|
|||||||
isExecutable = true;
|
isExecutable = true;
|
||||||
buildDepends = [ QuickCheck ];
|
buildDepends = [ QuickCheck ];
|
||||||
buildTools = [ perl ];
|
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 = {
|
meta = {
|
||||||
homepage = "http://www.haskell.org/alex/";
|
homepage = "http://www.haskell.org/alex/";
|
||||||
description = "Alex is a tool for generating lexical analysers in Haskell";
|
description = "Alex is a tool for generating lexical analysers in Haskell";
|
||||||
|
@ -178,9 +178,9 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
xf86videonv = attrs: attrs // {
|
xf86videonv = attrs: attrs // {
|
||||||
patches = [( args.fetchurl {
|
patches = [( args.fetchpatch {
|
||||||
url = http://cgit.freedesktop.org/xorg/driver/xf86-video-nv/patch/?id=fc78fe98222b0204b8a2872a529763d6fe5048da;
|
url = http://cgit.freedesktop.org/xorg/driver/xf86-video-nv/patch/?id=fc78fe98222b0204b8a2872a529763d6fe5048da;
|
||||||
sha256 = "0ikbnz6048ygs1qahb6ylnxkyjhfjcqr2gm9bk95ca90v57j7i0f";
|
sha256 = "0i2ddgqwj6cfnk8f4r73kkq3cna7hfnz7k3xj3ifx5v8mfiva6gw";
|
||||||
})];
|
})];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,10 +8,13 @@ stdenv.mkDerivation rec {
|
|||||||
sha256 = "0g5df00cj4nczrmr4k791l7la0sq2wnf8rn981fsrz1f3d2yix4i";
|
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";
|
description = "Tools to manipulate patch files";
|
||||||
homepage = http://cyberelk.net/tim/software/patchutils;
|
homepage = http://cyberelk.net/tim/software/patchutils;
|
||||||
license = "GPLv2";
|
license = licenses.gpl2Plus;
|
||||||
|
platforms = platforms.all;
|
||||||
executables = [ "combinediff" "dehtmldiff" "editdiff" "espdiff"
|
executables = [ "combinediff" "dehtmldiff" "editdiff" "espdiff"
|
||||||
"filterdiff" "fixcvsdiff" "flipdiff" "grepdiff" "interdiff" "lsdiff"
|
"filterdiff" "fixcvsdiff" "flipdiff" "grepdiff" "interdiff" "lsdiff"
|
||||||
"recountdiff" "rediff" "splitdiff" "unwrapdiff" ];
|
"recountdiff" "rediff" "splitdiff" "unwrapdiff" ];
|
||||||
|
84
pkgs/tools/text/patchutils/drop-comments.patch
Normal file
84
pkgs/tools/text/patchutils/drop-comments.patch
Normal file
@ -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
|
||||||
|
|
@ -327,6 +327,8 @@ let
|
|||||||
|
|
||||||
fetchmtn = callPackage ../build-support/fetchmtn (config.fetchmtn or {});
|
fetchmtn = callPackage ../build-support/fetchmtn (config.fetchmtn or {});
|
||||||
|
|
||||||
|
fetchpatch = callPackage ../build-support/fetchpatch { };
|
||||||
|
|
||||||
fetchsvn = import ../build-support/fetchsvn {
|
fetchsvn = import ../build-support/fetchsvn {
|
||||||
inherit stdenv subversion openssh;
|
inherit stdenv subversion openssh;
|
||||||
sshSupport = true;
|
sshSupport = true;
|
||||||
@ -6778,7 +6780,7 @@ let
|
|||||||
xinetd = callPackage ../servers/xinetd { };
|
xinetd = callPackage ../servers/xinetd { };
|
||||||
|
|
||||||
xorg = recurseIntoAttrs (import ../servers/x11/xorg/default.nix {
|
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
|
libxslt expat libdrm libpng zlib perl mesa_drivers
|
||||||
dbus libuuid openssl gperf m4
|
dbus libuuid openssl gperf m4
|
||||||
autoconf automake libtool xmlto asciidoc udev flex bison python mtdev pixman;
|
autoconf automake libtool xmlto asciidoc udev flex bison python mtdev pixman;
|
||||||
|
Loading…
Reference in New Issue
Block a user