projects/guix·blob mpd-fix-groups · refs

584 lines · 24.1 KiB

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