gnu: libretro-lowresnx: Update to 1.2.
[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")
29d2c906 75 (version "172")
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
29d2c906 84 "1lglxn9h8s7kvmfd2rsyhrcv3y8a4bppbxr9nf2sgnlbdln1vwqq"))))
a0e5111e
TGR
85 (build-system python-build-system)
86 (arguments
87 `(#:phases (modify-phases %standard-phases
a0e5111e
TGR
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))
a0e5111e
TGR
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))
afba93ef
TGR
111 (add-after 'build 'build-man-page
112 (lambda* (#:key (make-flags '()) #:allow-other-keys)
113 (apply invoke "make" "-C" "doc" make-flags)))
a0e5111e
TGR
114 (add-before 'check 'writable-test-data
115 (lambda _
afba93ef 116 ;; Tests may need write access to tests directory.
a0e5111e
TGR
117 (for-each make-file-writable (find-files "tests"))
118 #t))
119 (add-before 'check 'delete-failing-test
120 (lambda _
afba93ef 121 ;; This requires /sbin to be in $PATH.
a0e5111e 122 (delete-file "tests/test_tools.py")
afba93ef
TGR
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))))))
a0e5111e 130 (inputs `(("rpm" ,rpm) ;for rpm-python
a0e5111e
TGR
131 ("python-debian" ,python-debian)
132 ("python-libarchive-c" ,python-libarchive-c)
1e62c811 133 ("python-magic" ,python-magic)
a0e5111e
TGR
134 ("python-tlsh" ,python-tlsh)
135 ("acl" ,acl) ;for getfacl
136 ("colordiff" ,colordiff)
137 ("xxd" ,xxd)))
afba93ef
TGR
138 (native-inputs `(("help2man" ,help2man)
139 ;; Below are modules used for tests.
140 ("python-pytest" ,python-pytest)
a0e5111e
TGR
141 ("python-chardet" ,python-chardet)
142 ("python-binwalk" ,python-binwalk)
1e62c811 143 ("python-black" ,python-black)
a0e5111e
TGR
144 ("python-h5py" ,python-h5py)
145 ("python-pypdf2" ,python-pypdf2)
146 ("python-progressbar33" ,python-progressbar33)
afba93ef 147 ;; The test suite skips tests when these are missing.
a0e5111e
TGR
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
ffecb239 160 ("openjdk:jdk" ,openjdk12 "jdk")))
a0e5111e
TGR
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
52211add
VC
208different. It recursively unpacks archives of many kinds and transforms
209various binary formats into more human readable forms to compare them. It can
f83d07f7
VC
210compare two tarballs, ISO images, or PDFs just as easily.
211
212Diffoscope has many optional dependencies; @code{diffoscope
213--list-missing-tools guix} will display optional packages to
214install.")
a0e5111e 215 (license license:gpl3+)))
52211add 216
c526ddf4
VC
217(define-public reprotest
218 (package
219 (name "reprotest")
8692f0e7 220 (version "0.7.16")
c526ddf4
VC
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))
c526ddf4
VC
228 (sha256
229 (base32
8692f0e7 230 "0s7gyixk868dw6yqxsb1sq24mgg9ilz5s2yidd5j0zhl683n7dw9"))))
c526ddf4
VC
231 (inputs
232 `(("python-debian" ,python-debian)
233 ("python-distro" ,python-distro)
1628d57b 234 ("python-libarchive-c" ,python-libarchive-c)
c526ddf4
VC
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)
2e996519 242 ("python-magic " ,python-magic)
c526ddf4
VC
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
279environments, and then checks the binaries produced by each build for
280differences. If any are found, then diffoscope or diff is used to display
281them in detail for later analysis.")
282 (license (list license:gpl3+ license:gpl2+))))
283
52211add
VC
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,
321remote diffoscope service}.
322
323Diffoscope tries to get to the bottom of what makes files or directories
324different. It recursively unpacks archives of many kinds and transforms
325various binary formats into more human readable forms to compare them. It can
326compare two tarballs, ISO images, or PDFs just as easily.
327
328Results are displayed by default, stored as local text or html files, or made
329available via a URL on @url{https://try.diffoscope.org}. Results stored on the
330server are purged after 30 days.")
331 (license license:gpl3+)))