projects/guix·blob perlssl · refs

387 lines · 14.7 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <[email protected]>
3;;; Copyright © 2017, 2021 Ricardo Wurmus <[email protected]>
4;;; Copyright © 2017–2022 Tobias Geerinckx-Rice <[email protected]>
5;;; Copyright © 2018 Julien Lepiller <[email protected]>
6;;; Copyright © 2018, 2019 Rutger Helling <[email protected]>
7;;; Copyright © 2019 Vagrant Cascadian <[email protected]>
8;;; Copyright © 2022, 2023 Efraim Flashner <[email protected]>
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25(define-module (gnu packages diffoscope)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages acl)
28 #:use-module (gnu packages admin)
29 #:use-module (gnu packages android)
30 #:use-module (gnu packages backup)
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages bootloaders)
33 #:use-module (gnu packages cdrom)
34 #:use-module (gnu packages check)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages cpio)
37 #:use-module (gnu packages dbm)
38 #:use-module (gnu packages firmware)
39 #:use-module (gnu packages gettext)
40 #:use-module (gnu packages ghostscript)
41 #:use-module (gnu packages gnome)
42 #:use-module (gnu packages gnupg)
43 #:use-module (gnu packages haskell)
44 #:use-module (gnu packages image)
45 #:use-module (gnu packages imagemagick)
46 #:use-module (gnu packages java)
47 #:use-module (gnu packages linux)
48 #:use-module (gnu packages llvm)
49 #:use-module (gnu packages man)
50 #:use-module (gnu packages maths)
51 #:use-module (gnu packages ocaml)
52 #:use-module (gnu packages package-management)
53 #:use-module (gnu packages pascal)
54 #:use-module (gnu packages patchutils)
55 #:use-module (gnu packages pdf)
56 #:use-module (gnu packages perl)
57 #:use-module (gnu packages python-build)
58 #:use-module (gnu packages python-check)
59 #:use-module (gnu packages python-web)
60 #:use-module (gnu packages python-xyz)
61 #:use-module (gnu packages sqlite)
62 #:use-module (gnu packages ssh)
63 #:use-module (gnu packages statistics)
64 #:use-module (gnu packages textutils)
65 #:use-module (gnu packages tls)
66 #:use-module (gnu packages video)
67 #:use-module (gnu packages vim)
68 #:use-module (gnu packages web)
69 #:use-module (gnu packages xml)
70 #:use-module (guix build-system pyproject)
71 #:use-module (guix gexp)
72 #:use-module (guix git-download)
73 #:use-module ((guix licenses) #:prefix license:)
74 #:use-module (guix packages)
75 #:use-module (guix utils)
76 #:use-module (ice-9 match))
77
78(define-public diffoscope
79 (package
80 (name "diffoscope")
81 (version "321")
82 (source
83 (origin
84 (method git-fetch)
85 (uri (git-reference
86 (url "https://salsa.debian.org/reproducible-builds/diffoscope.git")
87 (commit version)))
88 (file-name (git-file-name name version))
89 (sha256
90 (base32 "18nz449kb683g2yzprd7cpv4zgrmjv0xvqdsnxv9yrgq8242qjgs"))))
91 (build-system pyproject-build-system)
92 (arguments
93 (list
94 #:phases
95 #~(modify-phases %standard-phases
96 ;; These tests are broken because our `file` package has a
97 ;; bug in berkeley-db and wasm file type detection.
98 (add-after 'unpack 'remove-broken-file-type-detection-test
99 (lambda _
100 (delete-file "tests/comparators/test_berkeley_db.py")
101 (delete-file "tests/comparators/test_wasm.py")))
102 (add-after 'compress-documentation 'make-extract-vmlinux-executable
103 ;; The script extract-vmlinux needs to be marked executable to be
104 ;; able to extract vmlinux files.
105 (lambda _
106 (for-each (lambda (file)
107 (chmod file #o755))
108 (find-files #$output "extract-vmlinux"))))
109 (add-after 'unpack 'embed-tool-references
110 (lambda* (#:key inputs #:allow-other-keys)
111 (define (bin command)
112 (search-input-file inputs (string-append "bin/" command)))
113 (substitute* "diffoscope/comparators/utils/compare.py"
114 (("\\[\"(xxd)\"," _ command)
115 (string-append "[\"" (bin command) "\",")))
116 (substitute* "diffoscope/diff.py"
117 (("@tool_required\\(\"diff\"\\)") "")
118 (("get_tool_name\\(\"(diff)\"\\)" _ command)
119 (string-append "get_tool_name(\"" (bin command) "\")")))
120 (substitute* "diffoscope/comparators/directory.py"
121 (("@tool_required\\(\"stat\"\\)") "")
122 (("@tool_required\\(\"getfacl\"\\)") "")
123 (("\\[\"(stat)\"," _ command)
124 (string-append "[\"" (bin command) "\","))
125 (("\\[\"(getfacl)\"," _ command)
126 (string-append "[\"" (bin command) "\",")))))
127 (add-after 'build 'build-man-page
128 (lambda _
129 (invoke "make" "-C" "doc")))
130 (add-before 'check 'writable-test-data
131 (lambda _
132 ;; Tests may need write access to tests directory.
133 (for-each make-file-writable (find-files "tests"))))
134 (add-before 'check 'fix-failing-test
135 (lambda _
136 ;; There is no user name mapping in the build environment.
137 ;; Pytest made it so much harder than should be necessary,
138 ;; so I'm leaving… this here in case I ever need it again:
139 ;; (substitute* "tests/comparators/test_squashfs.py"
140 ;; (("^def test_symlink_root.*" match) ; no, I don't
141 ;; (string-append ; know Python
142 ;; match "\n raise ValueError(" ; why do you
143 ;; "differences_root[1].unified_diff)\n"))) ; ask
144 (substitute* "tests/data/squashfs_root_expected_diff"
145 (("root/root")
146 '"0/0 "))))
147 (add-before 'check 'delete-failing-test
148 ;; Please add new tests to fix-failing-test and not here ;-)
149 (lambda _
150 ;; This requires /sbin to be in $PATH.
151 (delete-file "tests/test_tools.py")))
152 (replace 'check
153 (lambda* (#:key tests? #:allow-other-keys)
154 (when tests?
155 ;; Increase verbosity of tests and provide a summary
156 (invoke "pytest" "-vv" "-r" "sxX"))))
157 (add-after 'install 'install-man-page
158 (lambda* (#:key outputs #:allow-other-keys)
159 (let* ((out (assoc-ref outputs "out"))
160 (man (string-append out "/share/man/man1")))
161 (install-file "doc/diffoscope.1" man)))))))
162 (inputs (list rpm ;for rpm-python
163 python-debian
164 python-libarchive-c
165 python-magic
166 python-tlsh
167 acl ;for getfacl
168 coreutils ;for stat
169 diffutils ;for diff
170 xxd))
171 (native-inputs
172 (append
173 (list help2man
174 python-setuptools
175 python-wheel
176
177 ;; Below are packages used for tests.
178 binwalk
179 python-pytest
180 python-chardet
181 python-defusedxml
182 python-h5py
183 python-pypdf
184 python-progressbar33
185
186 abootimg
187 bdb
188 binutils
189 bzip2
190 cdrkit-libre
191 colord
192 cpio
193 docx2txt
194 dtc
195 e2fsprogs
196 ffmpeg)
197
198 (match (%current-system)
199 ;; fpc is only available on x86 currently.
200 ((or "x86_64-linux" "i686-linux")
201 (list fpc))
202 (_ '()))
203
204 (list gettext-minimal
205 ghostscript
206 `(,giflib "bin")
207 gnumeric
208 gnupg
209 hdf5
210 html2text
211 imagemagick
212 libarchive
213 libcaca
214 llvm
215 lz4
216 lzip
217 ocaml
218 odt2txt
219 openssh
220 openssl
221 7zip
222 perl
223 pgpdump
224 poppler
225 python-jsbeautifier
226 r-minimal
227 rpm
228 sng
229 sqlite
230 squashfs-tools
231 tcpdump
232 u-boot-tools
233 unzip
234 wabt
235 xxd
236 xz
237 zip
238 zstd)
239
240 ;; Also for tests. The test suite skips tests when these are missing.
241 (match (%current-system)
242 ;; ghc is only available on x86 currently.
243 ((or "x86_64-linux" "i686-linux")
244 (list ghc))
245 (_ '()))
246 (match (%current-system)
247 ;; openjdk and dependent packages are only
248 ;; available on x86_64 currently.
249 ((or "x86_64-linux")
250 ;; No unversioned openjdk available.
251 (list `(,openjdk12 "jdk")
252 enjarify))
253 (_ '()))))
254 (home-page "https://diffoscope.org/")
255 (synopsis "Compare files, archives, and directories in depth")
256 (description
257 "Diffoscope tries to get to the bottom of what makes files or directories
258different. It recursively unpacks archives of many kinds and transforms
259various binary formats into more human readable forms to compare them. It can
260compare two tarballs, ISO images, or PDFs just as easily.
261
262Diffoscope has many optional dependencies; @code{diffoscope
263--list-missing-tools guix} will display optional packages to
264install.")
265 (license license:gpl3+)))
266
267(define-public reprotest
268 (package
269 (name "reprotest")
270 (version "0.7.32")
271 (source
272 (origin
273 (method git-fetch)
274 (uri (git-reference
275 (url "https://salsa.debian.org/reproducible-builds/reprotest.git")
276 (commit version)))
277 (file-name (git-file-name name version))
278 (sha256
279 (base32 "0z67291rv9ii3llv2hwz9ak99818fwkxcqibb5zk8qkamh4y2bww"))))
280 (build-system pyproject-build-system)
281 (arguments
282 (list
283 #:phases
284 #~(modify-phases %standard-phases
285 (add-after 'compress-documentation 'make-virt-files-executable
286 ;; The autopkgtest-virt- files need to be marked executable for
287 ;; reprotest to function correctly.
288 (lambda _
289 (for-each (lambda (file)
290 (chmod file #o755))
291 (find-files #$output "autopkgtest-virt-.*"))))
292 (add-after 'unpack 'skip-most-tests
293 ;; These tests require functionality not available in the guix
294 ;; build environment
295 (lambda _
296 (substitute* "tests/test_reprotest.py"
297 (("def (test_simple_build|test_self_build|test_variations)"
298 def)
299 (string-append
300 "@pytest.mark.skip(reason='guix environment lacks permissions')
301"
302 def)))))
303 (add-after 'install 'install-doc
304 (lambda _
305 (let* ((mandir1 (string-append
306 #$output "/share/man/man1"))
307 (docdir (string-append
308 #$output "/share/doc/" #$name "-" #$version)))
309 (invoke "make" "-C" "doc")
310 (mkdir-p mandir1)
311 (install-file "doc/reprotest.1" mandir1)
312 (mkdir-p docdir)
313 (install-file "./README.rst" docdir)
314 (install-file "./README-dev.rst" docdir)))))))
315 (native-inputs
316 (list diffoscope
317 help2man
318 libfaketime
319 python-docutils
320 python-magic
321 python-pytest
322 python-setuptools
323 python-tlsh
324 python-wheel
325 unzip
326 xxd))
327 (propagated-inputs
328 (list python-debian
329 python-distro
330 python-libarchive-c
331 python-rstr))
332 (home-page "https://salsa.debian.org/reproducible-builds/reprotest")
333 (synopsis "Build software and check it for reproducibility")
334 (description "Reprotest builds the same source code twice in different
335environments, and then checks the binaries produced by each build for
336differences. If any are found, then diffoscope or diff is used to display
337them in detail for later analysis.")
338 (license (list license:gpl3+ license:gpl2+))))
339
340(define-public trydiffoscope
341 (package
342 (name "trydiffoscope")
343 (version "67.0.8")
344 (source
345 (origin
346 (method git-fetch)
347 (uri (git-reference
348 (url "https://salsa.debian.org/reproducible-builds/trydiffoscope.git")
349 (commit version)))
350 (file-name (git-file-name name version))
351 (sha256
352 (base32
353 "0k698g4fws63rnav4pvfsf1hfds867xan59mmv5zw71r58lm6cxb"))))
354 (arguments
355 (list #:tests? #f
356 #:phases
357 #~(modify-phases %standard-phases
358 (add-after 'install 'install-doc
359 (lambda _
360 (let* ((share (string-append #$output "/share/")))
361 (mkdir-p (string-append share "/man/man1/"))
362 (invoke "rst2man.py" "trydiffoscope.1.rst"
363 (string-append share "/man/man1/trydiffoscope.1"))
364 (mkdir-p (string-append
365 share "/doc/" #$name "-" #$version))
366 (install-file
367 "./README.rst"
368 (string-append share "/doc/" #$name "-" #$version))))))))
369 (propagated-inputs
370 (list python-requests))
371 (native-inputs
372 (list gzip python-docutils-0.19 python-setuptools python-wheel))
373 (build-system pyproject-build-system)
374 (home-page "https://try.diffoscope.org")
375 (synopsis "Client for remote diffoscope service")
376 (description "This is a client for the @url{https://try.diffoscope.org,
377remote diffoscope service}.
378
379Diffoscope tries to get to the bottom of what makes files or directories
380different. It recursively unpacks archives of many kinds and transforms
381various binary formats into more human readable forms to compare them. It can
382compare two tarballs, ISO images, or PDFs just as easily.
383
384Results are displayed by default, stored as local text or html files, or made
385available via a URL on @url{https://try.diffoscope.org}. Results stored on the
386server are purged after 30 days.")
387 (license license:gpl3+)))