projects/guix·blob kernel-updates · refs

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