gnu: diffoscope: Update to 129.
[jackhill/guix/guix.git] / gnu / packages / diffoscope.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
4 ;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
6 ;;; Copyright © 2018, 2019 Rutger Helling <rhelling@mykolab.com>
7 ;;; Copyright © 2019 Vagrant Cascadian <vagrant@reproducible-builds.org>
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 diffoscope)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages acl)
27 #:use-module (gnu packages admin)
28 #:use-module (gnu packages android)
29 #:use-module (gnu packages backup)
30 #:use-module (gnu packages base)
31 #:use-module (gnu packages bootloaders)
32 #:use-module (gnu packages cdrom)
33 #:use-module (gnu packages check)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages cpio)
36 #:use-module (gnu packages dbm)
37 #:use-module (gnu packages gettext)
38 #:use-module (gnu packages ghostscript)
39 #:use-module (gnu packages gnome)
40 #:use-module (gnu packages gnupg)
41 #:use-module (gnu packages haskell)
42 #:use-module (gnu packages image)
43 #:use-module (gnu packages imagemagick)
44 #:use-module (gnu packages java)
45 #:use-module (gnu packages linux)
46 #:use-module (gnu packages llvm)
47 #:use-module (gnu packages mono)
48 #:use-module (gnu packages ocaml)
49 #:use-module (gnu packages package-management)
50 #:use-module (gnu packages patchutils)
51 #:use-module (gnu packages pdf)
52 #:use-module (gnu packages python-web)
53 #:use-module (gnu packages python-xyz)
54 #:use-module (gnu packages sqlite)
55 #:use-module (gnu packages ssh)
56 #:use-module (gnu packages statistics)
57 #:use-module (gnu packages textutils)
58 #:use-module (gnu packages video)
59 #:use-module (gnu packages vim)
60 #:use-module (gnu packages web)
61 #:use-module (guix build-system python)
62 #:use-module (guix gexp)
63 #:use-module (guix git-download)
64 #:use-module ((guix licenses) #:prefix license:)
65 #:use-module (guix packages)
66 #:use-module (guix utils)
67 #:use-module (ice-9 match))
68
69 (define-public diffoscope
70 (let ((version "129"))
71 (package
72 (name "diffoscope")
73 (version version)
74 (source (origin
75 (method git-fetch)
76 (uri (git-reference
77 (url "https://salsa.debian.org/reproducible-builds/diffoscope.git")
78 (commit version)))
79 (file-name (git-file-name name version))
80 (sha256
81 (base32
82 "1r8hq93gga9n4jv4fyf1divc9cwvvjadkzl47lazzrfy3nn1qjwr"))))
83 (build-system python-build-system)
84 (arguments
85 `(#:phases (modify-phases %standard-phases
86 ;; setup.py mistakenly requires python-magic from PyPi, even
87 ;; though the Python bindings of `file` are sufficient.
88 ;; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815844
89 (add-after 'unpack 'dependency-on-python-magic
90 (lambda _
91 (substitute* "setup.py"
92 (("'python-magic',") ""))))
93 ;; This test is broken because our `file` package has a
94 ;; bug in berkeley-db file type detection.
95 (add-after 'unpack 'remove-berkeley-test
96 (lambda _
97 (delete-file "tests/comparators/test_berkeley_db.py")
98 #t))
99 ;; Test is dynamically generated and may have false
100 ;; negatives with different ocaml versions. Further
101 ;; background in: https://bugs.debian.org/939386
102 (add-after 'unpack 'remove-ocaml-test
103 (lambda _
104 (substitute* "tests/comparators/test_ocaml.py"
105 (("def test_diff.differences.:")
106 "def skip_test_diff(differences):"))
107 #t))
108 (add-after 'unpack 'skip-elf-tests
109 ;; FIXME: libmix_differences test added in 125, and is
110 ;; failing, need to explore why...
111 (lambda _
112 (substitute* "tests/comparators/test_elf.py"
113 (("def test_libmix_differences.libmix_differences.:")
114 "def skip_test_libmix_differences(libmix_differences):"))
115 #t))
116 (add-after 'unpack 'embed-tool-references
117 (lambda* (#:key inputs #:allow-other-keys)
118 (substitute* "diffoscope/comparators/utils/compare.py"
119 (("\\['xxd',")
120 (string-append "['" (which "xxd") "',")))
121 (substitute* "diffoscope/comparators/elf.py"
122 (("@tool_required\\('readelf'\\)") "")
123 (("get_tool_name\\('readelf'\\)")
124 (string-append "'" (which "readelf") "'")))
125 (substitute* "diffoscope/comparators/directory.py"
126 (("@tool_required\\('stat'\\)") "")
127 (("@tool_required\\('getfacl'\\)") "")
128 (("\\['stat',")
129 (string-append "['" (which "stat") "',"))
130 (("\\['getfacl',")
131 (string-append "['" (which "getfacl") "',")))
132 #t))
133 (add-before 'check 'writable-test-data
134 (lambda _
135 ;; tests may need needs write access to tests
136 ;; directory
137 (for-each make-file-writable (find-files "tests"))
138 #t))
139 (add-before 'check 'delete-failing-test
140 (lambda _
141 ;; this requires /sbin to be on the path
142 (delete-file "tests/test_tools.py")
143 #t)))))
144 (inputs `(("rpm" ,rpm) ;for rpm-python
145 ("python-file" ,python-file)
146 ("python-debian" ,python-debian)
147 ("python-libarchive-c" ,python-libarchive-c)
148 ("python-tlsh" ,python-tlsh)
149 ("acl" ,acl) ;for getfacl
150 ("colordiff" ,colordiff)
151 ("xxd" ,xxd)))
152 ;; Below are modules used for tests.
153 (native-inputs `(("python-pytest" ,python-pytest)
154 ("python-chardet" ,python-chardet)
155 ("python-binwalk" ,python-binwalk)
156 ;; test suite skips tests when tool is missing
157 ,@(match (%current-system)
158 ;; ghc is only available on x86 currently.
159 ((or "x86_64-linux" "i686-linux")
160 `(("ghc" ,ghc)))
161 (_
162 `()))
163 ,@(match (%current-system)
164 ;; openjdk and dependent packages are only
165 ;; available on x86_64 currently.
166 ((or "x86_64-linux")
167 `(("enjarify" ,enjarify)
168 ;; no unversioned openjdk available
169 ("openjdk:jdk" ,openjdk12 "jdk")
170 ))
171 (_
172 `()))
173 ("abootimg" ,abootimg)
174 ("bdb" ,bdb)
175 ("binutils" ,binutils)
176 ("bzip2" ,bzip2)
177 ("cdrtools" ,cdrtools)
178 ("colord" ,colord)
179 ("cpio" ,cpio)
180 ("docx2txt" ,docx2txt)
181 ("dtc" ,dtc)
182 ("e2fsprogs" ,e2fsprogs)
183 ("ffmpeg" ,ffmpeg)
184 ("gettext" ,gettext-minimal)
185 ("ghostscript" ,ghostscript)
186 ("giflib:bin" ,giflib "bin")
187 ("gnumeric" ,gnumeric)
188 ("gnupg" ,gnupg)
189 ("imagemagick" ,imagemagick)
190 ("libarchive" ,libarchive)
191 ("llvm" ,llvm)
192 ("lz4" ,lz4)
193 ("mono" ,mono)
194 ("ocaml" ,ocaml)
195 ("odt2txt" ,odt2txt)
196 ("openssh" ,openssh)
197 ("pgpdump" ,pgpdump)
198 ("poppler" ,poppler)
199 ("python-jsbeautifier" ,python-jsbeautifier)
200 ("r-minimal" ,r-minimal)
201 ("rpm" ,rpm)
202 ("sng" ,sng)
203 ("sqlite" ,sqlite)
204 ("squashfs-tools" ,squashfs-tools)
205 ("tcpdump" ,tcpdump)
206 ("unzip" ,unzip)
207 ("wabt" ,wabt)
208 ("xxd" ,xxd)
209 ("xz" ,xz)
210 ("zip" ,zip)))
211 (home-page "https://diffoscope.org/")
212 (synopsis "Compare files, archives, and directories in depth")
213 (description
214 "Diffoscope tries to get to the bottom of what makes files or directories
215 different. It recursively unpacks archives of many kinds and transforms
216 various binary formats into more human readable forms to compare them. It can
217 compare two tarballs, ISO images, or PDFs just as easily.")
218 (license license:gpl3+))))
219
220 (define-public trydiffoscope
221 (package
222 (name "trydiffoscope")
223 (version "67.0.1")
224 (source
225 (origin
226 (method git-fetch)
227 (uri (git-reference
228 (url "https://salsa.debian.org/reproducible-builds/trydiffoscope.git")
229 (commit version)))
230 (file-name (git-file-name name version))
231 (sha256
232 (base32
233 "03b66cjii7l2yiwffj6ym6mycd5drx7prfp4j2550281pias6mjh"))))
234 (arguments
235 `(#:phases
236 (modify-phases %standard-phases
237 (add-after 'install 'install-doc
238 (lambda* (#:key outputs #:allow-other-keys)
239 (let* ((share (string-append (assoc-ref outputs "out") "/share/")))
240 (mkdir-p (string-append share "/man/man1/" ))
241 (invoke "rst2man.py"
242 "trydiffoscope.1.rst"
243 (string-append share "/man/man1/trydiffoscope.1"))
244 (mkdir-p (string-append share "/doc/" ,name "-" ,version))
245 (install-file "./README.rst"
246 (string-append share "/doc/" ,name "-" ,version)))
247 #t)))))
248 (propagated-inputs
249 `(("python-requests" ,python-requests)))
250 (native-inputs
251 `(("gzip" ,gzip)
252 ("python-docutils" ,python-docutils)))
253 (build-system python-build-system)
254 (home-page "https://try.diffoscope.org")
255 (synopsis "Client for remote diffoscope service")
256 (description "This is a client for the @url{https://try.diffoscope.org,
257 remote diffoscope service}.
258
259 Diffoscope tries to get to the bottom of what makes files or directories
260 different. It recursively unpacks archives of many kinds and transforms
261 various binary formats into more human readable forms to compare them. It can
262 compare two tarballs, ISO images, or PDFs just as easily.
263
264 Results are displayed by default, stored as local text or html files, or made
265 available via a URL on @url{https://try.diffoscope.org}. Results stored on the
266 server are purged after 30 days.")
267 (license license:gpl3+)))