Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 139 lines 5.6 kB view raw
1{ lib, stdenv, fetchurl, python3Packages, docutils, help2man, installShellFiles, fetchpatch 2, abootimg, acl, apksigcopier, apksigner, apktool, binutils-unwrapped-all-targets, bzip2, cbfstool, cdrkit, colord, colordiff, coreutils, cpio, db, diffutils, dtc 3, e2fsprogs, enjarify, file, findutils, fontforge-fonttools, ffmpeg, fpc, gettext, ghc, ghostscriptX, giflib, gnumeric, gnupg, gnutar 4, gzip, html2text, hdf5, imagemagick, jdk, libarchive, libcaca, llvm, lz4, mono, ocaml, oggvideotools, openssh, openssl, pdftk, pgpdump, poppler_utils, procyon, qemu, R 5, radare2, sng, sqlite, squashfsTools, tcpdump, ubootTools, odt2txt, unzip, wabt, xmlbeans, xxd, xz, zip, zstd 6, enableBloat ? true 7, enableUnfree ? false 8# updater only 9, writeScript 10}: 11 12# Note: when upgrading this package, please run the list-missing-tools.sh script as described below! 13python3Packages.buildPythonApplication rec { 14 pname = "diffoscope"; 15 version = "233"; 16 17 src = fetchurl { 18 url = "https://diffoscope.org/archive/diffoscope-${version}.tar.bz2"; 19 sha256 = "sha256-A2GYnhdjkzSFnMsy99FmckiOsbRdymAdtjp55hyFLp4="; 20 }; 21 22 outputs = [ "out" "man" ]; 23 24 patches = [ 25 ./ignore_links.patch 26 # test_text_proper_indentation requires file >= 5.44 27 (fetchpatch { 28 url = "https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/9fdb78ec0bbc69f1980499dfdcbf6f1dd5e55cc8.patch"; 29 sha256 = "sha256-F0N3L9yymj2NjeIKtSnOEDsxPe+ZTb0m/M4f8LPRHg0="; 30 }) 31 ]; 32 33 postPatch = '' 34 # Upstream doesn't provide a PKG-INFO file 35 sed -i setup.py -e "/'rpm-python',/d" 36 37 # When generating manpage, use the installed version 38 substituteInPlace doc/Makefile --replace "../bin" "$out/bin" 39 ''; 40 41 nativeBuildInputs = [ docutils help2man installShellFiles ]; 42 43 # Most of the non-Python dependencies here are optional command-line tools for various file-format parsers. 44 # To help figuring out what's missing from the list, run: ./pkgs/tools/misc/diffoscope/list-missing-tools.sh 45 # 46 # Still missing these tools: docx2txt lipo otool r2pipe 47 # We filter automatically all packages for the host platform (some dependencies are not supported on Darwin, aarch64, etc.). 48 pythonPath = lib.filter (lib.meta.availableOn stdenv.hostPlatform) ([ 49 binutils-unwrapped-all-targets bzip2 colordiff coreutils cpio db diffutils 50 e2fsprogs file findutils fontforge-fonttools gettext gnutar gzip 51 html2text libarchive lz4 openssl pgpdump sng sqlite squashfsTools unzip xxd 52 xz zip zstd cdrkit dtc 53 ] 54 ++ (with python3Packages; [ 55 argcomplete debian defusedxml jsondiff jsbeautifier libarchive-c 56 python-magic progressbar33 pypdf2 tlsh pyxattr rpm 57 ]) 58 ++ lib.optionals enableBloat ( 59 [ 60 apksigcopier apksigner enjarify ffmpeg fpc ghc ghostscriptX giflib gnupg pdftk 61 hdf5 imagemagick libcaca llvm jdk mono ocaml odt2txt openssh 62 poppler_utils procyon qemu R tcpdump wabt radare2 xmlbeans 63 abootimg cbfstool colord ubootTools 64 ] 65 ++ (with python3Packages; [ androguard binwalk h5py pdfminer-six guestfs ]) 66 # oggvideotools is broken on Darwin, please put it back when it will be fixed? 67 ++ lib.optionals stdenv.isLinux [ oggvideotools ] 68 # This doesn't work on aarch64-darwin 69 ++ lib.optionals (stdenv.hostPlatform != "aarch64-darwin") [ gnumeric ] 70 # `apktool` depend on `build-tools` which requires Android SDK acceptance, therefore, the whole thing is unfree. 71 ++ lib.optionals enableUnfree [ apktool ] 72 )); 73 74 nativeCheckInputs = with python3Packages; [ pytestCheckHook ] ++ pythonPath; 75 76 pytestFlagsArray = [ 77 # always show more information when tests fail 78 "-vv" 79 ]; 80 81 postInstall = '' 82 make -C doc 83 installManPage doc/diffoscope.1 84 ''; 85 86 disabledTests = [ 87 "test_sbin_added_to_path" 88 "test_diff_meta" 89 "test_diff_meta2" 90 91 # fails because it fails to determine llvm version 92 "test_item3_deflate_llvm_bitcode" 93 ] ++ lib.optionals stdenv.isDarwin [ 94 # Disable flaky tests on Darwin 95 "test_non_unicode_filename" 96 "test_listing" 97 "test_symlink_root" 98 ]; 99 100 # flaky tests on Darwin 101 disabledTestPaths = lib.optionals stdenv.isDarwin [ 102 "tests/comparators/test_git.py" 103 "tests/comparators/test_java.py" 104 "tests/comparators/test_uimage.py" 105 "tests/comparators/test_device.py" 106 "tests/comparators/test_macho.py" 107 ]; 108 109 passthru = { 110 updateScript = writeScript "update-diffoscope" '' 111 #!/usr/bin/env nix-shell 112 #!nix-shell -i bash -p curl pcre common-updater-scripts 113 114 set -eu -o pipefail 115 116 # Expect the text in format of "Latest release: 198 (31 Dec 2021)"'. 117 newVersion="$(curl -s https://diffoscope.org/ | pcregrep -o1 'Latest release: ([0-9]+)')" 118 update-source-version ${pname} "$newVersion" 119 ''; 120 }; 121 122 meta = with lib; { 123 description = "Perform in-depth comparison of files, archives, and directories"; 124 longDescription = '' 125 diffoscope will try to get to the bottom of what makes files or directories 126 different. It will recursively unpack archives of many kinds and transform 127 various binary formats into more human readable form to compare them. It can 128 compare two tarballs, ISO images, or PDF just as easily. The differences can 129 be shown in a text or HTML report. 130 131 diffoscope is developed as part of the "reproducible builds" Debian 132 project and was formerly known as "debbindiff". 133 ''; 134 homepage = "https://diffoscope.org/"; 135 license = licenses.gpl3Plus; 136 maintainers = with maintainers; [ dezgeg danielfullmer raitobezarius ]; 137 platforms = platforms.unix; 138 }; 139}