2021-07-24 22:24:48 +02:00
|
|
|
{ lib, stdenv, fetchurl, python3Packages, docutils, help2man, installShellFiles
|
2022-12-10 14:19:50 +01:00
|
|
|
, abootimg, acl, apksigcopier, apksigner, apktool, binutils-unwrapped-all-targets, bzip2, cbfstool, cdrkit, colord, colordiff, coreutils, cpio, db, diffutils, dtc
|
2021-10-23 00:19:48 +02:00
|
|
|
, e2fsprogs, enjarify, file, findutils, fontforge-fonttools, ffmpeg, fpc, gettext, ghc, ghostscriptX, giflib, gnumeric, gnupg, gnutar
|
2022-12-10 14:19:50 +01:00
|
|
|
, gzip, html2text, hdf5, imagemagick, jdk, libarchive, libcaca, llvm, lz4, mono, ocaml, oggvideotools, openssh, openssl, pdftk, pgpdump, poppler_utils, procyon, qemu, R
|
2021-10-23 00:19:48 +02:00
|
|
|
, radare2, sng, sqlite, squashfsTools, tcpdump, ubootTools, odt2txt, unzip, wabt, xmlbeans, xxd, xz, zip, zstd
|
2016-01-12 14:25:26 +01:00
|
|
|
, enableBloat ? false
|
2022-01-02 10:24:18 +01:00
|
|
|
# updater only
|
|
|
|
, writeScript
|
2015-08-04 05:04:12 +02:00
|
|
|
}:
|
|
|
|
|
2018-07-19 01:31:23 +02:00
|
|
|
# Note: when upgrading this package, please run the list-missing-tools.sh script as described below!
|
2017-08-31 09:53:02 +02:00
|
|
|
python3Packages.buildPythonApplication rec {
|
2019-10-04 12:40:43 +02:00
|
|
|
pname = "diffoscope";
|
2022-12-21 17:55:35 +01:00
|
|
|
version = "229";
|
2015-08-04 05:04:12 +02:00
|
|
|
|
2019-10-04 12:40:43 +02:00
|
|
|
src = fetchurl {
|
2021-02-11 18:08:19 +01:00
|
|
|
url = "https://diffoscope.org/archive/diffoscope-${version}.tar.bz2";
|
2022-12-21 17:55:35 +01:00
|
|
|
sha256 = "sha256-IyTBwlVqOIXERdjvZPTwxhIBPOn8Dt7QbvfBazj5J/A=";
|
2015-08-04 05:04:12 +02:00
|
|
|
};
|
|
|
|
|
2020-04-25 01:26:01 +02:00
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
2017-08-31 09:53:02 +02:00
|
|
|
patches = [
|
2017-09-13 16:03:38 +02:00
|
|
|
./ignore_links.patch
|
2017-08-31 09:53:02 +02:00
|
|
|
];
|
2016-01-12 17:00:24 +01:00
|
|
|
|
2015-08-04 05:04:12 +02:00
|
|
|
postPatch = ''
|
|
|
|
# Upstream doesn't provide a PKG-INFO file
|
2015-09-27 06:10:25 +02:00
|
|
|
sed -i setup.py -e "/'rpm-python',/d"
|
2018-07-18 23:36:15 +02:00
|
|
|
|
|
|
|
# When generating manpage, use the installed version
|
|
|
|
substituteInPlace doc/Makefile --replace "../bin" "$out/bin"
|
2015-08-04 05:04:12 +02:00
|
|
|
'';
|
|
|
|
|
2021-02-11 18:08:19 +01:00
|
|
|
nativeBuildInputs = [ docutils help2man installShellFiles ];
|
2017-12-26 17:25:27 +01:00
|
|
|
|
2018-07-19 01:31:23 +02:00
|
|
|
# Most of the non-Python dependencies here are optional command-line tools for various file-format parsers.
|
|
|
|
# To help figuring out what's missing from the list, run: ./pkgs/tools/misc/diffoscope/list-missing-tools.sh
|
|
|
|
#
|
2021-10-23 00:19:48 +02:00
|
|
|
# Still missing these tools: docx2txt lipo otool r2pipe
|
2020-01-14 10:56:52 +01:00
|
|
|
pythonPath = [
|
2022-07-27 23:19:21 +02:00
|
|
|
binutils-unwrapped-all-targets bzip2 colordiff coreutils cpio db diffutils
|
2021-07-19 06:20:00 +02:00
|
|
|
e2fsprogs file findutils fontforge-fonttools gettext gnutar gzip
|
2022-12-10 14:19:50 +01:00
|
|
|
html2text libarchive lz4 openssl pgpdump sng sqlite squashfsTools unzip xxd
|
2020-05-30 01:25:14 +02:00
|
|
|
xz zip zstd
|
2020-01-14 10:56:52 +01:00
|
|
|
]
|
2020-05-30 01:25:14 +02:00
|
|
|
++ (with python3Packages; [
|
2022-03-20 04:12:32 +01:00
|
|
|
argcomplete debian defusedxml jsondiff jsbeautifier libarchive-c
|
2022-11-10 14:43:53 +01:00
|
|
|
python-magic progressbar33 pypdf2 tlsh
|
2020-05-30 01:25:14 +02:00
|
|
|
])
|
2022-11-10 14:43:53 +01:00
|
|
|
++ lib.optionals stdenv.isLinux [ python3Packages.pyxattr python3Packages.rpm acl cdrkit dtc ]
|
2020-05-30 01:25:14 +02:00
|
|
|
++ lib.optionals enableBloat ([
|
2022-12-10 14:19:50 +01:00
|
|
|
abootimg apksigcopier apksigner apktool cbfstool colord enjarify ffmpeg fpc ghc ghostscriptX giflib gnupg gnumeric
|
2022-05-13 16:59:47 +02:00
|
|
|
hdf5 imagemagick libcaca llvm jdk mono ocaml odt2txt oggvideotools openssh pdftk poppler_utils procyon qemu R tcpdump ubootTools wabt radare2 xmlbeans
|
2022-05-25 06:20:00 +02:00
|
|
|
] ++ (with python3Packages; [ androguard binwalk guestfs h5py pdfminer-six ]));
|
2017-03-20 14:19:50 +01:00
|
|
|
|
2023-01-21 13:00:00 +01:00
|
|
|
nativeCheckInputs = with python3Packages; [ pytestCheckHook ] ++ pythonPath;
|
2015-08-04 05:04:12 +02:00
|
|
|
|
|
|
|
postInstall = ''
|
2017-12-26 17:25:27 +01:00
|
|
|
make -C doc
|
2021-02-11 18:08:19 +01:00
|
|
|
installManPage doc/diffoscope.1
|
2015-08-04 05:04:12 +02:00
|
|
|
'';
|
|
|
|
|
2021-02-11 18:08:19 +01:00
|
|
|
disabledTests = [
|
|
|
|
"test_sbin_added_to_path"
|
2021-04-01 21:39:24 +02:00
|
|
|
"test_diff_meta"
|
|
|
|
"test_diff_meta2"
|
2021-07-31 18:05:27 +02:00
|
|
|
|
2022-02-07 03:46:08 +01:00
|
|
|
# fails because it fails to determine llvm version
|
|
|
|
"test_item3_deflate_llvm_bitcode"
|
2021-07-19 06:20:00 +02:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
# Disable flaky tests on Darwin
|
|
|
|
"test_non_unicode_filename"
|
|
|
|
"test_listing"
|
2021-11-15 18:49:26 +01:00
|
|
|
"test_symlink_root"
|
2021-07-19 06:20:00 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
# flaky tests on Darwin
|
|
|
|
disabledTestPaths = lib.optionals stdenv.isDarwin [
|
|
|
|
"tests/comparators/test_git.py"
|
|
|
|
"tests/comparators/test_java.py"
|
|
|
|
"tests/comparators/test_uimage.py"
|
|
|
|
"tests/comparators/test_device.py"
|
|
|
|
"tests/comparators/test_macho.py"
|
2021-02-11 18:08:19 +01:00
|
|
|
];
|
|
|
|
|
2022-01-02 10:24:18 +01:00
|
|
|
passthru = {
|
|
|
|
updateScript = writeScript "update-diffoscope" ''
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl pcre common-updater-scripts
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
# Expect the text in format of "Latest release: 198 (31 Dec 2021)"'.
|
|
|
|
newVersion="$(curl -s https://diffoscope.org/ | pcregrep -o1 'Latest release: ([0-9]+)')"
|
|
|
|
update-source-version ${pname} "$newVersion"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2015-08-04 05:04:12 +02:00
|
|
|
description = "Perform in-depth comparison of files, archives, and directories";
|
|
|
|
longDescription = ''
|
|
|
|
diffoscope will try to get to the bottom of what makes files or directories
|
|
|
|
different. It will recursively unpack archives of many kinds and transform
|
|
|
|
various binary formats into more human readable form to compare them. It can
|
|
|
|
compare two tarballs, ISO images, or PDF just as easily. The differences can
|
|
|
|
be shown in a text or HTML report.
|
|
|
|
|
|
|
|
diffoscope is developed as part of the "reproducible builds" Debian
|
|
|
|
project and was formerly known as "debbindiff".
|
|
|
|
'';
|
2021-02-11 18:08:19 +01:00
|
|
|
homepage = "https://diffoscope.org/";
|
|
|
|
license = licenses.gpl3Plus;
|
2022-06-19 12:07:43 +02:00
|
|
|
maintainers = with maintainers; [ dezgeg danielfullmer ];
|
2021-02-11 18:08:19 +01:00
|
|
|
platforms = platforms.unix;
|
2015-08-04 05:04:12 +02:00
|
|
|
};
|
|
|
|
}
|