gnu: Add pam-u2f.
[jackhill/guix/guix.git] / gnu / packages / patchutils.scm
CommitLineData
8a9d928f 1;;; GNU Guix --- Functional package management for GNU
68faa20e 2;;; Copyright © 2014, 2018 Eric Bavier <bavier@member.fsf.org>
9e286eb1 3;;; Copyright © 2015, 2018 Leo Famulari <leo@famulari.name>
730ad095 4;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
4764c6cc 5;;; Copyright © 2019 Christopher Baines <mail@cbaines.net>
8a9d928f
EB
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22(define-module (gnu packages patchutils)
be0be3de 23 #:use-module (guix utils)
8a9d928f
EB
24 #:use-module (guix packages)
25 #:use-module (guix licenses)
26 #:use-module (guix download)
3b6eddb2 27 #:use-module (guix git-download)
8a9d928f 28 #:use-module (guix build-system gnu)
3b6eddb2 29 #:use-module (guix build-system python)
8a9d928f
EB
30 #:use-module (gnu packages)
31 #:use-module (gnu packages ed)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages bash)
be0be3de 34 #:use-module (gnu packages check)
4764c6cc
CB
35 #:use-module (gnu packages databases)
36 #:use-module (gnu packages django)
8a9d928f
EB
37 #:use-module (gnu packages file)
38 #:use-module (gnu packages gawk)
24a80064 39 #:use-module (gnu packages gettext)
be0be3de
PN
40 #:use-module (gnu packages glib)
41 #:use-module (gnu packages gnome)
42 #:use-module (gnu packages gtk)
8a9d928f 43 #:use-module (gnu packages less)
9e286eb1
LF
44 #:use-module (gnu packages mail)
45 #:use-module (gnu packages ncurses)
285d8f0d 46 #:use-module (gnu packages perl)
3b6eddb2 47 #:use-module (gnu packages python)
44d10b1f 48 #:use-module (gnu packages python-xyz)
d7d1fc82 49 #:use-module (gnu packages version-control)
285d8f0d 50 #:use-module (gnu packages xml))
8a9d928f
EB
51
52(define-public patchutils
53 (package
54 (name "patchutils")
5f230fb2 55 (version "0.3.4")
8a9d928f
EB
56 (source
57 (origin
58 (method url-fetch)
59 (uri (string-append "http://cyberelk.net/tim/data/patchutils/stable/"
60 name "-" version ".tar.xz"))
61 (sha256
62 (base32
5f230fb2
EB
63 "0xp8mcfyi5nmb5a2zi5ibmyshxkb1zv1dgmnyn413m7ahgdx8mfg"))
64 (patches (search-patches "patchutils-test-perms.patch"))))
8a9d928f
EB
65 (build-system gnu-build-system)
66 (inputs `(("perl" ,perl)))
67 (arguments
68 '(#:parallel-tests? #f
dc1d3cde
KK
69 #:phases
70 (modify-phases %standard-phases
71 (add-before 'check 'patch-test-scripts
72 (lambda _
5f230fb2
EB
73 (substitute* (find-files "tests" "^run-test$")
74 (("/bin/echo") (which "echo")))
dc1d3cde
KK
75 #t))
76 (add-after 'install 'wrap-program
77 ;; Point installed scripts to the utilities they need.
78 (lambda* (#:key inputs outputs #:allow-other-keys)
79 (let* ((out (assoc-ref outputs "out"))
80 (diffutils (assoc-ref inputs "diffutils"))
81 (sed (assoc-ref inputs "sed"))
82 (gawk (assoc-ref inputs "gawk")))
83 (for-each
84 (lambda (prog)
85 (wrap-program (string-append out "/bin/" prog)
86 `("PATH" ":" prefix
87 ,(map (lambda (dir)
88 (string-append dir "/bin"))
89 (list diffutils sed gawk)))))
90 '("dehtmldiff" "editdiff" "espdiff")))
91 #t)))))
8a9d928f
EB
92 (home-page "http://cyberelk.net/tim/software/patchutils")
93 (synopsis "Collection of tools for manipulating patch files")
94 (description
95 "Patchutils is a collection of programs that can manipulate patch files
96in useful ways such as interpolating between two pre-patches, combining two
97incremental patches, fixing line numbers in hand-edited patches, and simply
98listing the files modified by a patch.")
99 (license gpl2+)))
100
101(define-public quilt
102 (package
103 (name "quilt")
eea75c43 104 (version "0.66")
8a9d928f
EB
105 (source
106 (origin
eea75c43
TGR
107 (method url-fetch)
108 (uri (string-append "mirror://savannah/quilt/"
109 "quilt-" version ".tar.gz"))
110 (sha256
111 (base32 "01vfvk4pqigahx82fhaaffg921ivd3k7rylz1yfvy4zbdyd32jri"))))
8a9d928f 112 (build-system gnu-build-system)
24a80064
EB
113 (native-inputs
114 `(("gettext" ,gnu-gettext)))
8a9d928f
EB
115 (inputs `(("perl" ,perl)
116 ("less" ,less)
0253ab39 117 ("file" ,file)
d7d1fc82
EB
118 ("ed" ,ed)
119 ("diffstat" ,diffstat)))
8a9d928f
EB
120 (arguments
121 '(#:parallel-tests? #f
dc1d3cde
KK
122 #:phases
123 (modify-phases %standard-phases
124 (add-before 'check 'patch-tests
125 (lambda _
126 (substitute*
127 '("test/run"
be0be3de 128 "test/edit.test")
dc1d3cde 129 (("/bin/sh") (which "sh")))
dc1d3cde
KK
130 #t))
131 (add-after 'install 'wrap-program
132 ;; quilt's configure checks for the absolute path to the utilities it
133 ;; needs, but uses only the name when invoking them, so we need to
134 ;; make sure the quilt script can find those utilities when run.
135 (lambda* (#:key inputs outputs #:allow-other-keys)
136 (let* ((out (assoc-ref outputs "out"))
137 (coreutils (assoc-ref inputs "coreutils"))
138 (diffutils (assoc-ref inputs "diffutils"))
139 (findutils (assoc-ref inputs "findutils"))
d7d1fc82 140 (diffstat (assoc-ref inputs "diffstat"))
dc1d3cde
KK
141 (less (assoc-ref inputs "less"))
142 (file (assoc-ref inputs "file"))
143 (ed (assoc-ref inputs "ed"))
144 (sed (assoc-ref inputs "sed"))
145 (bash (assoc-ref inputs "bash"))
146 (grep (assoc-ref inputs "grep")))
147 (wrap-program (string-append out "/bin/quilt")
148 `("PATH" ":" prefix
149 ,(map (lambda (dir)
150 (string-append dir "/bin"))
151 (list coreutils diffutils findutils
d7d1fc82
EB
152 less file ed sed bash grep
153 diffstat)))))
dc1d3cde 154 #t)))))
8a9d928f
EB
155 (home-page "https://savannah.nongnu.org/projects/quilt/")
156 (synopsis "Script for managing patches to software")
157 (description
158 "Quilt allows you to easily manage large numbers of patches by keeping
159track of the changes each patch makes. Patches can be applied, un-applied,
160refreshed, and more.")
161 (license gpl2)))
285d8f0d
162
163(define-public colordiff
164 (package
165 (name "colordiff")
58e3603e 166 (version "1.0.18")
285d8f0d 167 (source
8d479d27
LF
168 (origin
169 (method url-fetch)
58e3603e
TGR
170 (uri (list (string-append "https://www.colordiff.org/colordiff-"
171 version ".tar.gz")
172 (string-append "http://www.colordiff.org/archive/colordiff-"
8d479d27 173 version ".tar.gz")))
285d8f0d 174 (sha256
8d479d27 175 (base32
58e3603e 176 "1q6n60n4b9fnzccxyxv04mxjsql4ddq17vl2c74ijvjdhpcfrkr9"))))
285d8f0d
177 (build-system gnu-build-system)
178 (arguments
58e3603e 179 `(#:tests? #f ; no tests
285d8f0d
180 #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out"))
181 "INSTALL_DIR=/bin" "MAN_DIR=/share/man/man1")
182 #:phases
dc1d3cde 183 (modify-phases %standard-phases
58e3603e
TGR
184 (delete 'configure) ; no configure script
185 (delete 'build)))) ; nothing to build
285d8f0d
186 (inputs
187 `(("perl" ,perl)
188 ("xmlto" ,xmlto)))
8cccd09d 189 (home-page "https://www.colordiff.org")
285d8f0d
190 (synopsis "Display diff output with colors")
191 (description
192 "Colordiff is Perl script wrapper on top of diff command which provides
193'syntax highlighting' for various patch formats.")
194 (license gpl2+)))
3b6eddb2
LC
195
196(define-public patches
5ca54f41 197 (let ((commit "ef1b8a7d954b82ed4af3a08fd63d2085d19090ef"))
3b6eddb2
LC
198 (package
199 (name "patches")
5ca54f41
LC
200 (home-page "https://github.com/stefanha/patches")
201 (version (string-append "0.0-1." (string-take commit 7)))
3b6eddb2
LC
202 (source (origin
203 (method git-fetch)
204 (uri (git-reference
5ca54f41 205 (url home-page)
3b6eddb2
LC
206 (commit commit)))
207 (sha256
208 (base32
5ca54f41
LC
209 "11rdmhv0l1s8nqb20ywmw2zqizczch2p62qf9apyx5wqgxlnjshk"))
210 (file-name (string-append name "-"version "-checkout"))))
3b6eddb2
LC
211 (build-system python-build-system)
212 (inputs `(("python-notmuch" ,python2-notmuch)))
213 (arguments
214 `(#:tests? #f ;no "test" target
5ca54f41 215 #:python ,python-2)) ;not compatible with Python 3
3b6eddb2
LC
216 (synopsis "Patch tracking tool")
217 (description
36a4366d 218 "@code{Patches} is a patch-tracking tool initially written for the QEMU
3b6eddb2
LC
219project. It provides commands that build a database of patches from a mailing
220list, and commands that can search that database. It allows users to track
221the status of a patch, apply patches, and search for patches---all that from
222the command-line or from Emacs via its Notmuch integration.")
223 (license gpl2+))))
9e286eb1
LF
224
225(define-public vbindiff
226 (package
227 (name "vbindiff")
228 (version "3.0_beta5")
229 (source (origin
230 (method url-fetch)
231 (uri (string-append "https://www.cjmweb.net/vbindiff/vbindiff-"
232 version ".tar.gz"))
233 (sha256
234 (base32
235 "1f1kj4jki08bnrwpzi663mjfkrx4wnfpzdfwd2qgijlkx5ysjkgh"))))
236 (build-system gnu-build-system)
237 (inputs
238 `(("ncurses" ,ncurses)))
239 (home-page "https://www.cjmweb.net/vbindiff/")
240 (synopsis "Console-based tool for comparing binary data")
241 (description "Visual Binary Diff (@command{vbindiff}) displays files in
242hexadecimal and ASCII (or EBCDIC). It can also display two files at once, and
243highlight the differences between them. It works well with large files (up to 4
244GiB).")
245 (license gpl2+)))
be0be3de
PN
246
247(define-public meld
248 (package
249 (name "meld")
730ad095 250 (version "3.20.1")
be0be3de
PN
251 (source
252 (origin
253 (method url-fetch)
254 (uri (string-append "mirror://gnome/sources/meld/"
255 (version-major+minor version)
256 "/meld-" version ".tar.xz"))
257 (sha256
730ad095 258 (base32 "0jdj7kd6vj1mdc16gvrj1kar88b2j5875ajq18fx7cbc9ny46j55"))))
be0be3de
PN
259 (build-system python-build-system)
260 (native-inputs
261 `(("intltool" ,intltool)
262 ("xmllint" ,libxml2)
263 ("glib-compile-schemas" ,glib "bin")
264 ("python-pytest" ,python-pytest)))
265 (inputs
266 `(("python-cairo" ,python-pycairo)
267 ("python-gobject" ,python-pygobject)
b901a566 268 ("gtksourceview" ,gtksourceview-3)))
be0be3de
PN
269 (propagated-inputs
270 `(("dconf" ,dconf)))
271 (arguments
272 `(#:phases
273 (modify-phases %standard-phases
274 ;; This setup.py script does not support one of the Python build
275 ;; system's default flags, "--single-version-externally-managed".
276 (replace 'install
277 (lambda* (#:key outputs #:allow-other-keys)
278 (invoke "python" "setup.py"
279 ;; This setup.py runs gtk-update-icon-cache which we don't want.
280 "--no-update-icon-cache"
281 ;; "--no-compile-schemas"
282 "install"
283 (string-append "--prefix=" (assoc-ref outputs "out"))
284 "--root=/")))
285 ;; The tests need to be run after installation.
286 (delete 'check)
287 (add-after 'install 'check
288 (lambda* (#:key inputs outputs #:allow-other-keys)
289 ;; Tests look for installed package
290 (add-installed-pythonpath inputs outputs)
291 ;; The tests fail when HOME=/homeless-shelter.
292 (setenv "HOME" "/tmp")
293 (invoke "py.test" "-v" "-k"
294 ;; TODO: Those tests fail, why?
b901a566
LP
295 "not test_classify_change_actions")))
296 (add-after 'wrap 'wrap-typelib
297 (lambda* (#:key inputs outputs #:allow-other-keys)
298 (let ((out (assoc-ref outputs "out")))
299 (wrap-program (string-append out "/bin/meld")
300 `("GI_TYPELIB_PATH" prefix
301 ,(search-path-as-string->list (getenv "GI_TYPELIB_PATH"))))
302 #t))))))
be0be3de
PN
303 (home-page "https://meldmerge.org/")
304 (synopsis "Compare files, directories and working copies")
305 (description "Meld is a visual diff and merge tool targeted at
306developers. Meld helps you compare files, directories, and version controlled
307projects. It provides two- and three-way comparison of both files and
308directories, and has support for many popular version control systems.
309
310Meld helps you review code changes and understand patches. It might even help
311you to figure out what is going on in that merge you keep avoiding.")
312 (license gpl2)))
4764c6cc
CB
313
314(define-public patchwork
315 (package
316 (name "patchwork")
4add773e 317 (version "2.1.4")
4764c6cc
CB
318 (source (origin
319 (method git-fetch)
320 (uri (git-reference
321 (url "https://github.com/getpatchwork/patchwork.git")
322 (commit (string-append "v" version))))
323 (file-name (git-file-name name version))
324 (sha256
325 (base32
4add773e 326 "0zi1hcqb0pi2diyznbv0c1631qk4rx02zl8ghyrr59g3ljlyr18y"))))
4764c6cc
CB
327 (build-system python-build-system)
328 (arguments
329 `(;; TODO: Tests require a running database
330 #:tests? #f
331 #:phases
332 (modify-phases %standard-phases
333 (delete 'configure)
334 (delete 'build)
335 (add-after 'unpack 'replace-wsgi.py
336 (lambda* (#:key inputs outputs #:allow-other-keys)
337 (delete-file "patchwork/wsgi.py")
338 (call-with-output-file "patchwork/wsgi.py"
339 (lambda (port)
340 ;; Embed the PYTHONPATH containing the dependencies, as well
341 ;; as the python modules in this package in the wsgi.py file,
342 ;; as this will ensure they are available at runtime.
343 (define pythonpath
344 (string-append (getenv "PYTHONPATH")
345 ":"
346 (site-packages inputs outputs)))
347 (display
348 (string-append "
349import os, sys
350
351sys.path.extend('" pythonpath "'.split(':'))
352
353from django.core.wsgi import get_wsgi_application
354
355# By default, assume that patchwork is running as a Guix service, which
356# provides the settings as the 'guix.patchwork.settings' Python module.
357#
358# When using httpd, it's hard to set environment variables, so rely on the
359# default set here.
360os.environ['DJANGO_SETTINGS_MODULE'] = os.getenv(
361 'DJANGO_SETTINGS_MODULE',
362 'guix.patchwork.settings' # default
363)
364
365application = get_wsgi_application()\n") port)))))
366 (replace 'check
367 (lambda* (#:key tests? #:allow-other-keys)
368 (when tests?
369 (setenv "DJANGO_SETTINGS_MODULE" "patchwork.settings.dev")
370 (invoke "python" "-Wonce" "./manage.py" "test" "--noinput"))
371 #t))
372 (replace 'install
373 (lambda* (#:key inputs outputs #:allow-other-keys)
374 (let ((out (assoc-ref outputs "out"))
375 (out-site-packages (site-packages inputs outputs)))
376 (for-each (lambda (directory)
377 (copy-recursively
378 directory
379 (string-append out-site-packages directory)))
380 '(;; Contains the python code
381 "patchwork"
382 ;; Contains the templates for the generated HTML
383 "templates"))
384 (delete-file-recursively
385 (string-append out-site-packages "patchwork/tests"))
386
387 ;; Install patchwork related tools
388 (for-each (lambda (file)
389 (install-file file (string-append out "/bin")))
390 (list
391 (string-append out-site-packages
392 "patchwork/bin/pwclient")
393 (string-append out-site-packages
394 "patchwork/bin/parsemail.sh")
395 (string-append out-site-packages
396 "patchwork/bin/parsemail-batch.sh")))
397
398 ;; Delete the symlink to pwclient, and replace it with the
399 ;; actual file, as this can cause issues when serving the file
400 ;; from a webserver.
401 (let ((template-pwclient (string-append
402 out-site-packages
403 "patchwork/templates/patchwork/pwclient")))
404 (delete-file template-pwclient)
405 (copy-file (string-append out-site-packages
406 "patchwork/bin/pwclient")
407 template-pwclient))
408
409 ;; Collect the static assets, this includes JavaScript, CSS and
410 ;; fonts. This is a standard Django process when running a
411 ;; Django application for regular use, and includes assets for
412 ;; dependencies like the admin site from Django.
413 ;;
414 ;; The intent here is that you can serve files from this
415 ;; directory through a webserver, which is recommended when
416 ;; running Django applications.
417 (let ((static-root
418 (string-append out "/share/patchwork/htdocs")))
419 (mkdir-p static-root)
420 (copy-file "patchwork/settings/production.example.py"
421 "patchwork/settings/assets.py")
422 (setenv "DJANGO_SECRET_KEY" "dummyvalue")
423 (setenv "DJANGO_SETTINGS_MODULE" "patchwork.settings.assets")
424 (setenv "STATIC_ROOT" static-root)
425 (invoke "./manage.py" "collectstatic" "--no-input"))
426
427 ;; The lib directory includes example configuration files that
428 ;; may be useful when deploying patchwork.
429 (copy-recursively "lib"
430 (string-append
431 out "/share/doc/" ,name "-" ,version)))
432 #t))
433 ;; The hasher script is used from the post-receive.hook
434 (add-after 'install 'install-hasher
435 (lambda* (#:key inputs outputs #:allow-other-keys)
436 (let* ((out (assoc-ref outputs "out"))
437 (out-site-packages (site-packages inputs outputs))
438 (out-hasher.py (string-append out-site-packages
439 "/patchwork/hasher.py")))
440 (chmod out-hasher.py #o555)
441 (symlink out-hasher.py (string-append out "/bin/hasher")))
442 #t))
443 ;; Create a patchwork specific version of Django's command line admin
444 ;; utility.
445 (add-after 'install 'install-patchwork-admin
446 (lambda* (#:key inputs outputs #:allow-other-keys)
447 (let* ((out (assoc-ref outputs "out")))
448 (mkdir-p (string-append out "/bin"))
449 (call-with-output-file (string-append out "/bin/patchwork-admin")
450 (lambda (port)
451 (simple-format port "#!~A
452import os, sys
453
454if __name__ == \"__main__\":
455 from django.core.management import execute_from_command_line
456
457 execute_from_command_line(sys.argv)" (which "python"))))
458 (chmod (string-append out "/bin/patchwork-admin") #o555))
459 #t)))))
460 (inputs
461 `(("python-wrapper" ,python-wrapper)))
462 (propagated-inputs
463 `(("python-django" ,python-django)
464 ;; TODO: Make this configurable
465 ("python-psycopg2" ,python-psycopg2)
466 ("python-mysqlclient" ,python-mysqlclient)
467 ("python-django-filter" ,python-django-filter)
468 ("python-djangorestframework" ,python-djangorestframework)
469 ("python-django-debug-toolbar" ,python-django-debug-toolbar)))
470 (synopsis "Web based patch tracking system")
471 (description
472 "Patchwork is a patch tracking system. It takes in emails containing
473patches, and displays the patches along with comments and state information.
474Users can login allowing them to change the state of patches.")
475 (home-page "http://jk.ozlabs.org/projects/patchwork/")
476 (license gpl2+)))