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, 2020 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>
9 ;;; This file is part of GNU Guix.
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.
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.
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/>.
24 (define-module (gnu packages diffoscope)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages acl)
27 #:use-module (gnu packages admin)
28 #:use-module (gnu packages android)
29 #:use-module (gnu packages backup)
30 #:use-module (gnu packages base)
31 #:use-module (gnu packages bootloaders)
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 man)
48 #:use-module (gnu packages maths)
49 #:use-module (gnu packages mono)
50 #:use-module (gnu packages ocaml)
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)
58 #:use-module (gnu packages statistics)
59 #:use-module (gnu packages textutils)
60 #:use-module (gnu packages tls)
61 #:use-module (gnu packages video)
62 #:use-module (gnu packages vim)
63 #:use-module (gnu packages web)
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)
69 #:use-module (guix utils)
70 #:use-module (ice-9 match))
72 (define-public diffoscope
79 (url "https://salsa.debian.org/reproducible-builds/diffoscope.git")
81 (file-name (git-file-name name version))
84 "1lglxn9h8s7kvmfd2rsyhrcv3y8a4bppbxr9nf2sgnlbdln1vwqq"))))
85 (build-system python-build-system)
87 `(#:phases (modify-phases %standard-phases
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
92 (delete-file "tests/comparators/test_berkeley_db.py")
94 (add-after 'unpack 'embed-tool-references
95 (lambda* (#:key inputs #:allow-other-keys)
96 (substitute* "diffoscope/comparators/utils/compare.py"
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'\\)") "")
107 (string-append "['" (which "stat") "',"))
109 (string-append "['" (which "getfacl") "',")))
111 (add-after 'build 'build-man-page
112 (lambda* (#:key (make-flags '()) #:allow-other-keys)
113 (apply invoke "make" "-C" "doc" make-flags)))
114 (add-before 'check 'writable-test-data
116 ;; Tests may need write access to tests directory.
117 (for-each make-file-writable (find-files "tests"))
119 (add-before 'check 'delete-failing-test
121 ;; This requires /sbin to be in $PATH.
122 (delete-file "tests/test_tools.py")
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)
130 (inputs `(("rpm" ,rpm) ;for rpm-python
131 ("python-debian" ,python-debian)
132 ("python-libarchive-c" ,python-libarchive-c)
133 ("python-magic" ,python-magic)
134 ("python-tlsh" ,python-tlsh)
135 ("acl" ,acl) ;for getfacl
136 ("colordiff" ,colordiff)
138 (native-inputs `(("help2man" ,help2man)
139 ;; Below are modules used for tests.
140 ("python-pytest" ,python-pytest)
141 ("python-chardet" ,python-chardet)
142 ("python-binwalk" ,python-binwalk)
143 ("python-black" ,python-black)
144 ("python-h5py" ,python-h5py)
145 ("python-pypdf2" ,python-pypdf2)
146 ("python-progressbar33" ,python-progressbar33)
147 ;; The test suite skips tests when these are missing.
148 ,@(match (%current-system)
149 ;; ghc is only available on x86 currently.
150 ((or "x86_64-linux" "i686-linux")
154 ,@(match (%current-system)
155 ;; openjdk and dependent packages are only
156 ;; available on x86_64 currently.
158 `(("enjarify" ,enjarify)
159 ;; no unversioned openjdk available
160 ("openjdk:jdk" ,openjdk12 "jdk")))
163 ("abootimg" ,abootimg)
165 ("binutils" ,binutils)
167 ("cdrtools" ,cdrtools)
170 ("docx2txt" ,docx2txt)
172 ("e2fsprogs" ,e2fsprogs)
174 ("gettext" ,gettext-minimal)
175 ("ghostscript" ,ghostscript)
176 ("giflib:bin" ,giflib "bin")
177 ("gnumeric" ,gnumeric)
180 ("imagemagick" ,imagemagick)
181 ("libarchive" ,libarchive)
191 ("python-jsbeautifier" ,python-jsbeautifier)
192 ("r-minimal" ,r-minimal)
196 ("squashfs-tools" ,squashfs-tools)
204 (home-page "https://diffoscope.org/")
205 (synopsis "Compare files, archives, and directories in depth")
207 "Diffoscope tries to get to the bottom of what makes files or directories
208 different. It recursively unpacks archives of many kinds and transforms
209 various binary formats into more human readable forms to compare them. It can
210 compare two tarballs, ISO images, or PDFs just as easily.
212 Diffoscope has many optional dependencies; @code{diffoscope
213 --list-missing-tools guix} will display optional packages to
215 (license license:gpl3+)))
217 (define-public reprotest
225 (url "https://salsa.debian.org/reproducible-builds/reprotest.git")
227 (file-name (git-file-name name version))
230 "0s7gyixk868dw6yqxsb1sq24mgg9ilz5s2yidd5j0zhl683n7dw9"))))
232 `(("python-debian" ,python-debian)
233 ("python-distro" ,python-distro)
234 ("python-libarchive-c" ,python-libarchive-c)
235 ("python-rstr" ,python-rstr)))
237 `(("diffoscope" ,diffoscope)
238 ("help2man" ,help2man)
239 ("libfaketime" ,libfaketime)
240 ("python-coverage" ,python-coverage)
241 ("python-docutils" ,python-docutils)
242 ("python-magic " ,python-magic)
243 ("python-pytest " ,python-pytest)
244 ("python-tlsh" ,python-tlsh)
245 ("python-tox" ,python-tox)
248 (build-system python-build-system)
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
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"))
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")
271 (install-file "doc/reprotest.1" mandir1)
273 (install-file "./README.rst" docdir)
274 (install-file "./README-dev.rst" docdir))
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
279 environments, and then checks the binaries produced by each build for
280 differences. If any are found, then diffoscope or diff is used to display
281 them in detail for later analysis.")
282 (license (list license:gpl3+ license:gpl2+))))
284 (define-public trydiffoscope
286 (name "trydiffoscope")
292 (url "https://salsa.debian.org/reproducible-builds/trydiffoscope.git")
294 (file-name (git-file-name name version))
297 "03b66cjii7l2yiwffj6ym6mycd5drx7prfp4j2550281pias6mjh"))))
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/" ))
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)))
313 `(("python-requests" ,python-requests)))
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,
321 remote diffoscope service}.
323 Diffoscope tries to get to the bottom of what makes files or directories
324 different. It recursively unpacks archives of many kinds and transforms
325 various binary formats into more human readable forms to compare them. It can
326 compare two tarballs, ISO images, or PDFs just as easily.
328 Results are displayed by default, stored as local text or html files, or made
329 available via a URL on @url{https://try.diffoscope.org}. Results stored on the
330 server are purged after 30 days.")
331 (license license:gpl3+)))