gnu: facter: Update to 4.0.33.
[jackhill/guix/guix.git] / gnu / packages / patchutils.scm
index b655399..c26977b 100644 (file)
@@ -1,7 +1,8 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014, 2018 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2015, 2018 Leo Famulari <leo@famulari.name>
-;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2019 Christopher Baines <mail@cbaines.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,6 +20,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages patchutils)
+  #:use-module (guix utils)
   #:use-module (guix packages)
   #:use-module (guix licenses)
   #:use-module (guix download)
   #: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))
 
@@ -92,21 +101,17 @@ listing the files modified by a patch.")
 (define-public quilt
   (package
     (name "quilt")
-    (version "0.65")
+    (version "0.66")
     (source
      (origin
-      (method url-fetch)
-      (uri (string-append "mirror://savannah/quilt/"
-                          name "-" version ".tar.gz"))
-      (sha256
-       (base32
-        "06b816m2gz9jfif7k9v2hrm7fz76zjg5pavf7hd3ifybwn4cgjzn"))
-      (patches (search-patches "quilt-test-fix-regex.patch"
-                               "quilt-getopt-second-separator.patch"
-                               "quilt-getopt-nondigit-param.patch"))))
+       (method url-fetch)
+       (uri (string-append "mirror://savannah/quilt/"
+                           "quilt-" version ".tar.gz"))
+       (sha256
+        (base32 "01vfvk4pqigahx82fhaaffg921ivd3k7rylz1yfvy4zbdyd32jri"))))
     (build-system gnu-build-system)
     (native-inputs
-     `(("gettext" ,gnu-gettext)))
+     `(("gettext" ,gettext-minimal)))
     (inputs `(("perl" ,perl)
               ("less" ,less)
               ("file" ,file)
@@ -120,7 +125,7 @@ listing the files modified by a patch.")
            (lambda _
              (substitute*
                  '("test/run"
-                   "test/edit.test") 
+                   "test/edit.test")
                (("/bin/sh") (which "sh")))
              #t))
          (add-after 'install 'wrap-program
@@ -158,7 +163,7 @@ refreshed, and more.")
 (define-public colordiff
   (package
     (name "colordiff")
-    (version "1.0.18")
+    (version "1.0.19")
     (source
       (origin
         (method url-fetch)
@@ -167,8 +172,7 @@ refreshed, and more.")
                    (string-append "http://www.colordiff.org/archive/colordiff-"
                                   version ".tar.gz")))
       (sha256
-       (base32
-        "1q6n60n4b9fnzccxyxv04mxjsql4ddq17vl2c74ijvjdhpcfrkr9"))))
+       (base32 "069vzzgs7b44bmfh3ks2psrdb26s1w19gp9w4xxbgi7nhx6w3s26"))))
     (build-system gnu-build-system)
     (arguments
      `(#:tests? #f                      ; no tests
@@ -210,7 +214,7 @@ refreshed, and more.")
          #:python ,python-2))                    ;not compatible with Python 3
       (synopsis "Patch tracking tool")
       (description
-       "'Patches' is a patch-tracking tool initially written for the QEMU
+       "@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
@@ -238,3 +242,242 @@ 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
 GiB).")
     (license gpl2+)))
