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