gnu: r-fields: Update to 11.4.
[jackhill/guix/guix.git] / gnu / packages / diffoscope.scm
CommitLineData
52211add
VC
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>
31d64747 4;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
52211add
VC
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)
3244b64f 28 #:use-module (gnu packages android)
52211add
VC
29 #:use-module (gnu packages backup)
30 #:use-module (gnu packages base)
3244b64f 31 #:use-module (gnu packages bootloaders)
52211add
VC
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)
c526ddf4 47 #:use-module (gnu packages man)
2cc226bb 48 #:use-module (gnu packages maths)
52211add 49 #:use-module (gnu packages mono)
3fb581ca 50 #:use-module (gnu packages ocaml)
52211add
VC
51 #:use-module (gnu packages package-management)
52 #:use-module (gnu packages patchutils)
53 #:use-module (gnu packages pdf)
54 #:use-module (gnu packages python-web)
55 #:use-module (gnu packages python-xyz)
56 #:use-module (gnu packages sqlite)
57 #:use-module (gnu packages ssh)
3244b64f 58 #:use-module (gnu packages statistics)
52211add 59 #:use-module (gnu packages textutils)
ac4fefb2 60 #:use-module (gnu packages tls)
52211add
VC
61 #:use-module (gnu packages video)
62 #:use-module (gnu packages vim)
4d83157c 63 #:use-module (gnu packages web)
52211add
VC
64 #:use-module (guix build-system python)
65 #:use-module (guix gexp)
66 #:use-module (guix git-download)
67 #:use-module ((guix licenses) #:prefix license:)
68 #:use-module (guix packages)
aaeb2b34
VC
69 #:use-module (guix utils)
70 #:use-module (ice-9 match))
52211add
VC
71
72(define-public diffoscope
a0e5111e
TGR
73 (package
74 (name "diffoscope")
607a136a 75 (version "151")
a0e5111e
TGR
76 (source (origin
77 (method git-fetch)
78 (uri (git-reference
79 (url "https://salsa.debian.org/reproducible-builds/diffoscope.git")
80 (commit version)))
81 (file-name (git-file-name name version))
82 (sha256
83 (base32
607a136a 84 "1lv44ngqij9dp3xk9jj95w7an7h03iac6b2ifpq33j5fffswa1sm"))))
a0e5111e
TGR
85 (build-system python-build-system)
86 (arguments
87 `(#:phases (modify-phases %standard-phases
88 ;; setup.py mistakenly requires python-magic from PyPi, even
89 ;; though the Python bindings of `file` are sufficient.
90 ;; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815844
91 (add-after 'unpack 'dependency-on-python-magic
92 (lambda _
93 (substitute* "setup.py"
94 (("'python-magic',") ""))))
a0e5111e
TGR
95 ;; This test is broken because our `file` package has a
96 ;; bug in berkeley-db file type detection.
97 (add-after 'unpack 'remove-berkeley-test
98 (lambda _
99 (delete-file "tests/comparators/test_berkeley_db.py")
100 #t))
101 ;; Test is dynamically generated and may have false
102 ;; negatives with different ocaml versions. Further
103 ;; background in: https://bugs.debian.org/939386
104 (add-after 'unpack 'remove-ocaml-test
105 (lambda _
106 (substitute* "tests/comparators/test_ocaml.py"
107 (("def test_diff.differences.:")
108 "def skip_test_diff(differences):"))
109 #t))
110 (add-after 'unpack 'skip-elf-tests
111 ;; FIXME: libmix_differences test added in 125, and is
112 ;; failing, need to explore why...
113 (lambda _
114 (substitute* "tests/comparators/test_elf.py"
115 (("def test_libmix_differences.libmix_differences.:")
116 "def skip_test_libmix_differences(libmix_differences):"))
117 #t))
118 (add-after 'unpack 'embed-tool-references
119 (lambda* (#:key inputs #:allow-other-keys)
120 (substitute* "diffoscope/comparators/utils/compare.py"
121 (("\\['xxd',")
122 (string-append "['" (which "xxd") "',")))
123 (substitute* "diffoscope/comparators/elf.py"
124 (("@tool_required\\('readelf'\\)") "")
125 (("get_tool_name\\('readelf'\\)")
126 (string-append "'" (which "readelf") "'")))
127 (substitute* "diffoscope/comparators/directory.py"
128 (("@tool_required\\('stat'\\)") "")
129 (("@tool_required\\('getfacl'\\)") "")
130 (("\\['stat',")
131 (string-append "['" (which "stat") "',"))
132 (("\\['getfacl',")
133 (string-append "['" (which "getfacl") "',")))
134 #t))
afba93ef
TGR
135 (add-after 'build 'build-man-page
136 (lambda* (#:key (make-flags '()) #:allow-other-keys)
137 (apply invoke "make" "-C" "doc" make-flags)))
a0e5111e
TGR
138 (add-before 'check 'writable-test-data
139 (lambda _
afba93ef 140 ;; Tests may need write access to tests directory.
a0e5111e
TGR
141 (for-each make-file-writable (find-files "tests"))
142 #t))
143 (add-before 'check 'delete-failing-test
144 (lambda _
afba93ef 145 ;; This requires /sbin to be in $PATH.
a0e5111e 146 (delete-file "tests/test_tools.py")
afba93ef
TGR
147 #t))
148 (add-after 'install 'install-man-page
149 (lambda* (#:key outputs #:allow-other-keys)
150 (let* ((out (assoc-ref outputs "out"))
151 (man (string-append out "/share/man/man1")))
152 (install-file "doc/diffoscope.1" man)
153 #t))))))
a0e5111e
TGR
154 (inputs `(("rpm" ,rpm) ;for rpm-python
155 ("python-file" ,python-file)
156 ("python-debian" ,python-debian)
157 ("python-libarchive-c" ,python-libarchive-c)
158 ("python-tlsh" ,python-tlsh)
159 ("acl" ,acl) ;for getfacl
160 ("colordiff" ,colordiff)
161 ("xxd" ,xxd)))
afba93ef
TGR
162 (native-inputs `(("help2man" ,help2man)
163 ;; Below are modules used for tests.
164 ("python-pytest" ,python-pytest)
a0e5111e
TGR
165 ("python-chardet" ,python-chardet)
166 ("python-binwalk" ,python-binwalk)
167 ("python-h5py" ,python-h5py)
168 ("python-pypdf2" ,python-pypdf2)
169 ("python-progressbar33" ,python-progressbar33)
afba93ef 170 ;; The test suite skips tests when these are missing.
a0e5111e
TGR
171 ,@(match (%current-system)
172 ;; ghc is only available on x86 currently.
173 ((or "x86_64-linux" "i686-linux")
174 `(("ghc" ,ghc)))
175 (_
176 `()))
177 ,@(match (%current-system)
178 ;; openjdk and dependent packages are only
179 ;; available on x86_64 currently.
180 ((or "x86_64-linux")
181 `(("enjarify" ,enjarify)
182 ;; no unversioned openjdk available
ffecb239 183 ("openjdk:jdk" ,openjdk12 "jdk")))
a0e5111e
TGR
184 (_
185 `()))
186 ("abootimg" ,abootimg)
187 ("bdb" ,bdb)
188 ("binutils" ,binutils)
189 ("bzip2" ,bzip2)
190 ("cdrtools" ,cdrtools)
191 ("colord" ,colord)
192 ("cpio" ,cpio)
193 ("docx2txt" ,docx2txt)
194 ("dtc" ,dtc)
195 ("e2fsprogs" ,e2fsprogs)
196 ("ffmpeg" ,ffmpeg)
197 ("gettext" ,gettext-minimal)
198 ("ghostscript" ,ghostscript)
199 ("giflib:bin" ,giflib "bin")
200 ("gnumeric" ,gnumeric)
201 ("gnupg" ,gnupg)
202 ("hdf5" ,hdf5)
203 ("imagemagick" ,imagemagick)
204 ("libarchive" ,libarchive)
205 ("llvm" ,llvm)
206 ("lz4" ,lz4)
207 ("mono" ,mono)
208 ("ocaml" ,ocaml)
209 ("odt2txt" ,odt2txt)
210 ("openssh" ,openssh)
211 ("openssl" ,openssl)
212 ("pgpdump" ,pgpdump)
213 ("poppler" ,poppler)
214 ("python-jsbeautifier" ,python-jsbeautifier)
215 ("r-minimal" ,r-minimal)
216 ("rpm" ,rpm)
217 ("sng" ,sng)
218 ("sqlite" ,sqlite)
219 ("squashfs-tools" ,squashfs-tools)
220 ("tcpdump" ,tcpdump)
221 ("unzip" ,unzip)
222 ("wabt" ,wabt)
223 ("xxd" ,xxd)
224 ("xz" ,xz)
225 ("zip" ,zip)
226 ("zstd" ,zstd)))
227 (home-page "https://diffoscope.org/")
228 (synopsis "Compare files, archives, and directories in depth")
229 (description
230 "Diffoscope tries to get to the bottom of what makes files or directories
52211add
VC
231different. It recursively unpacks archives of many kinds and transforms
232various binary formats into more human readable forms to compare them. It can
f83d07f7
VC
233compare two tarballs, ISO images, or PDFs just as easily.
234
235Diffoscope has many optional dependencies; @code{diffoscope
236--list-missing-tools guix} will display optional packages to
237install.")
a0e5111e 238 (license license:gpl3+)))
52211add 239
c526ddf4
VC
240(define-public reprotest
241 (package
242 (name "reprotest")
04fd952d 243 (version "0.7.14")
c526ddf4
VC
244 (source
245 (origin
246 (method git-fetch)
247 (uri (git-reference
248 (url "https://salsa.debian.org/reproducible-builds/reprotest.git")
249 (commit version)))
250 (file-name (git-file-name name version))
c526ddf4
VC
251 (sha256
252 (base32
04fd952d 253 "12d07xq5zx5dfbsgakm6zcn7hgf0h9f5kvfjqkiyak4ix5aa6xkf"))))
c526ddf4
VC
254 (inputs
255 `(("python-debian" ,python-debian)
256 ("python-distro" ,python-distro)
257 ("python-libarchive-c", python-libarchive-c)
258 ("python-rstr" ,python-rstr)))
259 (native-inputs
260 `(("diffoscope" ,diffoscope)
261 ("help2man" ,help2man)
262 ("libfaketime" ,libfaketime)
263 ("python-coverage" ,python-coverage)
264 ("python-docutils" ,python-docutils)
265 ("python-pytest " ,python-pytest)
266 ("python-tlsh" ,python-tlsh)
267 ("python-tox" ,python-tox)
268 ("unzip" ,unzip)
269 ("xxd" ,xxd)))
270 (build-system python-build-system)
271 (arguments
272 `(#:phases
273 (modify-phases %standard-phases
274 ;; Neither glibc-locales nor glibc-utf8-locales have the C.UTF-8
275 ;; locale or several other locales used in reprotest.
276 (add-after 'unpack 'adjust-locales
277 (lambda _
278 (substitute* "reprotest/build.py"
279 (("'C.UTF-8'") "'en_US.UTF-8'")
280 (("'ru_RU.CP1251'") "'ru_RU.KOI8-R'")
281 (("'kk_KZ.RK1048'") "'kk_KZ'"))
282 (substitute* "reprotest/lib/adt_testbed.py"
283 (("export LANG=C.UTF-8") "export LANG=en_US.UTF-8"))
284 #t))
285 (add-after 'install 'install-doc
286 (lambda* (#:key outputs #:allow-other-keys)
287 (let* ((mandir1 (string-append
288 (assoc-ref outputs "out") "/share/man/man1"))
289 (docdir (string-append
290 (assoc-ref outputs "out") "/share/doc/" ,name "-" ,version)))
291 (invoke "make" "-C" "doc")
292 (mkdir-p mandir1)
293 (install-file "doc/reprotest.1" mandir1)
294 (mkdir-p docdir)
295 (install-file "./README.rst" docdir)
296 (install-file "./README-dev.rst" docdir))
297 #t)))))
298 (home-page "https://salsa.debian.org/reproducible-builds/reprotest")
299 (synopsis "Build software and check it for reproducibility")
300 (description "Reprotest builds the same source code twice in different
301environments, and then checks the binaries produced by each build for
302differences. If any are found, then diffoscope or diff is used to display
303them in detail for later analysis.")
304 (license (list license:gpl3+ license:gpl2+))))
305
52211add
VC
306(define-public trydiffoscope
307 (package
308 (name "trydiffoscope")
309 (version "67.0.1")
310 (source
311 (origin
312 (method git-fetch)
313 (uri (git-reference
314 (url "https://salsa.debian.org/reproducible-builds/trydiffoscope.git")
315 (commit version)))
316 (file-name (git-file-name name version))
317 (sha256
318 (base32
319 "03b66cjii7l2yiwffj6ym6mycd5drx7prfp4j2550281pias6mjh"))))
320 (arguments
321 `(#:phases
322 (modify-phases %standard-phases
323 (add-after 'install 'install-doc
324 (lambda* (#:key outputs #:allow-other-keys)
325 (let* ((share (string-append (assoc-ref outputs "out") "/share/")))
326 (mkdir-p (string-append share "/man/man1/" ))
327 (invoke "rst2man.py"
328 "trydiffoscope.1.rst"
329 (string-append share "/man/man1/trydiffoscope.1"))
330 (mkdir-p (string-append share "/doc/" ,name "-" ,version))
331 (install-file "./README.rst"
332 (string-append share "/doc/" ,name "-" ,version)))
333 #t)))))
334 (propagated-inputs
335 `(("python-requests" ,python-requests)))
336 (native-inputs
337 `(("gzip" ,gzip)
338 ("python-docutils" ,python-docutils)))
339 (build-system python-build-system)
340 (home-page "https://try.diffoscope.org")
341 (synopsis "Client for remote diffoscope service")
342 (description "This is a client for the @url{https://try.diffoscope.org,
343remote diffoscope service}.
344
345Diffoscope tries to get to the bottom of what makes files or directories
346different. It recursively unpacks archives of many kinds and transforms
347various binary formats into more human readable forms to compare them. It can
348compare two tarballs, ISO images, or PDFs just as easily.
349
350Results are displayed by default, stored as local text or html files, or made
351available via a URL on @url{https://try.diffoscope.org}. Results stored on the
352server are purged after 30 days.")
353 (license license:gpl3+)))