projects/guix·blob version-1.4.0 · refs

531 lines · 21.7 KiB

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