You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

483 lines
21 KiB

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2018 Eric Bavier <>
;;; Copyright © 2015, 2018 Leo Famulari <>
;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <>
;;; Copyright © 2019 Christopher Baines <>
;;; This file is part of GNU Guix.
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; GNU General Public License for more details.
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <>.
(define-module (gnu packages patchutils)
#:use-module (guix utils)
#:use-module (guix packages)
#:use-module (guix licenses)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix build-system gnu)
#:use-module (guix build-system python)
#:use-module (gnu packages)
#:use-module (gnu packages ed)
#:use-module (gnu packages base)
#:use-module (gnu packages bash)
#:use-module (gnu packages check)
#:use-module (gnu packages databases)
#:use-module (gnu packages django)
#:use-module (gnu packages file)
#:use-module (gnu packages gawk)
#:use-module (gnu packages gettext)
#:use-module (gnu packages glib)
#:use-module (gnu packages gnome)
#:use-module (gnu packages gtk)
#:use-module (gnu packages less)
#:use-module (gnu packages mail)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages perl)
#:use-module (gnu packages python)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages version-control)
#:use-module (gnu packages xml))
(define-public patchutils
(name "patchutils")
(version "0.3.4")
(method url-fetch)
(uri (string-append ""
name "-" version ".tar.xz"))
(patches (search-patches "patchutils-test-perms.patch"))))
(build-system gnu-build-system)
(inputs `(("perl" ,perl)))
'(#:parallel-tests? #f
(modify-phases %standard-phases
(add-before 'check 'patch-test-scripts
(lambda _
(substitute* (find-files "tests" "^run-test$")
(("/bin/echo") (which "echo")))
(add-after 'install 'wrap-program
;; Point installed scripts to the utilities they need.
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(diffutils (assoc-ref inputs "diffutils"))
(sed (assoc-ref inputs "sed"))
(gawk (assoc-ref inputs "gawk")))
(lambda (prog)
(wrap-program (string-append out "/bin/" prog)
`("PATH" ":" prefix
,(map (lambda (dir)
(string-append dir "/bin"))
(list diffutils sed gawk)))))
'("dehtmldiff" "editdiff" "espdiff")))
(home-page "")
(synopsis "Collection of tools for manipulating patch files")
"Patchutils is a collection of programs that can manipulate patch files
in useful ways such as interpolating between two pre-patches, combining two
incremental patches, fixing line numbers in hand-edited patches, and simply
listing the files modified by a patch.")
(license gpl2+)))
(define-public quilt
(name "quilt")
(version "0.66")
(method url-fetch)
(uri (string-append "mirror://savannah/quilt/"
"quilt-" version ".tar.gz"))
(base32 "01vfvk4pqigahx82fhaaffg921ivd3k7rylz1yfvy4zbdyd32jri"))))
(build-system gnu-build-system)
`(("gettext" ,gettext-minimal)))
(inputs `(("perl" ,perl)
("less" ,less)
("file" ,file)
("ed" ,ed)
("diffstat" ,diffstat)))
'(#:parallel-tests? #f
(modify-phases %standard-phases
(add-before 'check 'patch-tests
(lambda _
(("/bin/sh") (which "sh")))
(add-after 'install 'wrap-program
;; quilt's configure checks for the absolute path to the utilities it
;; needs, but uses only the name when invoking them, so we need to
;; make sure the quilt script can find those utilities when run.
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(coreutils (assoc-ref inputs "coreutils"))
(diffutils (assoc-ref inputs "diffutils"))
(findutils (assoc-ref inputs "findutils"))
(diffstat (assoc-ref inputs "diffstat"))
(less (assoc-ref inputs "less"))
(file (assoc-ref inputs "file"))
(ed (assoc-ref inputs "ed"))
(sed (assoc-ref inputs "sed"))
(bash (assoc-ref inputs "bash"))
(grep (assoc-ref inputs "grep")))
(wrap-program (string-append out "/bin/quilt")
`("PATH" ":" prefix
,(map (lambda (dir)
(string-append dir "/bin"))
(list coreutils diffutils findutils
less file ed sed bash grep
(home-page "")
(synopsis "Script for managing patches to software")
"Quilt allows you to easily manage large numbers of patches by keeping
track of the changes each patch makes. Patches can be applied, un-applied,
refreshed, and more.")
(license gpl2)))
(define-public colordiff
(name "colordiff")
(version "1.0.19")
(method url-fetch)
(uri (list (string-append ""
version ".tar.gz")
(string-append ""
version ".tar.gz")))
(base32 "069vzzgs7b44bmfh3ks2psrdb26s1w19gp9w4xxbgi7nhx6w3s26"))))
(build-system gnu-build-system)
`(#:tests? #f ; no tests
#:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out"))
"INSTALL_DIR=/bin" "MAN_DIR=/share/man/man1")
(modify-phases %standard-phases
(delete 'configure) ; no configure script
(delete 'build)))) ; nothing to build
`(("perl" ,perl)
("xmlto" ,xmlto)))
(home-page "")
(synopsis "Display diff output with colors")
"Colordiff is Perl script wrapper on top of diff command which provides
'syntax highlighting' for various patch formats.")
(license gpl2+)))
(define-public patches
(let ((commit "ef1b8a7d954b82ed4af3a08fd63d2085d19090ef"))
(name "patches")
(home-page "")
(version (string-append "0.0-1." (string-take commit 7)))
(source (origin
(method git-fetch)
(uri (git-reference
(url home-page)
(commit commit)))
(file-name (string-append name "-"version "-checkout"))))
(build-system python-build-system)
(inputs `(("python-notmuch" ,python2-notmuch)))
`(#:tests? #f ;no "test" target
#:python ,python-2)) ;not compatible with Python 3
(synopsis "Patch tracking tool")
"@code{Patches} is a patch-tracking tool initially written for the QEMU
project. It provides commands that build a database of patches from a mailing
list, and commands that can search that database. It allows users to track
the status of a patch, apply patches, and search for patches---all that from
the command-line or from Emacs via its Notmuch integration.")
(license gpl2+))))
(define-public vbindiff
(name "vbindiff")
(version "3.0_beta5")
(source (origin
(method url-fetch)
(uri (string-append ""
version ".tar.gz"))
(build-system gnu-build-system)
`(("ncurses" ,ncurses)))
(home-page "")
(synopsis "Console-based tool for comparing binary data")
(description "Visual Binary Diff (@command{vbindiff}) displays files in
hexadecimal and ASCII (or EBCDIC). It can also display two files at once, and
highlight the differences between them. It works well with large files (up to 4
(license gpl2+)))
(define-public meld
(name "meld")
(version "3.20.2")
(method url-fetch)
(uri (string-append "mirror://gnome/sources/meld/"
(version-major+minor version)
"/meld-" version ".tar.xz"))
(base32 "0a0x156zr3w2yg0rnhwy39giy3xnfm6sqcfa4xcw4i6ahvwqa2dc"))))
(build-system python-build-system)
`(("intltool" ,intltool)
("xmllint" ,libxml2)
("glib-compile-schemas" ,glib "bin")
("python-pytest" ,python-pytest)))
`(("python-cairo" ,python-pycairo)
("python-gobject" ,python-pygobject)
("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
("gtksourceview" ,gtksourceview-3)))
`(("dconf" ,dconf)))
`(#:imported-modules ((guix build glib-or-gtk-build-system)
#:modules ((guix build python-build-system)
((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
(guix build utils))
(modify-phases %standard-phases
;; This script does not support one of the Python build
;; system's default flags, "--single-version-externally-managed".
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(invoke "python" ""
;; This runs gtk-update-icon-cache which we don't want.
;; "--no-compile-schemas"
(string-append "--prefix=" (assoc-ref outputs "out"))
;; The tests need to be run after installation.
(delete 'check)
(add-after 'install 'check
(lambda* (#:key inputs outputs #:allow-other-keys)
;; Tests look for installed package
(add-installed-pythonpath inputs outputs)
;; The tests fail when HOME=/homeless-shelter.
(setenv "HOME" "/tmp")
(invoke "py.test" "-v" "-k"
;; TODO: Those tests fail, why?
"not test_classify_change_actions")))
(add-after 'wrap 'glib-or-gtk-wrap
(assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))
(add-after 'wrap 'wrap-typelib
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(wrap-program (string-append out "/bin/meld")
`("GI_TYPELIB_PATH" prefix
,(search-path-as-string->list (getenv "GI_TYPELIB_PATH"))))
(home-page "")
(synopsis "Compare files, directories and working copies")
(description "Meld is a visual diff and merge tool targeted at
developers. Meld helps you compare files, directories, and version controlled
projects. It provides two- and three-way comparison of both files and
directories, and has support for many popular version control systems.
Meld helps you review code changes and understand patches. It might even help
you to figure out what is going on in that merge you keep avoiding.")
(license gpl2)))
(define-public patchwork
(name "patchwork")
(version "2.1.5")
(source (origin
(method git-fetch)
(uri (git-reference
(url "")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(build-system python-build-system)
`(;; TODO: Tests require a running database
#:tests? #f
(modify-phases %standard-phases
(delete 'configure)
(delete 'build)
(add-after 'unpack '
(lambda* (#:key inputs outputs #:allow-other-keys)
(delete-file "patchwork/")
(call-with-output-file "patchwork/"
(lambda (port)
;; Embed the PYTHONPATH containing the dependencies, as well
;; as the python modules in this package in the file,
;; as this will ensure they are available at runtime.
(define pythonpath
(string-append (getenv "PYTHONPATH")
(site-packages inputs outputs)))
(string-append "
import os, sys
sys.path.extend('" pythonpath "'.split(':'))
from django.core.wsgi import get_wsgi_application
# By default, assume that patchwork is running as a Guix service, which
# provides the settings as the 'guix.patchwork.settings' Python module.
# When using httpd, it's hard to set environment variables, so rely on the
# default set here.
os.environ['DJANGO_SETTINGS_MODULE'] = os.getenv(
'guix.patchwork.settings' # default
application = get_wsgi_application()\n") port)))))
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
(invoke "python" "-Wonce" "./" "test" "--noinput"))
(replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(out-site-packages (site-packages inputs outputs)))
(for-each (lambda (directory)
(string-append out-site-packages directory)))
'(;; Contains the python code
;; Contains the templates for the generated HTML
(string-append out-site-packages "patchwork/tests"))
;; Install patchwork related tools
(for-each (lambda (file)
(install-file file (string-append out "/bin")))
(string-append out-site-packages
(string-append out-site-packages
(string-append out-site-packages
;; Delete the symlink to pwclient, and replace it with the
;; actual file, as this can cause issues when serving the file
;; from a webserver.
(let ((template-pwclient (string-append
(delete-file template-pwclient)
(copy-file (string-append out-site-packages
;; Collect the static assets, this includes JavaScript, CSS and
;; fonts. This is a standard Django process when running a
;; Django application for regular use, and includes assets for
;; dependencies like the admin site from Django.
;; The intent here is that you can serve files from this
;; directory through a webserver, which is recommended when
;; running Django applications.
(let ((static-root
(string-append out "/share/patchwork/htdocs")))
(mkdir-p static-root)
(copy-file "patchwork/settings/"
(setenv "DJANGO_SECRET_KEY" "dummyvalue")
(setenv "DJANGO_SETTINGS_MODULE" "patchwork.settings.assets")
(setenv "STATIC_ROOT" static-root)
(invoke "./" "collectstatic" "--no-input"))
;; The lib directory includes example configuration files that
;; may be useful when deploying patchwork.
(copy-recursively "lib"
out "/share/doc/" ,name "-" ,version)))
;; The hasher script is used from the post-receive.hook
(add-after 'install 'install-hasher
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(out-site-packages (site-packages inputs outputs))
( (string-append out-site-packages
(chmod #o555)
(symlink (string-append out "/bin/hasher")))
;; Create a patchwork specific version of Django's command line admin
;; utility.
(add-after 'install 'install-patchwork-admin
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")))
(mkdir-p (string-append out "/bin"))
(call-with-output-file (string-append out "/bin/patchwork-admin")
(lambda (port)
(simple-format port "#!~A
import os, sys
if __name__ == \"__main__\":
from import execute_from_command_line
execute_from_command_line(sys.argv)" (which "python"))))
(chmod (string-append out "/bin/patchwork-admin") #o555))
`(("python-wrapper" ,python-wrapper)))
`(("python-django" ,python-django)
;; TODO: Make this configurable
("python-psycopg2" ,python-psycopg2)
("python-mysqlclient" ,python-mysqlclient)
("python-django-filter" ,python-django-filter)
("python-djangorestframework" ,python-djangorestframework)
("python-django-debug-toolbar" ,python-django-debug-toolbar)))
(synopsis "Web based patch tracking system")
"Patchwork is a patch tracking system. It takes in emails containing
patches, and displays the patches along with comments and state information.
Users can login allowing them to change the state of patches.")
(home-page "")
(license gpl2+)))