1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014, 2018 Eric Bavier <bavier@member.fsf.org>
3 ;;; Copyright © 2015, 2018 Leo Famulari <leo@famulari.name>
4 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; Copyright © 2019 Christopher Baines <mail@cbaines.net>
7 ;;; This file is part of GNU Guix.
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.
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.
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/>.
22 (define-module (gnu packages patchutils)
23 #:use-module (guix utils)
24 #:use-module (guix packages)
25 #:use-module (guix licenses)
26 #:use-module (guix download)
27 #:use-module (guix git-download)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system python)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages ed)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages bash)
34 #:use-module (gnu packages check)
35 #:use-module (gnu packages databases)
36 #:use-module (gnu packages django)
37 #:use-module (gnu packages file)
38 #:use-module (gnu packages gawk)
39 #:use-module (gnu packages gettext)
40 #:use-module (gnu packages glib)
41 #:use-module (gnu packages gnome)
42 #:use-module (gnu packages gtk)
43 #:use-module (gnu packages less)
44 #:use-module (gnu packages mail)
45 #:use-module (gnu packages ncurses)
46 #:use-module (gnu packages perl)
47 #:use-module (gnu packages python)
48 #:use-module (gnu packages python-xyz)
49 #:use-module (gnu packages version-control)
50 #:use-module (gnu packages xml))
52 (define-public patchutils
59 (uri (string-append "http://cyberelk.net/tim/data/patchutils/stable/"
60 name "-" version ".tar.xz"))
63 "0xp8mcfyi5nmb5a2zi5ibmyshxkb1zv1dgmnyn413m7ahgdx8mfg"))
64 (patches (search-patches "patchutils-test-perms.patch"))))
65 (build-system gnu-build-system)
66 (inputs `(("perl" ,perl)))
68 '(#:parallel-tests? #f
70 (modify-phases %standard-phases
71 (add-before 'check 'patch-test-scripts
73 (substitute* (find-files "tests" "^run-test$")
74 (("/bin/echo") (which "echo")))
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")))
85 (wrap-program (string-append out "/bin/" prog)
88 (string-append dir "/bin"))
89 (list diffutils sed gawk)))))
90 '("dehtmldiff" "editdiff" "espdiff")))
92 (home-page "http://cyberelk.net/tim/software/patchutils")
93 (synopsis "Collection of tools for manipulating patch files")
95 "Patchutils is a collection of programs that can manipulate patch files
96 in useful ways such as interpolating between two pre-patches, combining two
97 incremental patches, fixing line numbers in hand-edited patches, and simply
98 listing the files modified by a patch.")
108 (uri (string-append "mirror://savannah/quilt/"
109 "quilt-" version ".tar.gz"))
111 (base32 "01vfvk4pqigahx82fhaaffg921ivd3k7rylz1yfvy4zbdyd32jri"))))
112 (build-system gnu-build-system)
114 `(("gettext" ,gnu-gettext)))
115 (inputs `(("perl" ,perl)
119 ("diffstat" ,diffstat)))
121 '(#:parallel-tests? #f
123 (modify-phases %standard-phases
124 (add-before 'check 'patch-tests
129 (("/bin/sh") (which "sh")))
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"))
140 (diffstat (assoc-ref inputs "diffstat"))
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")
150 (string-append dir "/bin"))
151 (list coreutils diffutils findutils
152 less file ed sed bash grep
155 (home-page "https://savannah.nongnu.org/projects/quilt/")
156 (synopsis "Script for managing patches to software")
158 "Quilt allows you to easily manage large numbers of patches by keeping
159 track of the changes each patch makes. Patches can be applied, un-applied,
160 refreshed, and more.")
163 (define-public colordiff
170 (uri (list (string-append "https://www.colordiff.org/colordiff-"
172 (string-append "http://www.colordiff.org/archive/colordiff-"
176 "1q6n60n4b9fnzccxyxv04mxjsql4ddq17vl2c74ijvjdhpcfrkr9"))))
177 (build-system gnu-build-system)
179 `(#:tests? #f ; no tests
180 #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out"))
181 "INSTALL_DIR=/bin" "MAN_DIR=/share/man/man1")
183 (modify-phases %standard-phases
184 (delete 'configure) ; no configure script
185 (delete 'build)))) ; nothing to build
189 (home-page "https://www.colordiff.org")
190 (synopsis "Display diff output with colors")
192 "Colordiff is Perl script wrapper on top of diff command which provides
193 'syntax highlighting' for various patch formats.")
196 (define-public patches
197 (let ((commit "ef1b8a7d954b82ed4af3a08fd63d2085d19090ef"))
200 (home-page "https://github.com/stefanha/patches")
201 (version (string-append "0.0-1." (string-take commit 7)))
209 "11rdmhv0l1s8nqb20ywmw2zqizczch2p62qf9apyx5wqgxlnjshk"))
210 (file-name (string-append name "-"version "-checkout"))))
211 (build-system python-build-system)
212 (inputs `(("python-notmuch" ,python2-notmuch)))
214 `(#:tests? #f ;no "test" target
215 #:python ,python-2)) ;not compatible with Python 3
216 (synopsis "Patch tracking tool")
218 "@code{Patches} is a patch-tracking tool initially written for the QEMU
219 project. It provides commands that build a database of patches from a mailing
220 list, and commands that can search that database. It allows users to track
221 the status of a patch, apply patches, and search for patches---all that from
222 the command-line or from Emacs via its Notmuch integration.")
225 (define-public vbindiff
228 (version "3.0_beta5")
231 (uri (string-append "https://www.cjmweb.net/vbindiff/vbindiff-"
235 "1f1kj4jki08bnrwpzi663mjfkrx4wnfpzdfwd2qgijlkx5ysjkgh"))))
236 (build-system gnu-build-system)
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
242 hexadecimal and ASCII (or EBCDIC). It can also display two files at once, and
243 highlight the differences between them. It works well with large files (up to 4
254 (uri (string-append "mirror://gnome/sources/meld/"
255 (version-major+minor version)
256 "/meld-" version ".tar.xz"))
258 (base32 "0jdj7kd6vj1mdc16gvrj1kar88b2j5875ajq18fx7cbc9ny46j55"))))
259 (build-system python-build-system)
261 `(("intltool" ,intltool)
263 ("glib-compile-schemas" ,glib "bin")
264 ("python-pytest" ,python-pytest)))
266 `(("python-cairo" ,python-pycairo)
267 ("python-gobject" ,python-pygobject)
268 ("gtksourceview" ,gtksourceview)))
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".
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"
283 (string-append "--prefix=" (assoc-ref outputs "out"))
285 ;; The tests need to be run after installation.
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?
295 "not test_classify_change_actions"))))))
296 (home-page "https://meldmerge.org/")
297 (synopsis "Compare files, directories and working copies")
298 (description "Meld is a visual diff and merge tool targeted at
299 developers. Meld helps you compare files, directories, and version controlled
300 projects. It provides two- and three-way comparison of both files and
301 directories, and has support for many popular version control systems.
303 Meld helps you review code changes and understand patches. It might even help
304 you to figure out what is going on in that merge you keep avoiding.")
307 (define-public patchwork
314 (url "https://github.com/getpatchwork/patchwork.git")
315 (commit (string-append "v" version))))
316 (file-name (git-file-name name version))
319 "06ng5pv6744w98zkyfm0ldkmpdgnsql3gbbbh6awq61sr2ndr3qw"))))
320 (build-system python-build-system)
322 `(;; TODO: Tests require a running database
325 (modify-phases %standard-phases
328 (add-after 'unpack 'replace-wsgi.py
329 (lambda* (#:key inputs outputs #:allow-other-keys)
330 (delete-file "patchwork/wsgi.py")
331 (call-with-output-file "patchwork/wsgi.py"
333 ;; Embed the PYTHONPATH containing the dependencies, as well
334 ;; as the python modules in this package in the wsgi.py file,
335 ;; as this will ensure they are available at runtime.
337 (string-append (getenv "PYTHONPATH")
339 (site-packages inputs outputs)))
344 sys.path.extend('" pythonpath "'.split(':'))
346 from django.core.wsgi import get_wsgi_application
348 # By default, assume that patchwork is running as a Guix service, which
349 # provides the settings as the 'guix.patchwork.settings' Python module.
351 # When using httpd, it's hard to set environment variables, so rely on the
353 os.environ['DJANGO_SETTINGS_MODULE'] = os.getenv(
354 'DJANGO_SETTINGS_MODULE',
355 'guix.patchwork.settings' # default
358 application = get_wsgi_application()\n") port)))))
360 (lambda* (#:key tests? #:allow-other-keys)
362 (setenv "DJANGO_SETTINGS_MODULE" "patchwork.settings.dev")
363 (invoke "python" "-Wonce" "./manage.py" "test" "--noinput"))
366 (lambda* (#:key inputs outputs #:allow-other-keys)
367 (let ((out (assoc-ref outputs "out"))
368 (out-site-packages (site-packages inputs outputs)))
369 (for-each (lambda (directory)
372 (string-append out-site-packages directory)))
373 '(;; Contains the python code
375 ;; Contains the templates for the generated HTML
377 (delete-file-recursively
378 (string-append out-site-packages "patchwork/tests"))
380 ;; Install patchwork related tools
381 (for-each (lambda (file)
382 (install-file file (string-append out "/bin")))
384 (string-append out-site-packages
385 "patchwork/bin/pwclient")
386 (string-append out-site-packages
387 "patchwork/bin/parsemail.sh")
388 (string-append out-site-packages
389 "patchwork/bin/parsemail-batch.sh")))
391 ;; Delete the symlink to pwclient, and replace it with the
392 ;; actual file, as this can cause issues when serving the file
394 (let ((template-pwclient (string-append
396 "patchwork/templates/patchwork/pwclient")))
397 (delete-file template-pwclient)
398 (copy-file (string-append out-site-packages
399 "patchwork/bin/pwclient")
402 ;; Collect the static assets, this includes JavaScript, CSS and
403 ;; fonts. This is a standard Django process when running a
404 ;; Django application for regular use, and includes assets for
405 ;; dependencies like the admin site from Django.
407 ;; The intent here is that you can serve files from this
408 ;; directory through a webserver, which is recommended when
409 ;; running Django applications.
411 (string-append out "/share/patchwork/htdocs")))
412 (mkdir-p static-root)
413 (copy-file "patchwork/settings/production.example.py"
414 "patchwork/settings/assets.py")
415 (setenv "DJANGO_SECRET_KEY" "dummyvalue")
416 (setenv "DJANGO_SETTINGS_MODULE" "patchwork.settings.assets")
417 (setenv "STATIC_ROOT" static-root)
418 (invoke "./manage.py" "collectstatic" "--no-input"))
420 ;; The lib directory includes example configuration files that
421 ;; may be useful when deploying patchwork.
422 (copy-recursively "lib"
424 out "/share/doc/" ,name "-" ,version)))
426 ;; The hasher script is used from the post-receive.hook
427 (add-after 'install 'install-hasher
428 (lambda* (#:key inputs outputs #:allow-other-keys)
429 (let* ((out (assoc-ref outputs "out"))
430 (out-site-packages (site-packages inputs outputs))
431 (out-hasher.py (string-append out-site-packages
432 "/patchwork/hasher.py")))
433 (chmod out-hasher.py #o555)
434 (symlink out-hasher.py (string-append out "/bin/hasher")))
436 ;; Create a patchwork specific version of Django's command line admin
438 (add-after 'install 'install-patchwork-admin
439 (lambda* (#:key inputs outputs #:allow-other-keys)
440 (let* ((out (assoc-ref outputs "out")))
441 (mkdir-p (string-append out "/bin"))
442 (call-with-output-file (string-append out "/bin/patchwork-admin")
444 (simple-format port "#!~A
447 if __name__ == \"__main__\":
448 from django.core.management import execute_from_command_line
450 execute_from_command_line(sys.argv)" (which "python"))))
451 (chmod (string-append out "/bin/patchwork-admin") #o555))
454 `(("python-wrapper" ,python-wrapper)))
456 `(("python-django" ,python-django)
457 ;; TODO: Make this configurable
458 ("python-psycopg2" ,python-psycopg2)
459 ("python-mysqlclient" ,python-mysqlclient)
460 ("python-django-filter" ,python-django-filter)
461 ("python-djangorestframework" ,python-djangorestframework)
462 ("python-django-debug-toolbar" ,python-django-debug-toolbar)))
463 (synopsis "Web based patch tracking system")
465 "Patchwork is a patch tracking system. It takes in emails containing
466 patches, and displays the patches along with comments and state information.
467 Users can login allowing them to change the state of patches.")
468 (home-page "http://jk.ozlabs.org/projects/patchwork/")