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> | |
4 | ;;; Copyright © 2017, 2018, 2019 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) | |
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) | |
47 | #:use-module (gnu packages mono) | |
3fb581ca | 48 | #:use-module (gnu packages ocaml) |
52211add VC |
49 | #:use-module (gnu packages package-management) |
50 | #:use-module (gnu packages patchutils) | |
51 | #:use-module (gnu packages pdf) | |
52 | #:use-module (gnu packages python-web) | |
53 | #:use-module (gnu packages python-xyz) | |
54 | #:use-module (gnu packages sqlite) | |
55 | #:use-module (gnu packages ssh) | |
3244b64f | 56 | #:use-module (gnu packages statistics) |
52211add VC |
57 | #:use-module (gnu packages textutils) |
58 | #:use-module (gnu packages video) | |
59 | #:use-module (gnu packages vim) | |
4d83157c | 60 | #:use-module (gnu packages web) |
52211add VC |
61 | #:use-module (guix build-system python) |
62 | #:use-module (guix gexp) | |
63 | #:use-module (guix git-download) | |
64 | #:use-module ((guix licenses) #:prefix license:) | |
65 | #:use-module (guix packages) | |
aaeb2b34 VC |
66 | #:use-module (guix utils) |
67 | #:use-module (ice-9 match)) | |
52211add VC |
68 | |
69 | (define-public diffoscope | |
6a65185e | 70 | (let ((version "133")) |
52211add VC |
71 | (package |
72 | (name "diffoscope") | |
73 | (version version) | |
74 | (source (origin | |
75 | (method git-fetch) | |
76 | (uri (git-reference | |
77 | (url "https://salsa.debian.org/reproducible-builds/diffoscope.git") | |
78 | (commit version))) | |
79 | (file-name (git-file-name name version)) | |
80 | (sha256 | |
81 | (base32 | |
6a65185e | 82 | "0mvg5iyd3zjxsm66vax3qb89214j3wxcklvbhfrr8jlbzaw9pznh")))) |
52211add VC |
83 | (build-system python-build-system) |
84 | (arguments | |
85 | `(#:phases (modify-phases %standard-phases | |
86 | ;; setup.py mistakenly requires python-magic from PyPi, even | |
87 | ;; though the Python bindings of `file` are sufficient. | |
88 | ;; https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815844 | |
89 | (add-after 'unpack 'dependency-on-python-magic | |
90 | (lambda _ | |
91 | (substitute* "setup.py" | |
92 | (("'python-magic',") "")))) | |
bc685e1c VC |
93 | ;; Patch in support for known tools |
94 | (add-after 'unpack 'add-known-tools | |
95 | (lambda _ | |
96 | (substitute* "diffoscope/external_tools.py" | |
97 | (("'debian': 'zstd'") | |
98 | "'debian': 'zstd', 'guix': 'zstd'")))) | |
52211add VC |
99 | ;; This test is broken because our `file` package has a |
100 | ;; bug in berkeley-db file type detection. | |
101 | (add-after 'unpack 'remove-berkeley-test | |
102 | (lambda _ | |
103 | (delete-file "tests/comparators/test_berkeley_db.py") | |
104 | #t)) | |
105 | ;; Test is dynamically generated and may have false | |
106 | ;; negatives with different ocaml versions. Further | |
107 | ;; background in: https://bugs.debian.org/939386 | |
108 | (add-after 'unpack 'remove-ocaml-test | |
109 | (lambda _ | |
3fb581ca VC |
110 | (substitute* "tests/comparators/test_ocaml.py" |
111 | (("def test_diff.differences.:") | |
112 | "def skip_test_diff(differences):")) | |
113 | #t)) | |
114 | (add-after 'unpack 'skip-elf-tests | |
115 | ;; FIXME: libmix_differences test added in 125, and is | |
116 | ;; failing, need to explore why... | |
117 | (lambda _ | |
118 | (substitute* "tests/comparators/test_elf.py" | |
119 | (("def test_libmix_differences.libmix_differences.:") | |
120 | "def skip_test_libmix_differences(libmix_differences):")) | |
52211add VC |
121 | #t)) |
122 | (add-after 'unpack 'embed-tool-references | |
123 | (lambda* (#:key inputs #:allow-other-keys) | |
124 | (substitute* "diffoscope/comparators/utils/compare.py" | |
125 | (("\\['xxd',") | |
126 | (string-append "['" (which "xxd") "',"))) | |
127 | (substitute* "diffoscope/comparators/elf.py" | |
128 | (("@tool_required\\('readelf'\\)") "") | |
129 | (("get_tool_name\\('readelf'\\)") | |
130 | (string-append "'" (which "readelf") "'"))) | |
131 | (substitute* "diffoscope/comparators/directory.py" | |
132 | (("@tool_required\\('stat'\\)") "") | |
133 | (("@tool_required\\('getfacl'\\)") "") | |
134 | (("\\['stat',") | |
135 | (string-append "['" (which "stat") "',")) | |
136 | (("\\['getfacl',") | |
137 | (string-append "['" (which "getfacl") "',"))) | |
138 | #t)) | |
139 | (add-before 'check 'writable-test-data | |
140 | (lambda _ | |
141 | ;; tests may need needs write access to tests | |
142 | ;; directory | |
143 | (for-each make-file-writable (find-files "tests")) | |
144 | #t)) | |
145 | (add-before 'check 'delete-failing-test | |
146 | (lambda _ | |
147 | ;; this requires /sbin to be on the path | |
148 | (delete-file "tests/test_tools.py") | |
149 | #t))))) | |
150 | (inputs `(("rpm" ,rpm) ;for rpm-python | |
151 | ("python-file" ,python-file) | |
152 | ("python-debian" ,python-debian) | |
153 | ("python-libarchive-c" ,python-libarchive-c) | |
154 | ("python-tlsh" ,python-tlsh) | |
155 | ("acl" ,acl) ;for getfacl | |
156 | ("colordiff" ,colordiff) | |
157 | ("xxd" ,xxd))) | |
158 | ;; Below are modules used for tests. | |
159 | (native-inputs `(("python-pytest" ,python-pytest) | |
160 | ("python-chardet" ,python-chardet) | |
f315673d | 161 | ("python-binwalk" ,python-binwalk) |
36f5f23c VC |
162 | ("python-pypdf2" ,python-pypdf2) |
163 | ("python-progressbar33" ,python-progressbar33) | |
52211add | 164 | ;; test suite skips tests when tool is missing |
aaeb2b34 VC |
165 | ,@(match (%current-system) |
166 | ;; ghc is only available on x86 currently. | |
167 | ((or "x86_64-linux" "i686-linux") | |
168 | `(("ghc" ,ghc))) | |
169 | (_ | |
170 | `())) | |
171 | ,@(match (%current-system) | |
172 | ;; openjdk and dependent packages are only | |
173 | ;; available on x86_64 currently. | |
174 | ((or "x86_64-linux") | |
175 | `(("enjarify" ,enjarify) | |
176 | ;; no unversioned openjdk available | |
177 | ("openjdk:jdk" ,openjdk12 "jdk") | |
178 | )) | |
179 | (_ | |
180 | `())) | |
3244b64f | 181 | ("abootimg" ,abootimg) |
52211add VC |
182 | ("bdb" ,bdb) |
183 | ("binutils" ,binutils) | |
184 | ("bzip2" ,bzip2) | |
185 | ("cdrtools" ,cdrtools) | |
186 | ("colord" ,colord) | |
187 | ("cpio" ,cpio) | |
188 | ("docx2txt" ,docx2txt) | |
3244b64f | 189 | ("dtc" ,dtc) |
52211add VC |
190 | ("e2fsprogs" ,e2fsprogs) |
191 | ("ffmpeg" ,ffmpeg) | |
192 | ("gettext" ,gettext-minimal) | |
52211add VC |
193 | ("ghostscript" ,ghostscript) |
194 | ("giflib:bin" ,giflib "bin") | |
195 | ("gnumeric" ,gnumeric) | |
196 | ("gnupg" ,gnupg) | |
197 | ("imagemagick" ,imagemagick) | |
198 | ("libarchive" ,libarchive) | |
199 | ("llvm" ,llvm) | |
200 | ("lz4" ,lz4) | |
201 | ("mono" ,mono) | |
3fb581ca | 202 | ("ocaml" ,ocaml) |
52211add | 203 | ("odt2txt" ,odt2txt) |
52211add VC |
204 | ("openssh" ,openssh) |
205 | ("pgpdump" ,pgpdump) | |
206 | ("poppler" ,poppler) | |
6ec87223 | 207 | ("python-jsbeautifier" ,python-jsbeautifier) |
3244b64f | 208 | ("r-minimal" ,r-minimal) |
52211add VC |
209 | ("rpm" ,rpm) |
210 | ("sng" ,sng) | |
211 | ("sqlite" ,sqlite) | |
212 | ("squashfs-tools" ,squashfs-tools) | |
213 | ("tcpdump" ,tcpdump) | |
214 | ("unzip" ,unzip) | |
4d83157c | 215 | ("wabt" ,wabt) |
52211add VC |
216 | ("xxd" ,xxd) |
217 | ("xz" ,xz) | |
bc685e1c VC |
218 | ("zip" ,zip) |
219 | ("zstd" ,zstd))) | |
52211add VC |
220 | (home-page "https://diffoscope.org/") |
221 | (synopsis "Compare files, archives, and directories in depth") | |
222 | (description | |
223 | "Diffoscope tries to get to the bottom of what makes files or directories | |
224 | different. It recursively unpacks archives of many kinds and transforms | |
225 | various binary formats into more human readable forms to compare them. It can | |
226 | compare two tarballs, ISO images, or PDFs just as easily.") | |
227 | (license license:gpl3+)))) | |
228 | ||
229 | (define-public trydiffoscope | |
230 | (package | |
231 | (name "trydiffoscope") | |
232 | (version "67.0.1") | |
233 | (source | |
234 | (origin | |
235 | (method git-fetch) | |
236 | (uri (git-reference | |
237 | (url "https://salsa.debian.org/reproducible-builds/trydiffoscope.git") | |
238 | (commit version))) | |
239 | (file-name (git-file-name name version)) | |
240 | (sha256 | |
241 | (base32 | |
242 | "03b66cjii7l2yiwffj6ym6mycd5drx7prfp4j2550281pias6mjh")))) | |
243 | (arguments | |
244 | `(#:phases | |
245 | (modify-phases %standard-phases | |
246 | (add-after 'install 'install-doc | |
247 | (lambda* (#:key outputs #:allow-other-keys) | |
248 | (let* ((share (string-append (assoc-ref outputs "out") "/share/"))) | |
249 | (mkdir-p (string-append share "/man/man1/" )) | |
250 | (invoke "rst2man.py" | |
251 | "trydiffoscope.1.rst" | |
252 | (string-append share "/man/man1/trydiffoscope.1")) | |
253 | (mkdir-p (string-append share "/doc/" ,name "-" ,version)) | |
254 | (install-file "./README.rst" | |
255 | (string-append share "/doc/" ,name "-" ,version))) | |
256 | #t))))) | |
257 | (propagated-inputs | |
258 | `(("python-requests" ,python-requests))) | |
259 | (native-inputs | |
260 | `(("gzip" ,gzip) | |
261 | ("python-docutils" ,python-docutils))) | |
262 | (build-system python-build-system) | |
263 | (home-page "https://try.diffoscope.org") | |
264 | (synopsis "Client for remote diffoscope service") | |
265 | (description "This is a client for the @url{https://try.diffoscope.org, | |
266 | remote diffoscope service}. | |
267 | ||
268 | Diffoscope tries to get to the bottom of what makes files or directories | |
269 | different. It recursively unpacks archives of many kinds and transforms | |
270 | various binary formats into more human readable forms to compare them. It can | |
271 | compare two tarballs, ISO images, or PDFs just as easily. | |
272 | ||
273 | Results are displayed by default, stored as local text or html files, or made | |
274 | available via a URL on @url{https://try.diffoscope.org}. Results stored on the | |
275 | server are purged after 30 days.") | |
276 | (license license:gpl3+))) |