gnu: emacs-svg-icon: Fix grammar.
[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 "172")
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 "1lglxn9h8s7kvmfd2rsyhrcv3y8a4bppbxr9nf2sgnlbdln1vwqq"))))
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-after 'install 'install-man-page
125 (lambda* (#:key outputs #:allow-other-keys)
126 (let* ((out (assoc-ref outputs "out"))
127 (man (string-append out "/share/man/man1")))
128 (install-file "doc/diffoscope.1" man)
129 #t))))))
130 (inputs `(("rpm" ,rpm) ;for rpm-python
131 ("python-debian" ,python-debian)
132 ("python-libarchive-c" ,python-libarchive-c)
133 ("python-magic" ,python-magic)
134 ("python-tlsh" ,python-tlsh)
135 ("acl" ,acl) ;for getfacl
136 ("colordiff" ,colordiff)
137 ("xxd" ,xxd)))
138 (native-inputs `(("help2man" ,help2man)
139 ;; Below are modules used for tests.
140 ("python-pytest" ,python-pytest)
141 ("python-chardet" ,python-chardet)
142 ("python-binwalk" ,python-binwalk)
143 ("python-black" ,python-black)
144 ("python-h5py" ,python-h5py)
145 ("python-pypdf2" ,python-pypdf2)
146 ("python-progressbar33" ,python-progressbar33)
147 ;; The test suite skips tests when these are missing.
148 ,@(match (%current-system)
149 ;; ghc is only available on x86 currently.
150 ((or "x86_64-linux" "i686-linux")
151 `(("ghc" ,ghc)))
152 (_
153 `()))
154 ,@(match (%current-system)
155 ;; openjdk and dependent packages are only
156 ;; available on x86_64 currently.
157 ((or "x86_64-linux")
158 `(("enjarify" ,enjarify)
159 ;; no unversioned openjdk available
160 ("openjdk:jdk" ,openjdk12 "jdk")))
161 (_
162 `()))
163 ("abootimg" ,abootimg)
164 ("bdb" ,bdb)
165 ("binutils" ,binutils)
166 ("bzip2" ,bzip2)
167 ("cdrtools" ,cdrtools)
168 ("colord" ,colord)
169 ("cpio" ,cpio)
170 ("docx2txt" ,docx2txt)
171 ("dtc" ,dtc)
172 ("e2fsprogs" ,e2fsprogs)
173 ("ffmpeg" ,ffmpeg)
174 ("gettext" ,gettext-minimal)
175 ("ghostscript" ,ghostscript)
176 ("giflib:bin" ,giflib "bin")
177 ("gnumeric" ,gnumeric)
178 ("gnupg" ,gnupg)
179 ("hdf5" ,hdf5)
180 ("imagemagick" ,imagemagick)
181 ("libarchive" ,libarchive)
182 ("llvm" ,llvm)
183 ("lz4" ,lz4)
184 ("mono" ,mono)
185 ("ocaml" ,ocaml)
186 ("odt2txt" ,odt2txt)
187 ("openssh" ,openssh)
188 ("openssl" ,openssl)
189 ("pgpdump" ,pgpdump)
190 ("poppler" ,poppler)
191 ("python-jsbeautifier" ,python-jsbeautifier)
192 ("r-minimal" ,r-minimal)
193 ("rpm" ,rpm)
194 ("sng" ,sng)
195 ("sqlite" ,sqlite)
196 ("squashfs-tools" ,squashfs-tools)
197 ("tcpdump" ,tcpdump)
198 ("unzip" ,unzip)
199 ("wabt" ,wabt)
200 ("xxd" ,xxd)
201 ("xz" ,xz)
202 ("zip" ,zip)
203 ("zstd" ,zstd)))
204 (home-page "https://diffoscope.org/")
205 (synopsis "Compare files, archives, and directories in depth")
206 (description
207 "Diffoscope tries to get to the bottom of what makes files or directories
208 different. It recursively unpacks archives of many kinds and transforms
209 various binary formats into more human readable forms to compare them. It can
210 compare two tarballs, ISO images, or PDFs just as easily.
211
212 Diffoscope has many optional dependencies; @code{diffoscope
213 --list-missing-tools guix} will display optional packages to
214 install.")
215 (license license:gpl3+)))
216
217 (define-public reprotest
218 (package
219 (name "reprotest")
220 (version "0.7.16")
221 (source
222 (origin
223 (method git-fetch)
224 (uri (git-reference
225 (url "https://salsa.debian.org/reproducible-builds/reprotest.git")
226 (commit version)))
227 (file-name (git-file-name name version))
228 (sha256
229 (base32
230 "0s7gyixk868dw6yqxsb1sq24mgg9ilz5s2yidd5j0zhl683n7dw9"))))
231 (inputs
232 `(("python-debian" ,python-debian)
233 ("python-distro" ,python-distro)
234 ("python-libarchive-c" ,python-libarchive-c)
235 ("python-rstr" ,python-rstr)))
236 (native-inputs
237 `(("diffoscope" ,diffoscope)
238 ("help2man" ,help2man)
239 ("libfaketime" ,libfaketime)
240 ("python-coverage" ,python-coverage)
241 ("python-docutils" ,python-docutils)
242 ("python-magic " ,python-magic)
243 ("python-pytest " ,python-pytest)
244 ("python-tlsh" ,python-tlsh)
245 ("python-tox" ,python-tox)
246 ("unzip" ,unzip)
247 ("xxd" ,xxd)))
248 (build-system python-build-system)
249 (arguments
250 `(#:phases
251 (modify-phases %standard-phases
252 ;; Neither glibc-locales nor glibc-utf8-locales have the C.UTF-8
253 ;; locale or several other locales used in reprotest.
254 (add-after 'unpack 'adjust-locales
255 (lambda _
256 (substitute* "reprotest/build.py"
257 (("'C.UTF-8'") "'en_US.UTF-8'")
258 (("'ru_RU.CP1251'") "'ru_RU.KOI8-R'")
259 (("'kk_KZ.RK1048'") "'kk_KZ'"))
260 (substitute* "reprotest/lib/adt_testbed.py"
261 (("export LANG=C.UTF-8") "export LANG=en_US.UTF-8"))
262 #t))
263 (add-after 'install 'install-doc
264 (lambda* (#:key outputs #:allow-other-keys)
265 (let* ((mandir1 (string-append
266 (assoc-ref outputs "out") "/share/man/man1"))
267 (docdir (string-append
268 (assoc-ref outputs "out") "/share/doc/" ,name "-" ,version)))
269 (invoke "make" "-C" "doc")
270 (mkdir-p mandir1)
271 (install-file "doc/reprotest.1" mandir1)
272 (mkdir-p docdir)
273 (install-file "./README.rst" docdir)
274 (install-file "./README-dev.rst" docdir))
275 #t)))))
276 (home-page "https://salsa.debian.org/reproducible-builds/reprotest")
277 (synopsis "Build software and check it for reproducibility")
278 (description "Reprotest builds the same source code twice in different
279 environments, and then checks the binaries produced by each build for
280 differences. If any are found, then diffoscope or diff is used to display
281 them in detail for later analysis.")
282 (license (list license:gpl3+ license:gpl2+))))
283
284 (define-public trydiffoscope
285 (package
286 (name "trydiffoscope")
287 (version "67.0.1")
288 (source
289 (origin
290 (method git-fetch)
291 (uri (git-reference
292 (url "https://salsa.debian.org/reproducible-builds/trydiffoscope.git")
293 (commit version)))
294 (file-name (git-file-name name version))
295 (sha256
296 (base32
297 "03b66cjii7l2yiwffj6ym6mycd5drx7prfp4j2550281pias6mjh"))))
298 (arguments
299 `(#:phases
300 (modify-phases %standard-phases
301 (add-after 'install 'install-doc
302 (lambda* (#:key outputs #:allow-other-keys)
303 (let* ((share (string-append (assoc-ref outputs "out") "/share/")))
304 (mkdir-p (string-append share "/man/man1/" ))
305 (invoke "rst2man.py"
306 "trydiffoscope.1.rst"
307 (string-append share "/man/man1/trydiffoscope.1"))
308 (mkdir-p (string-append share "/doc/" ,name "-" ,version))
309 (install-file "./README.rst"
310 (string-append share "/doc/" ,name "-" ,version)))
311 #t)))))
312 (propagated-inputs
313 `(("python-requests" ,python-requests)))
314 (native-inputs
315 `(("gzip" ,gzip)
316 ("python-docutils" ,python-docutils)))
317 (build-system python-build-system)
318 (home-page "https://try.diffoscope.org")
319 (synopsis "Client for remote diffoscope service")
320 (description "This is a client for the @url{https://try.diffoscope.org,
321 remote diffoscope service}.
322
323 Diffoscope tries to get to the bottom of what makes files or directories
324 different. It recursively unpacks archives of many kinds and transforms
325 various binary formats into more human readable forms to compare them. It can
326 compare two tarballs, ISO images, or PDFs just as easily.
327
328 Results are displayed by default, stored as local text or html files, or made
329 available via a URL on @url{https://try.diffoscope.org}. Results stored on the
330 server are purged after 30 days.")
331 (license license:gpl3+)))