patchutils.scm 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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 Tobias Geerinckx-Rice <me@tobias.gr>
  5. ;;;
  6. ;;; This file is part of GNU Guix.
  7. ;;;
  8. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  9. ;;; under the terms of the GNU General Public License as published by
  10. ;;; the Free Software Foundation; either version 3 of the License, or (at
  11. ;;; your option) any later version.
  12. ;;;
  13. ;;; GNU Guix is distributed in the hope that it will be useful, but
  14. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ;;; GNU General Public License for more details.
  17. ;;;
  18. ;;; You should have received a copy of the GNU General Public License
  19. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  20. (define-module (gnu packages patchutils)
  21. #:use-module (guix utils)
  22. #:use-module (guix packages)
  23. #:use-module (guix licenses)
  24. #:use-module (guix download)
  25. #:use-module (guix git-download)
  26. #:use-module (guix build-system gnu)
  27. #:use-module (guix build-system python)
  28. #:use-module (gnu packages)
  29. #:use-module (gnu packages ed)
  30. #:use-module (gnu packages base)
  31. #:use-module (gnu packages bash)
  32. #:use-module (gnu packages check)
  33. #:use-module (gnu packages file)
  34. #:use-module (gnu packages gawk)
  35. #:use-module (gnu packages gettext)
  36. #:use-module (gnu packages glib)
  37. #:use-module (gnu packages gnome)
  38. #:use-module (gnu packages gtk)
  39. #:use-module (gnu packages less)
  40. #:use-module (gnu packages mail)
  41. #:use-module (gnu packages ncurses)
  42. #:use-module (gnu packages perl)
  43. #:use-module (gnu packages python)
  44. #:use-module (gnu packages python-xyz)
  45. #:use-module (gnu packages version-control)
  46. #:use-module (gnu packages xml))
  47. (define-public patchutils
  48. (package
  49. (name "patchutils")
  50. (version "0.3.4")
  51. (source
  52. (origin
  53. (method url-fetch)
  54. (uri (string-append "http://cyberelk.net/tim/data/patchutils/stable/"
  55. name "-" version ".tar.xz"))
  56. (sha256
  57. (base32
  58. "0xp8mcfyi5nmb5a2zi5ibmyshxkb1zv1dgmnyn413m7ahgdx8mfg"))
  59. (patches (search-patches "patchutils-test-perms.patch"))))
  60. (build-system gnu-build-system)
  61. (inputs `(("perl" ,perl)))
  62. (arguments
  63. '(#:parallel-tests? #f
  64. #:phases
  65. (modify-phases %standard-phases
  66. (add-before 'check 'patch-test-scripts
  67. (lambda _
  68. (substitute* (find-files "tests" "^run-test$")
  69. (("/bin/echo") (which "echo")))
  70. #t))
  71. (add-after 'install 'wrap-program
  72. ;; Point installed scripts to the utilities they need.
  73. (lambda* (#:key inputs outputs #:allow-other-keys)
  74. (let* ((out (assoc-ref outputs "out"))
  75. (diffutils (assoc-ref inputs "diffutils"))
  76. (sed (assoc-ref inputs "sed"))
  77. (gawk (assoc-ref inputs "gawk")))
  78. (for-each
  79. (lambda (prog)
  80. (wrap-program (string-append out "/bin/" prog)
  81. `("PATH" ":" prefix
  82. ,(map (lambda (dir)
  83. (string-append dir "/bin"))
  84. (list diffutils sed gawk)))))
  85. '("dehtmldiff" "editdiff" "espdiff")))
  86. #t)))))
  87. (home-page "http://cyberelk.net/tim/software/patchutils")
  88. (synopsis "Collection of tools for manipulating patch files")
  89. (description
  90. "Patchutils is a collection of programs that can manipulate patch files
  91. in useful ways such as interpolating between two pre-patches, combining two
  92. incremental patches, fixing line numbers in hand-edited patches, and simply
  93. listing the files modified by a patch.")
  94. (license gpl2+)))
  95. (define-public quilt
  96. (package
  97. (name "quilt")
  98. (version "0.65")
  99. (source
  100. (origin
  101. (method url-fetch)
  102. (uri (string-append "mirror://savannah/quilt/"
  103. name "-" version ".tar.gz"))
  104. (sha256
  105. (base32
  106. "06b816m2gz9jfif7k9v2hrm7fz76zjg5pavf7hd3ifybwn4cgjzn"))
  107. (patches (search-patches "quilt-test-fix-regex.patch"
  108. "quilt-getopt-second-separator.patch"
  109. "quilt-getopt-nondigit-param.patch"))))
  110. (build-system gnu-build-system)
  111. (native-inputs
  112. `(("gettext" ,gnu-gettext)))
  113. (inputs `(("perl" ,perl)
  114. ("less" ,less)
  115. ("file" ,file)
  116. ("ed" ,ed)
  117. ("diffstat" ,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
  157. track of the changes each patch makes. Patches can be applied, un-applied,
  158. refreshed, and more.")
  159. (license gpl2)))
  160. (define-public colordiff
  161. (package
  162. (name "colordiff")
  163. (version "1.0.18")
  164. (source
  165. (origin
  166. (method url-fetch)
  167. (uri (list (string-append "https://www.colordiff.org/colordiff-"
  168. version ".tar.gz")
  169. (string-append "http://www.colordiff.org/archive/colordiff-"
  170. version ".tar.gz")))
  171. (sha256
  172. (base32
  173. "1q6n60n4b9fnzccxyxv04mxjsql4ddq17vl2c74ijvjdhpcfrkr9"))))
  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. `(("perl" ,perl)
  185. ("xmlto" ,xmlto)))
  186. (home-page "https://www.colordiff.org")
  187. (synopsis "Display diff output with colors")
  188. (description
  189. "Colordiff is Perl script wrapper on top of diff command which provides
  190. 'syntax highlighting' for various patch formats.")
  191. (license gpl2+)))
  192. (define-public patches
  193. (let ((commit "ef1b8a7d954b82ed4af3a08fd63d2085d19090ef"))
  194. (package
  195. (name "patches")
  196. (home-page "https://github.com/stefanha/patches")
  197. (version (string-append "0.0-1." (string-take commit 7)))
  198. (source (origin
  199. (method git-fetch)
  200. (uri (git-reference
  201. (url home-page)
  202. (commit commit)))
  203. (sha256
  204. (base32
  205. "11rdmhv0l1s8nqb20ywmw2zqizczch2p62qf9apyx5wqgxlnjshk"))
  206. (file-name (string-append name "-"version "-checkout"))))
  207. (build-system python-build-system)
  208. (inputs `(("python-notmuch" ,python2-notmuch)))
  209. (arguments
  210. `(#:tests? #f ;no "test" target
  211. #:python ,python-2)) ;not compatible with Python 3
  212. (synopsis "Patch tracking tool")
  213. (description
  214. "'Patches' is a patch-tracking tool initially written for the QEMU
  215. project. It provides commands that build a database of patches from a mailing
  216. list, and commands that can search that database. It allows users to track
  217. the status of a patch, apply patches, and search for patches---all that from
  218. the command-line or from Emacs via its Notmuch integration.")
  219. (license gpl2+))))
  220. (define-public vbindiff
  221. (package
  222. (name "vbindiff")
  223. (version "3.0_beta5")
  224. (source (origin
  225. (method url-fetch)
  226. (uri (string-append "https://www.cjmweb.net/vbindiff/vbindiff-"
  227. version ".tar.gz"))
  228. (sha256
  229. (base32
  230. "1f1kj4jki08bnrwpzi663mjfkrx4wnfpzdfwd2qgijlkx5ysjkgh"))))
  231. (build-system gnu-build-system)
  232. (inputs
  233. `(("ncurses" ,ncurses)))
  234. (home-page "https://www.cjmweb.net/vbindiff/")
  235. (synopsis "Console-based tool for comparing binary data")
  236. (description "Visual Binary Diff (@command{vbindiff}) displays files in
  237. hexadecimal and ASCII (or EBCDIC). It can also display two files at once, and
  238. highlight the differences between them. It works well with large files (up to 4
  239. GiB).")
  240. (license gpl2+)))
  241. (define-public meld
  242. (package
  243. (name "meld")
  244. (version "3.20.0")
  245. (source
  246. (origin
  247. (method url-fetch)
  248. (uri (string-append "mirror://gnome/sources/meld/"
  249. (version-major+minor version)
  250. "/meld-" version ".tar.xz"))
  251. (sha256
  252. (base32
  253. "11khi1sg02k3b9qdag3r939cwi27cql4kjim7jhxf9ckfhpzwh6b"))))
  254. (build-system python-build-system)
  255. (native-inputs
  256. `(("intltool" ,intltool)
  257. ("xmllint" ,libxml2)
  258. ("glib-compile-schemas" ,glib "bin")
  259. ("python-pytest" ,python-pytest)))
  260. (inputs
  261. `(("python-cairo" ,python-pycairo)
  262. ("python-gobject" ,python-pygobject)
  263. ("gtksourceview" ,gtksourceview)))
  264. (propagated-inputs
  265. `(("dconf" ,dconf)))
  266. (arguments
  267. `(#:phases
  268. (modify-phases %standard-phases
  269. ;; This setup.py script does not support one of the Python build
  270. ;; system's default flags, "--single-version-externally-managed".
  271. (replace 'install
  272. (lambda* (#:key outputs #:allow-other-keys)
  273. (invoke "python" "setup.py"
  274. ;; This setup.py runs gtk-update-icon-cache which we don't want.
  275. "--no-update-icon-cache"
  276. ;; "--no-compile-schemas"
  277. "install"
  278. (string-append "--prefix=" (assoc-ref outputs "out"))
  279. "--root=/")))
  280. ;; The tests need to be run after installation.
  281. (delete 'check)
  282. (add-after 'install 'check
  283. (lambda* (#:key inputs outputs #:allow-other-keys)
  284. ;; Tests look for installed package
  285. (add-installed-pythonpath inputs outputs)
  286. ;; The tests fail when HOME=/homeless-shelter.
  287. (setenv "HOME" "/tmp")
  288. (invoke "py.test" "-v" "-k"
  289. ;; TODO: Those tests fail, why?
  290. "not test_classify_change_actions"))))))
  291. (home-page "https://meldmerge.org/")
  292. (synopsis "Compare files, directories and working copies")
  293. (description "Meld is a visual diff and merge tool targeted at
  294. developers. Meld helps you compare files, directories, and version controlled
  295. projects. It provides two- and three-way comparison of both files and
  296. directories, and has support for many popular version control systems.
  297. Meld helps you review code changes and understand patches. It might even help
  298. you to figure out what is going on in that merge you keep avoiding.")
  299. (license gpl2)))