gnu: Add AVR-Libc.
[jackhill/guix/guix.git] / gnu / packages / patchutils.scm
CommitLineData
8a9d928f
EB
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (gnu packages patchutils)
20 #:use-module (guix packages)
21 #:use-module (guix licenses)
22 #:use-module (guix download)
23 #:use-module (guix build-system gnu)
24 #:use-module (gnu packages)
25 #:use-module (gnu packages ed)
26 #:use-module (gnu packages base)
27 #:use-module (gnu packages bash)
28 #:use-module (gnu packages file)
29 #:use-module (gnu packages gawk)
30 #:use-module (gnu packages less)
31 #:use-module (gnu packages perl))
32
33(define-public patchutils
34 (package
35 (name "patchutils")
36 (version "0.3.3")
37 (source
38 (origin
39 (method url-fetch)
40 (uri (string-append "http://cyberelk.net/tim/data/patchutils/stable/"
41 name "-" version ".tar.xz"))
42 (sha256
43 (base32
44 "0g5df00cj4nczrmr4k791l7la0sq2wnf8rn981fsrz1f3d2yix4i"))
45 (patches
46 (list (search-patch "patchutils-xfail-gendiff-tests.patch")))))
47 (build-system gnu-build-system)
48 (inputs `(("perl" ,perl)))
49 (arguments
50 '(#:parallel-tests? #f
51 #:phases (alist-cons-before
52 'check 'patch-test-scripts
53 (lambda _
54 (let ((echo (which "echo")))
55 (substitute*
56 (find-files "tests" "^run-test$")
57 (("/bin/echo") echo))))
58 (alist-cons-after
59 'install 'wrap-program
60 ;; Point installed scripts to the utilities they need.
61 (lambda* (#:key inputs outputs #:allow-other-keys)
62 (let* ((out (assoc-ref outputs "out"))
63 (diffutils (assoc-ref inputs "diffutils"))
64 (sed (assoc-ref inputs "sed"))
65 (gawk (assoc-ref inputs "gawk")))
66 (for-each
67 (lambda (prog)
68 (wrap-program (string-append out "/bin/" prog)
69 `("PATH" ":" prefix
70 ,(map (lambda (dir)
71 (string-append dir "/bin"))
72 (list diffutils sed gawk)))))
73 '("dehtmldiff" "editdiff" "espdiff"))))
74 %standard-phases))))
75 (home-page "http://cyberelk.net/tim/software/patchutils")
76 (synopsis "Collection of tools for manipulating patch files")
77 (description
78 "Patchutils is a collection of programs that can manipulate patch files
79in useful ways such as interpolating between two pre-patches, combining two
80incremental patches, fixing line numbers in hand-edited patches, and simply
81listing the files modified by a patch.")
82 (license gpl2+)))
83
84(define-public quilt
85 (package
86 (name "quilt")
87 (version "0.61")
88 (source
89 (origin
90 (method url-fetch)
91 (uri (string-append "mirror://savannah/quilt/"
92 name "-" version ".tar.gz"))
93 (sha256
94 (base32
95 "1hwz58djkq9cv46sjwxbp2v5m8yjr41kd0nm1zm1xm6418khmv0y"))))
96 (build-system gnu-build-system)
97 (inputs `(("perl" ,perl)
98 ("less" ,less)
351d690f 99 ("file" ,file-5.20) ;work around CVE-2014-3710
8a9d928f
EB
100 ("ed" ,ed)))
101 (arguments
102 '(#:parallel-tests? #f
103 #:phases
104 (alist-cons-before
105 'check 'patch-tests
106 (lambda _
107 (substitute*
108 '("test/run"
109 "test/edit.test")
110 (("/bin/sh") (which "sh")))
111 ;; TODO: Run the mail tests once the mail feature can be supported.
112 (delete-file "test/mail.test"))
113 (alist-cons-after
114 'install 'wrap-program
115 ;; quilt's configure checks for the absolute path to the utilities it
116 ;; needs, but uses only the name when invoking them, so we need to
117 ;; make sure the quilt script can find those utilities when run.
118 (lambda* (#:key inputs outputs #:allow-other-keys)
119 (let* ((out (assoc-ref outputs "out"))
120 (coreutils (assoc-ref inputs "coreutils"))
121 (diffutils (assoc-ref inputs "diffutils"))
122 (findutils (assoc-ref inputs "findutils"))
123 (less (assoc-ref inputs "less"))
124 (file (assoc-ref inputs "file"))
125 (ed (assoc-ref inputs "ed"))
126 (sed (assoc-ref inputs "sed"))
127 (bash (assoc-ref inputs "bash"))
128 (grep (assoc-ref inputs "grep")))
129 (wrap-program (string-append out "/bin/quilt")
130 `("PATH" ":" prefix
131 ,(map (lambda (dir)
132 (string-append dir "/bin"))
133 (list coreutils diffutils findutils
134 less file ed sed bash grep))))))
135 %standard-phases))))
136 (home-page "https://savannah.nongnu.org/projects/quilt/")
137 (synopsis "Script for managing patches to software")
138 (description
139 "Quilt allows you to easily manage large numbers of patches by keeping
140track of the changes each patch makes. Patches can be applied, un-applied,
141refreshed, and more.")
142 (license gpl2)))