9 binutils-unwrapped-all-targets,
80 python = python3.override {
82 packageOverrides = final: prev: {
83 # version 4 or newer would log the followng error but tests currently don't fail because radare2 is disabled
84 # ValueError: argument TNULL is not a TLSH hex string
85 tlsh = prev.tlsh.overridePythonAttrs (
94 hash = "sha256-ZYEjT/yShfA4+zpbGOtaFOx1nSSOWPtMvskPhHv3c9U=";
102 # Note: when upgrading this package, please run the list-missing-tools.sh script as described below!
103 python.pkgs.buildPythonApplication rec {
104 pname = "diffoscope";
108 url = "https://diffoscope.org/archive/diffoscope-${version}.tar.bz2";
109 hash = "sha256-4kAM1MmWbFh0fqFSnulhm4lHR59PMNPR3z5nzBgI6WY=";
117 patches = [ ./ignore_links.patch ];
120 # Upstream doesn't provide a PKG-INFO file
121 sed -i setup.py -e "/'rpm-python',/d"
123 # When generating manpage, use the installed version
124 substituteInPlace doc/Makefile --replace "../bin" "$out/bin"
127 nativeBuildInputs = [
133 # Most of the non-Python dependencies here are optional command-line tools for various file-format parsers.
134 # To help figuring out what's missing from the list, run: ./pkgs/tools/misc/diffoscope/list-missing-tools.sh
136 # Still missing these tools:
137 # Android-specific tools:
140 # Darwin-specific tools:
144 # docx2txt <- makes tests broken:
145 # > FAILED tests/comparators/test_docx.py::test_diff - IndexError: list index out of range
146 # > FAILED tests/comparators/test_docx.py::test_compare_non_existing - AssertionError
148 # > FAILED tests/comparators/test_elf_decompiler.py::test_ghidra_diff - IndexError: list index out of range
149 # > FAILED tests/comparators/test_elf_decompiler.py::test_radare2_diff - AssertionError
150 # > FAILED tests/comparators/test_macho_decompiler.py::test_ghidra_diff - assert 0 == 1
151 # > FAILED tests/comparators/test_macho_decompiler.py::test_radare2_diff - AssertionError
153 # We filter automatically all packages for the host platform (some dependencies are not supported on Darwin, aarch64, etc.).
154 # Packages which are marked broken for a platform are not automatically filtered to avoid accidentally removing them without noticing it.
155 pythonPath = lib.filter (lib.meta.availableOn stdenv.hostPlatform) (
158 binutils-unwrapped-all-targets
190 ++ (with python.pkgs; [
204 ++ lib.optionals enableBloat (
238 ++ (with python.pkgs; [
245 # docx2txt, nixpkgs packages another project named the same, which does not work
247 # oggvideotools is broken on Darwin, please put it back when it will be fixed?
248 ++ lib.optionals stdenv.hostPlatform.isLinux [ oggvideotools ]
249 # This doesn't work on aarch64-darwin
250 ++ lib.optionals (stdenv.hostPlatform.system != "aarch64-darwin") [ gnumeric ]
254 nativeCheckInputs = with python.pkgs; [ pytestCheckHook ] ++ pythonPath;
257 # Always show more information when tests fail
263 installManPage doc/diffoscope.1
268 "test_sbin_added_to_path"
272 # Fails because it fails to determine llvm version
273 "test_item3_deflate_llvm_bitcode"
275 ++ lib.optionals stdenv.hostPlatform.isDarwin [
276 # Disable flaky tests on Darwin
277 "test_non_unicode_filename"
281 # Appears to be a sandbox related issue
282 "test_trim_stderr_in_command"
283 # Seems to be a bug caused by having different versions of rdata than
284 # expected. Will file upstream.
286 # Caused by getting an otool command instead of llvm-objdump. Could be Nix
287 # setup, could be upstream bug. Will file upstream.
288 "test_libmix_differences"
291 disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
292 "tests/comparators/test_git.py"
293 "tests/comparators/test_java.py"
294 "tests/comparators/test_uimage.py"
295 "tests/comparators/test_device.py"
296 "tests/comparators/test_macho.py"
300 updateScript = writeScript "update-diffoscope" ''
301 #!/usr/bin/env nix-shell
302 #!nix-shell -i bash -p curl pcre common-updater-scripts
306 # Expect the text in format of "Latest release: 198 (31 Dec 2021)"'.
307 newVersion="$(curl -s https://diffoscope.org/ | pcregrep -o1 'Latest release: ([0-9]+)')"
308 update-source-version ${pname} "$newVersion"
313 description = "Perform in-depth comparison of files, archives, and directories";
315 diffoscope will try to get to the bottom of what makes files or directories
316 different. It will recursively unpack archives of many kinds and transform
317 various binary formats into more human readable form to compare them. It can
318 compare two tarballs, ISO images, or PDF just as easily. The differences can
319 be shown in a text or HTML report.
321 diffoscope is developed as part of the "reproducible builds" Debian
322 project and was formerly known as "debbindiff".
324 homepage = "https://diffoscope.org/";
325 changelog = "https://diffoscope.org/news/diffoscope-${version}-released/";
326 license = licenses.gpl3Plus;
327 maintainers = with maintainers; [
332 platforms = platforms.unix;
333 mainProgram = "diffoscope";