Merge branch 'master' into staging
[jackhill/guix/guix.git] / gnu / packages / patchutils.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
3 ;;; Copyright © 2015 Leo Famulari <leo@famulari.name>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages patchutils)
21 #:use-module (guix packages)
22 #:use-module (guix licenses)
23 #:use-module (guix download)
24 #:use-module (guix git-download)
25 #:use-module (guix build-system gnu)
26 #:use-module (guix build-system python)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages ed)
29 #:use-module (gnu packages base)
30 #:use-module (gnu packages bash)
31 #:use-module (gnu packages file)
32 #:use-module (gnu packages gawk)
33 #:use-module (gnu packages less)
34 #:use-module (gnu packages perl)
35 #:use-module (gnu packages python)
36 #:use-module (gnu packages mail)
37 #:use-module (gnu packages xml))
38
39 (define-public patchutils
40 (package
41 (name "patchutils")
42 (version "0.3.3")
43 (source
44 (origin
45 (method url-fetch)
46 (uri (string-append "http://cyberelk.net/tim/data/patchutils/stable/"
47 name "-" version ".tar.xz"))
48 (sha256
49 (base32
50 "0g5df00cj4nczrmr4k791l7la0sq2wnf8rn981fsrz1f3d2yix4i"))
51 (patches (search-patches "patchutils-xfail-gendiff-tests.patch"))))
52 (build-system gnu-build-system)
53 (inputs `(("perl" ,perl)))
54 (arguments
55 '(#:parallel-tests? #f
56 #:phases
57 (modify-phases %standard-phases
58 (add-before 'check 'patch-test-scripts
59 (lambda _
60 (let ((echo (which "echo")))
61 (substitute*
62 (find-files "tests" "^run-test$")
63 (("/bin/echo") echo)))
64 #t))
65 (add-after 'install 'wrap-program
66 ;; Point installed scripts to the utilities they need.
67 (lambda* (#:key inputs outputs #:allow-other-keys)
68 (let* ((out (assoc-ref outputs "out"))
69 (diffutils (assoc-ref inputs "diffutils"))
70 (sed (assoc-ref inputs "sed"))
71 (gawk (assoc-ref inputs "gawk")))
72 (for-each
73 (lambda (prog)
74 (wrap-program (string-append out "/bin/" prog)
75 `("PATH" ":" prefix
76 ,(map (lambda (dir)
77 (string-append dir "/bin"))
78 (list diffutils sed gawk)))))
79 '("dehtmldiff" "editdiff" "espdiff")))
80 #t)))))
81 (home-page "http://cyberelk.net/tim/software/patchutils")
82 (synopsis "Collection of tools for manipulating patch files")
83 (description
84 "Patchutils is a collection of programs that can manipulate patch files
85 in useful ways such as interpolating between two pre-patches, combining two
86 incremental patches, fixing line numbers in hand-edited patches, and simply
87 listing the files modified by a patch.")
88 (license gpl2+)))
89
90 (define-public quilt
91 (package
92 (name "quilt")
93 (version "0.61")
94 (source
95 (origin
96 (method url-fetch)
97 (uri (string-append "mirror://savannah/quilt/"
98 name "-" version ".tar.gz"))
99 (sha256
100 (base32
101 "1hwz58djkq9cv46sjwxbp2v5m8yjr41kd0nm1zm1xm6418khmv0y"))))
102 (build-system gnu-build-system)
103 (inputs `(("perl" ,perl)
104 ("less" ,less)
105 ("file" ,file)
106 ("ed" ,ed)))
107 (arguments
108 '(#:parallel-tests? #f
109 #:phases
110 (modify-phases %standard-phases
111 (add-before 'check 'patch-tests
112 (lambda _
113 (substitute*
114 '("test/run"
115 "test/edit.test")
116 (("/bin/sh") (which "sh")))
117 ;; TODO: Run the mail tests once the mail feature can be supported.
118 (delete-file "test/mail.test")
119 #t))
120 (add-after 'install 'wrap-program
121 ;; quilt's configure checks for the absolute path to the utilities it
122 ;; needs, but uses only the name when invoking them, so we need to
123 ;; make sure the quilt script can find those utilities when run.
124 (lambda* (#:key inputs outputs #:allow-other-keys)
125 (let* ((out (assoc-ref outputs "out"))
126 (coreutils (assoc-ref inputs "coreutils"))
127 (diffutils (assoc-ref inputs "diffutils"))
128 (findutils (assoc-ref inputs "findutils"))
129 (less (assoc-ref inputs "less"))
130 (file (assoc-ref inputs "file"))
131 (ed (assoc-ref inputs "ed"))
132 (sed (assoc-ref inputs "sed"))
133 (bash (assoc-ref inputs "bash"))
134 (grep (assoc-ref inputs "grep")))
135 (wrap-program (string-append out "/bin/quilt")
136 `("PATH" ":" prefix
137 ,(map (lambda (dir)
138 (string-append dir "/bin"))
139 (list coreutils diffutils findutils
140 less file ed sed bash grep)))))
141 #t)))))
142 (home-page "https://savannah.nongnu.org/projects/quilt/")
143 (synopsis "Script for managing patches to software")
144 (description
145 "Quilt allows you to easily manage large numbers of patches by keeping
146 track of the changes each patch makes. Patches can be applied, un-applied,
147 refreshed, and more.")
148 (license gpl2)))
149
150 (define-public colordiff
151 (package
152 (name "colordiff")
153 (version "1.0.16")
154 (source
155 (origin
156 (method url-fetch)
157 (uri (list (string-append "http://www.colordiff.org/archive/colordiff-"
158 version ".tar.gz")))
159 (sha256
160 (base32
161 "12qkkw13261dra8pg7mzx4r8p9pb0ajb090bib9j1s6hgphwzwga"))))
162 (build-system gnu-build-system)
163 (arguments
164 `(#:tests? #f
165 #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out"))
166 "INSTALL_DIR=/bin" "MAN_DIR=/share/man/man1")
167 #:phases
168 (modify-phases %standard-phases
169 (delete 'configure)
170 (delete 'build))))
171 (inputs
172 `(("perl" ,perl)
173 ("xmlto" ,xmlto)))
174 (home-page "http://www.colordiff.org")
175 (synopsis "Display diff output with colors")
176 (description
177 "Colordiff is Perl script wrapper on top of diff command which provides
178 'syntax highlighting' for various patch formats.")
179 (license gpl2+)))
180
181 (define-public patches
182 (let ((commit "ef1b8a7d954b82ed4af3a08fd63d2085d19090ef"))
183 (package
184 (name "patches")
185 (home-page "https://github.com/stefanha/patches")
186 (version (string-append "0.0-1." (string-take commit 7)))
187 (source (origin
188 (method git-fetch)
189 (uri (git-reference
190 (url home-page)
191 (commit commit)))
192 (sha256
193 (base32
194 "11rdmhv0l1s8nqb20ywmw2zqizczch2p62qf9apyx5wqgxlnjshk"))
195 (file-name (string-append name "-"version "-checkout"))))
196 (build-system python-build-system)
197 (inputs `(("python-notmuch" ,python2-notmuch)))
198 (arguments
199 `(#:tests? #f ;no "test" target
200 #:python ,python-2)) ;not compatible with Python 3
201 (synopsis "Patch tracking tool")
202 (description
203 "'Patches' is a patch-tracking tool initially written for the QEMU
204 project. It provides commands that build a database of patches from a mailing
205 list, and commands that can search that database. It allows users to track
206 the status of a patch, apply patches, and search for patches---all that from
207 the command-line or from Emacs via its Notmuch integration.")
208 (license gpl2+))))