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