+
+(define-public meld
+  (package
+    (name "meld")
+    (version "3.20.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://gnome/sources/meld/"
+                           (version-major+minor version)
+                           "/meld-" version ".tar.xz"))
+       (sha256
+        (base32 "0a0x156zr3w2yg0rnhwy39giy3xnfm6sqcfa4xcw4i6ahvwqa2dc"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("intltool" ,intltool)
+       ("xmllint" ,libxml2)
+       ("glib-compile-schemas" ,glib "bin")
+       ("python-pytest" ,python-pytest)))
+    (inputs
+     `(("python-cairo" ,python-pycairo)
+       ("python-gobject" ,python-pygobject)
+       ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
+       ("gtksourceview" ,gtksourceview-3)))
+    (propagated-inputs
+     `(("dconf" ,dconf)))
+    (arguments
+     `(#:imported-modules ((guix build glib-or-gtk-build-system)
+                           ,@%python-build-system-modules)
+       #:modules ((guix build python-build-system)
+                  ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
+                  (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         ;; This setup.py 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" "setup.py"
+                     ;; This setup.py runs gtk-update-icon-cache  which we don't want.
+                     "--no-update-icon-cache"
+                     ;; "--no-compile-schemas"
+                     "install"
+                     (string-append "--prefix=" (assoc-ref outputs "out"))
+                     "--root=/")))
+         ;; 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"))))
+               #t))))))
+    (home-page "https://meldmerge.org/")
+    (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
+  (package
+    (name "patchwork")
+    (version "2.1.5")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/getpatchwork/patchwork")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1n4hfwlgmw6mj5kp261zfx47mgb0l7g2yzl1rf0rnm8x69lr3as6"))))
+    (build-system python-build-system)
+    (arguments
+     `(;; TODO: Tests require a running database
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'build)
+         (add-after 'unpack 'replace-wsgi.py
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (delete-file "patchwork/wsgi.py")
+             (call-with-output-file "patchwork/wsgi.py"
+               (lambda (port)
+                 ;; Embed the PYTHONPATH containing the dependencies, as well
+                 ;; as the python modules in this package in the wsgi.py file,
+                 ;; as this will ensure they are available at runtime.
+                 (define pythonpath
+                   (string-append (getenv "PYTHONPATH")
+                                  ":"
+                                  (site-packages inputs outputs)))
+                 (display
+                  (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(
+  'DJANGO_SETTINGS_MODULE',
+  'guix.patchwork.settings' # default
+)
+
+application = get_wsgi_application()\n") port)))))
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               (setenv "DJANGO_SETTINGS_MODULE" "patchwork.settings.dev")
+               (invoke "python" "-Wonce" "./manage.py" "test" "--noinput"))
+             #t))
+         (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)
+                           (copy-recursively
+                            directory
+                            (string-append out-site-packages directory)))
+                         '(;; Contains the python code
+                           "patchwork"
+                           ;; Contains the templates for the generated HTML
+                           "templates"))
+               (delete-file-recursively
+                (string-append out-site-packages "patchwork/tests"))
+
+               ;; Install patchwork related tools
+               (for-each (lambda (file)
+                           (install-file file (string-append out "/bin")))
+                         (list
+                          (string-append out-site-packages
+                                         "patchwork/bin/pwclient")
+                          (string-append out-site-packages
+                                         "patchwork/bin/parsemail.sh")
+                          (string-append out-site-packages
+                                         "patchwork/bin/parsemail-batch.sh")))
+
+               ;; 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
+                                         out-site-packages
+                                         "patchwork/templates/patchwork/pwclient")))
+                 (delete-file template-pwclient)
+                 (copy-file (string-append out-site-packages
+                                           "patchwork/bin/pwclient")
+                            template-pwclient))
+
+               ;; 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/production.example.py"
+                            "patchwork/settings/assets.py")
+                 (setenv "DJANGO_SECRET_KEY" "dummyvalue")
+                 (setenv "DJANGO_SETTINGS_MODULE" "patchwork.settings.assets")
+                 (setenv "STATIC_ROOT" static-root)
+                 (invoke "./manage.py" "collectstatic" "--no-input"))
+
+               ;; The lib directory includes example configuration files that
+               ;; may be useful when deploying patchwork.
+               (copy-recursively "lib"
+                                 (string-append
+                                  out "/share/doc/" ,name "-" ,version)))
+             #t))
+         ;; 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))
+                    (out-hasher.py (string-append out-site-packages
+                                                  "/patchwork/hasher.py")))
+               (chmod out-hasher.py #o555)
+               (symlink out-hasher.py (string-append out "/bin/hasher")))
+             #t))
+         ;; 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 django.core.management import execute_from_command_line
+
+    execute_from_command_line(sys.argv)" (which "python"))))
+               (chmod (string-append out "/bin/patchwork-admin") #o555))
+             #t)))))
+    (inputs
+     `(("python-wrapper" ,python-wrapper)))
+    (propagated-inputs
+     `(("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")
+    (description
+     "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 "http://jk.ozlabs.org/projects/patchwork/")
+    (license gpl2+)))