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