;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2017, 2021 Ricardo Wurmus ;;; Copyright © 2017–2022 Tobias Geerinckx-Rice ;;; Copyright © 2018 Julien Lepiller ;;; Copyright © 2018, 2019 Rutger Helling ;;; Copyright © 2019 Vagrant Cascadian ;;; Copyright © 2022, 2023 Efraim Flashner ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages diffoscope) #:use-module (gnu packages) #:use-module (gnu packages acl) #:use-module (gnu packages admin) #:use-module (gnu packages android) #:use-module (gnu packages backup) #:use-module (gnu packages base) #:use-module (gnu packages bootloaders) #:use-module (gnu packages cdrom) #:use-module (gnu packages check) #:use-module (gnu packages compression) #:use-module (gnu packages cpio) #:use-module (gnu packages dbm) #:use-module (gnu packages file) ;for 'file-next' #:use-module (gnu packages gettext) #:use-module (gnu packages ghostscript) #:use-module (gnu packages gnome) #:use-module (gnu packages gnupg) #:use-module (gnu packages haskell) #:use-module (gnu packages image) #:use-module (gnu packages imagemagick) #:use-module (gnu packages java) #:use-module (gnu packages linux) #:use-module (gnu packages llvm) #:use-module (gnu packages man) #:use-module (gnu packages maths) #:use-module (gnu packages ocaml) #:use-module (gnu packages package-management) #:use-module (gnu packages pascal) #:use-module (gnu packages patchutils) #:use-module (gnu packages pdf) #:use-module (gnu packages python-check) #:use-module (gnu packages python-web) #:use-module (gnu packages python-xyz) #:use-module (gnu packages sqlite) #:use-module (gnu packages ssh) #:use-module (gnu packages statistics) #:use-module (gnu packages textutils) #:use-module (gnu packages tls) #:use-module (gnu packages video) #:use-module (gnu packages vim) #:use-module (gnu packages web) #:use-module (guix build-system python) #:use-module (guix gexp) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix utils) #:use-module (ice-9 match)) (define-public diffoscope (package (name "diffoscope") (version "233") (source (origin (method git-fetch) (uri (git-reference (url "https://salsa.debian.org/reproducible-builds/diffoscope.git") (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "1m6fc7k8cd7ahra05vqccw1fdbjj6d20vr3q8v67ynnyih5nmbnb")))) (build-system python-build-system) (arguments `(#:phases (modify-phases %standard-phases ;; These tests are broken because our `file` package has a ;; bug in berkeley-db and wasm file type detection. (add-after 'unpack 'remove-broken-file-type-detection-test (lambda _ (delete-file "tests/comparators/test_berkeley_db.py") (delete-file "tests/comparators/test_wasm.py"))) (add-after 'unpack 'embed-tool-references (lambda* (#:key inputs #:allow-other-keys) (substitute* "diffoscope/comparators/utils/compare.py" (("\\[\"xxd\",") (string-append "[\"" (which "xxd") "\","))) (substitute* "diffoscope/diff.py" (("@tool_required\\(\"diff\"\\)") "") (("get_tool_name\\(\"diff\"\\)") (string-append "get_tool_name(\"" (which "diff") "\")"))) (substitute* "diffoscope/comparators/directory.py" (("@tool_required\\(\"stat\"\\)") "") (("@tool_required\\(\"getfacl\"\\)") "") (("\\[\"stat\",") (string-append "[\"" (which "stat") "\",")) (("\\[\"getfacl\",") (string-append "[\"" (which "getfacl") "\","))))) (add-after 'build 'build-man-page (lambda _ (invoke "make" "-C" "doc"))) (add-before 'check 'writable-test-data (lambda _ ;; Tests may need write access to tests directory. (for-each make-file-writable (find-files "tests")))) (add-before 'check 'fix-failing-test (lambda _ ;; There is no user name mapping in the build environment. ;; Pytest made it so much harder than should be necessary, ;; so I'm leaving… this here in case I ever need it again: ;; (substitute* "tests/comparators/test_squashfs.py" ;; (("^def test_symlink_root.*" match) ; no, I don't ;; (string-append ; know Python ;; match "\n raise ValueError(" ; why do you ;; "differences_root[1].unified_diff)\n"))) ; ask (substitute* "tests/data/squashfs_root_expected_diff" (("root/root") '"0/0 ")))) (add-before 'check 'delete-failing-test ;; Please add new tests to fix-failing-test and not here ;-) (lambda _ ;; This requires /sbin to be in $PATH. (delete-file "tests/test_tools.py"))) (add-after 'install 'install-man-page