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>
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 mono)
48 #:use-module (gnu packages ocaml)
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)
56 #:use-module (gnu packages statistics)
57 #:use-module (gnu packages textutils)
58 #:use-module (gnu packages video)
59 #:use-module (gnu packages vim)
60 #:use-module (gnu packages web)
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)
66 #:use-module (guix utils)
67 #:use-module (ice-9 match))
69 (define-public diffoscope
70 (let ((version "134"))
77 (url "https://salsa.debian.org/reproducible-builds/diffoscope.git")
79 (file-name (git-file-name name version))
82 "04078cn3lazcrpgzzzy1s9721hprkylrvfa58izm4dcvgd7a593z"))))
83 (build-system python-build-system)
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
91 (substitute* "setup.py"
92 (("'python-magic',") ""))))
93 ;; This test is broken because our `file` package has a
94 ;; bug in berkeley-db file type detection.
95 (add-after 'unpack 'remove-berkeley-test
97 (delete-file "tests/comparators/test_berkeley_db.py")
99 ;; Test is dynamically generated and may have false
100 ;; negatives with different ocaml versions. Further
101 ;; background in: https://bugs.debian.org/939386
102 (add-after 'unpack 'remove-ocaml-test
104 (substitute* "tests/comparators/test_ocaml.py"
105 (("def test_diff.differences.:")
106 "def skip_test_diff(differences):"))
108 (add-after 'unpack 'skip-elf-tests
109 ;; FIXME: libmix_differences test added in 125, and is
110 ;; failing, need to explore why...
112 (substitute* "tests/comparators/test_elf.py"
113 (("def test_libmix_differences.libmix_differences.:")
114 "def skip_test_libmix_differences(libmix_differences):"))
116 (add-after 'unpack 'embed-tool-references
117 (lambda* (#:key inputs #:allow-other-keys)
118 (substitute* "diffoscope/comparators/utils/compare.py"
120 (string-append "['" (which "xxd") "',")))
121 (substitute* "diffoscope/comparators/elf.py"
122 (("@tool_required\\('readelf'\\)") "")
123 (("get_tool_name\\('readelf'\\)")
124 (string-append "'" (which "readelf") "'")))
125 (substitute* "diffoscope/comparators/directory.py"
126 (("@tool_required\\('stat'\\)") "")
127 (("@tool_required\\('getfacl'\\)") "")
129 (string-append "['" (which "stat") "',"))
131 (string-append "['" (which "getfacl") "',")))
133 (add-before 'check 'writable-test-data
135 ;; tests may need needs write access to tests
137 (for-each make-file-writable (find-files "tests"))
139 (add-before 'check 'delete-failing-test
141 ;; this requires /sbin to be on the path
142 (delete-file "tests/test_tools.py")
144 (inputs `(("rpm" ,rpm) ;for rpm-python
145 ("python-file" ,python-file)
146 ("python-debian" ,python-debian)
147 ("python-libarchive-c" ,python-libarchive-c)
148 ("python-tlsh" ,python-tlsh)
149 ("acl" ,acl) ;for getfacl
150 ("colordiff" ,colordiff)
152 ;; Below are modules used for tests.
153 (native-inputs `(("python-pytest" ,python-pytest)
154 ("python-chardet" ,python-chardet)
155 ("python-binwalk" ,python-binwalk)
156 ("python-pypdf2" ,python-pypdf2)
157 ("python-progressbar33" ,python-progressbar33)
158 ;; test suite skips tests when tool is missing
159 ,@(match (%current-system)
160 ;; ghc is only available on x86 currently.
161 ((or "x86_64-linux" "i686-linux")
165 ,@(match (%current-system)
166 ;; openjdk and dependent packages are only
167 ;; available on x86_64 currently.
169 `(("enjarify" ,enjarify)
170 ;; no unversioned openjdk available
171 ("openjdk:jdk" ,openjdk12 "jdk")
175 ("abootimg" ,abootimg)
177 ("binutils" ,binutils)
179 ("cdrtools" ,cdrtools)
182 ("docx2txt" ,docx2txt)
184 ("e2fsprogs" ,e2fsprogs)
186 ("gettext" ,gettext-minimal)
187 ("ghostscript" ,ghostscript)
188 ("giflib:bin" ,giflib "bin")
189 ("gnumeric" ,gnumeric)
191 ("imagemagick" ,imagemagick)
192 ("libarchive" ,libarchive)
201 ("python-jsbeautifier" ,python-jsbeautifier)
202 ("r-minimal" ,r-minimal)
206 ("squashfs-tools" ,squashfs-tools)
214 (home-page "https://diffoscope.org/")
215 (synopsis "Compare files, archives, and directories in depth")
217 "Diffoscope tries to get to the bottom of what makes files or directories
218 different. It recursively unpacks archives of many kinds and transforms
219 various binary formats into more human readable forms to compare them. It can
220 compare two tarballs, ISO images, or PDFs just as easily.")
221 (license license:gpl3+))))
223 (define-public trydiffoscope
225 (name "trydiffoscope")
231 (url "https://salsa.debian.org/reproducible-builds/trydiffoscope.git")
233 (file-name (git-file-name name version))
236 "03b66cjii7l2yiwffj6ym6mycd5drx7prfp4j2550281pias6mjh"))))
239 (modify-phases %standard-phases
240 (add-after 'install 'install-doc
241 (lambda* (#:key outputs #:allow-other-keys)
242 (let* ((share (string-append (assoc-ref outputs "out") "/share/")))
243 (mkdir-p (string-append share "/man/man1/" ))
245 "trydiffoscope.1.rst"
246 (string-append share "/man/man1/trydiffoscope.1"))
247 (mkdir-p (string-append share "/doc/" ,name "-" ,version))
248 (install-file "./README.rst"
249 (string-append share "/doc/" ,name "-" ,version)))
252 `(("python-requests" ,python-requests)))
255 ("python-docutils" ,python-docutils)))
256 (build-system python-build-system)
257 (home-page "https://try.diffoscope.org")
258 (synopsis "Client for remote diffoscope service")
259 (description "This is a client for the @url{https://try.diffoscope.org,
260 remote diffoscope service}.
262 Diffoscope tries to get to the bottom of what makes files or directories
263 different. It recursively unpacks archives of many kinds and transforms
264 various binary formats into more human readable forms to compare them. It can
265 compare two tarballs, ISO images, or PDFs just as easily.
267 Results are displayed by default, stored as local text or html files, or made
268 available via a URL on @url{https://try.diffoscope.org}. Results stored on the
269 server are purged after 30 days.")
270 (license license:gpl3+)))