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