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> | |
b142611b | 3 | ;;; Copyright © 2017, 2021 Ricardo Wurmus <rekado@elephly.net> |
ad07af35 | 4 | ;;; Copyright © 2017–2022 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) | |
1f431988 | 37 | #:use-module (gnu packages file) ;for 'file-next' |
52211add VC |
38 | #:use-module (gnu packages gettext) |
39 | #:use-module (gnu packages ghostscript) | |
40 | #:use-module (gnu packages gnome) | |
41 | #:use-module (gnu packages gnupg) | |
42 | #:use-module (gnu packages haskell) | |
43 | #:use-module (gnu packages image) | |
44 | #:use-module (gnu packages imagemagick) | |
45 | #:use-module (gnu packages java) | |
46 | #:use-module (gnu packages linux) | |
47 | #:use-module (gnu packages llvm) | |
c526ddf4 | 48 | #:use-module (gnu packages man) |
2cc226bb | 49 | #:use-module (gnu packages maths) |
52211add | 50 | #:use-module (gnu packages mono) |
3fb581ca | 51 | #:use-module (gnu packages ocaml) |
52211add | 52 | #:use-module (gnu packages package-management) |
af4ce7bd | 53 | #:use-module (gnu packages pascal) |
52211add VC |
54 | #:use-module (gnu packages patchutils) |
55 | #:use-module (gnu packages pdf) | |
56 | #:use-module (gnu packages python-web) | |
57 | #:use-module (gnu packages python-xyz) | |
58 | #:use-module (gnu packages sqlite) | |
59 | #:use-module (gnu packages ssh) | |
3244b64f | 60 | #:use-module (gnu packages statistics) |
52211add | 61 | #:use-module (gnu packages textutils) |
ac4fefb2 | 62 | #:use-module (gnu packages tls) |
52211add VC |
63 | #:use-module (gnu packages video) |
64 | #:use-module (gnu packages vim) | |
4d83157c | 65 | #:use-module (gnu packages web) |
52211add VC |
66 | #:use-module (guix build-system python) |
67 | #:use-module (guix gexp) | |
68 | #:use-module (guix git-download) | |
69 | #:use-module ((guix licenses) #:prefix license:) | |
70 | #:use-module (guix packages) | |
aaeb2b34 VC |
71 | #:use-module (guix utils) |
72 | #:use-module (ice-9 match)) | |
52211add VC |
73 | |
74 | (define-public diffoscope | |
a0e5111e TGR |
75 | (package |
76 | (name "diffoscope") | |
27173611 | 77 | (version "215") |
9f55a39c TGR |
78 | (source |
79 | (origin | |
80 | (method git-fetch) | |
81 | (uri (git-reference | |
82 | (url "https://salsa.debian.org/reproducible-builds/diffoscope.git") | |
83 | (commit version))) | |
84 | (file-name (git-file-name name version)) | |
85 | (sha256 | |
27173611 | 86 | (base32 "16pyqbyrfsxjnpmr9913x2brz3mxplhz62rxwix1c0p7afwjw835")) |
9f55a39c | 87 | (patches |
af4ce7bd | 88 | (search-patches "diffoscope-fix-llvm-test.patch")))) |
a0e5111e TGR |
89 | (build-system python-build-system) |
90 | (arguments | |
91 | `(#:phases (modify-phases %standard-phases | |
b142611b RW |
92 | ;; These tests are broken because our `file` package has a |
93 | ;; bug in berkeley-db and wasm file type detection. | |
94 | (add-after 'unpack 'remove-broken-file-type-detection-test | |
a0e5111e | 95 | (lambda _ |
b142611b RW |
96 | (delete-file "tests/comparators/test_berkeley_db.py") |
97 | (delete-file "tests/comparators/test_wasm.py"))) | |
a0e5111e TGR |
98 | (add-after 'unpack 'embed-tool-references |
99 | (lambda* (#:key inputs #:allow-other-keys) | |
100 | (substitute* "diffoscope/comparators/utils/compare.py" | |
1d722259 VC |
101 | (("\\[\"xxd\",") |
102 | (string-append "[\"" (which "xxd") "\","))) | |
103 | (substitute* "diffoscope/diff.py" | |
104 | (("@tool_required\\(\"diff\"\\)") "") | |
105 | (("get_tool_name\\(\"diff\"\\)") | |
106 | (string-append "get_tool_name(\"" (which "diff") "\")"))) | |
a0e5111e | 107 | (substitute* "diffoscope/comparators/directory.py" |
1d722259 VC |
108 | (("@tool_required\\(\"stat\"\\)") "") |
109 | (("@tool_required\\(\"getfacl\"\\)") "") | |
110 | (("\\[\"stat\",") | |
111 | (string-append "[\"" (which "stat") "\",")) | |
112 | (("\\[\"getfacl\",") | |
113 | (string-append "[\"" (which "getfacl") "\","))))) | |
afba93ef TGR |
114 | (add-after 'build 'build-man-page |
115 | (lambda* (#:key (make-flags '()) #:allow-other-keys) | |
116 | (apply invoke "make" "-C" "doc" make-flags))) | |
a0e5111e TGR |
117 | (add-before 'check 'writable-test-data |
118 | (lambda _ | |
afba93ef | 119 | ;; Tests may need write access to tests directory. |
9f55a39c TGR |
120 | (for-each make-file-writable (find-files "tests")))) |
121 | (add-before 'check 'fix-failing-test | |
122 | (lambda _ | |
123 | ;; There is no user name mapping in the build environment. | |
124 | ;; Pytest made it so much harder than should be necessary, | |
125 | ;; so I'm leaving… this here in case I ever need it again: | |
126 | ;; (substitute* "tests/comparators/test_squashfs.py" | |
127 | ;; (("^def test_symlink_root.*" match) ; no, I don't | |
128 | ;; (string-append ; know Python | |
129 | ;; match "\n raise ValueError(" ; why do you | |
130 | ;; "differences_root[1].unified_diff)\n"))) ; ask | |
131 | (substitute* "tests/data/squashfs_root_expected_diff" | |
132 | (("root/root") | |
133 | '"0/0 ")))) | |
a0e5111e | 134 | (add-before 'check 'delete-failing-test |
9f55a39c | 135 | ;; Please add new tests to fix-failing-test and not here ;-) |
a0e5111e | 136 | (lambda _ |
afba93ef | 137 | ;; This requires /sbin to be in $PATH. |
9f55a39c | 138 | (delete-file "tests/test_tools.py"))) |
afba93ef TGR |
139 | (add-after 'install 'install-man-page |
140 | (lambda* (#:key outputs #:allow-other-keys) | |
141 | (let* ((out (assoc-ref outputs "out")) | |
142 | (man (string-append out "/share/man/man1"))) | |
9f55a39c | 143 | (install-file "doc/diffoscope.1" man))))))) |
8394619b LC |
144 | (inputs (list rpm ;for rpm-python |
145 | python-debian | |
146 | python-libarchive-c | |
147 | python-magic | |
148 | python-tlsh | |
149 | acl ;for getfacl | |
1d722259 VC |
150 | coreutils ;for stat |
151 | diffutils ;for diff | |
8394619b | 152 | xxd)) |
b3a0db7a TGR |
153 | (native-inputs |
154 | (append | |
155 | (list help2man | |
1f431988 | 156 | |
b3a0db7a TGR |
157 | ;; Below are packages used for tests. |
158 | binwalk | |
159 | python-pytest | |
160 | python-chardet | |
b3a0db7a TGR |
161 | python-h5py |
162 | python-pypdf2 | |
163 | python-progressbar33 | |
1f431988 | 164 | |
b3a0db7a TGR |
165 | abootimg |
166 | bdb | |
167 | binutils | |
168 | bzip2 | |
169 | cdrtools | |
170 | colord | |
171 | cpio | |
172 | docx2txt | |
173 | dtc | |
174 | e2fsprogs | |
175 | ffmpeg | |
176 | ||
177 | ;; XXX: Must be the same version as python-magic uses; | |
178 | ;; remove when 'file' is updated. | |
179 | file-next | |
180 | ||
181 | fpc | |
182 | gettext-minimal | |
183 | ghostscript | |
184 | `(,giflib "bin") | |
185 | gnumeric | |
186 | gnupg | |
187 | hdf5 | |
188 | imagemagick | |
189 | libarchive | |
4ed2b6ac | 190 | llvm-9 |
b3a0db7a TGR |
191 | lz4 |
192 | mono | |
193 | ocaml | |
194 | odt2txt | |
195 | openssh | |
196 | openssl | |
197 | pgpdump | |
198 | poppler | |
199 | python-jsbeautifier | |
200 | r-minimal | |
201 | rpm | |
202 | sng | |
203 | sqlite | |
204 | squashfs-tools | |
205 | tcpdump | |
206 | unzip | |
207 | wabt | |
208 | xxd | |
209 | xz | |
210 | zip | |
211 | zstd) | |
212 | ||
213 | ;; Also for tests. The test suite skips tests when these are missing. | |
214 | (match (%current-system) | |
215 | ;; ghc is only available on x86 currently. | |
216 | ((or "x86_64-linux" "i686-linux") | |
217 | (list ghc)) | |
218 | (_ '())) | |
219 | (match (%current-system) | |
220 | ;; openjdk and dependent packages are only | |
221 | ;; available on x86_64 currently. | |
222 | ((or "x86_64-linux") | |
223 | (list enjarify) | |
224 | ;; No unversioned openjdk available. | |
225 | (list `(,openjdk12 "jdk"))) | |
226 | (_ '())))) | |
a0e5111e TGR |
227 | (home-page "https://diffoscope.org/") |
228 | (synopsis "Compare files, archives, and directories in depth") | |
229 | (description | |
230 | "Diffoscope tries to get to the bottom of what makes files or directories | |
52211add VC |
231 | different. It recursively unpacks archives of many kinds and transforms |
232 | various binary formats into more human readable forms to compare them. It can | |
f83d07f7 VC |
233 | compare two tarballs, ISO images, or PDFs just as easily. |
234 | ||
235 | Diffoscope has many optional dependencies; @code{diffoscope | |
236 | --list-missing-tools guix} will display optional packages to | |
237 | install.") | |
a0e5111e | 238 | (license license:gpl3+))) |
52211add | 239 | |
c526ddf4 VC |
240 | (define-public reprotest |
241 | (package | |
242 | (name "reprotest") | |
a720c900 | 243 | (version "0.7.20") |
c526ddf4 VC |
244 | (source |
245 | (origin | |
246 | (method git-fetch) | |
247 | (uri (git-reference | |
248 | (url "https://salsa.debian.org/reproducible-builds/reprotest.git") | |
249 | (commit version))) | |
250 | (file-name (git-file-name name version)) | |
c526ddf4 VC |
251 | (sha256 |
252 | (base32 | |
a720c900 | 253 | "0c3nyiha9gh1xzl0dn9ji2yqa8y06d83v84pz0dqanihm40ljjsm")))) |
c526ddf4 | 254 | (inputs |
8394619b | 255 | (list python-debian python-distro python-libarchive-c python-rstr)) |
c526ddf4 VC |
256 | (native-inputs |
257 | `(("diffoscope" ,diffoscope) | |
258 | ("help2man" ,help2man) | |
259 | ("libfaketime" ,libfaketime) | |
260 | ("python-coverage" ,python-coverage) | |
261 | ("python-docutils" ,python-docutils) | |
2e996519 | 262 | ("python-magic " ,python-magic) |
c526ddf4 VC |
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 | |
8394619b | 333 | (list python-requests)) |
52211add | 334 | (native-inputs |
8394619b | 335 | (list gzip python-docutils)) |
52211add VC |
336 | (build-system python-build-system) |
337 | (home-page "https://try.diffoscope.org") | |
338 | (synopsis "Client for remote diffoscope service") | |
339 | (description "This is a client for the @url{https://try.diffoscope.org, | |
340 | remote diffoscope service}. | |
341 | ||
342 | Diffoscope tries to get to the bottom of what makes files or directories | |
343 | different. It recursively unpacks archives of many kinds and transforms | |
344 | various binary formats into more human readable forms to compare them. It can | |
345 | compare two tarballs, ISO images, or PDFs just as easily. | |
346 | ||
347 | Results are displayed by default, stored as local text or html files, or made | |
348 | available via a URL on @url{https://try.diffoscope.org}. Results stored on the | |
349 | server are purged after 30 days.") | |
350 | (license license:gpl3+))) |