Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 3.1 kB view raw
1{lib, stdenv, fetchurl, xz, dpkg 2, libxslt, docbook_xsl, makeWrapper, writeShellScript 3, python3Packages 4, perlPackages, curl, gnupg, diffutils, nano, pkg-config, bash-completion, help2man 5, sendmailPath ? "/run/wrappers/bin/sendmail" 6}: 7 8let 9 inherit (python3Packages) python setuptools; 10 sensible-editor = writeShellScript "sensible-editor" '' 11 exec ''${EDITOR-${nano}/bin/nano} "$@" 12 ''; 13in stdenv.mkDerivation rec { 14 version = "2.22.2"; 15 pname = "debian-devscripts"; 16 17 src = fetchurl { 18 url = "mirror://debian/pool/main/d/devscripts/devscripts_${version}.tar.xz"; 19 hash = "sha256-Fflalt2JxqLS0gq0wy88pXCqiNvHj7sfP7fLwdSmUCs="; 20 }; 21 22 postPatch = '' 23 substituteInPlace scripts/Makefile --replace /usr/share/dpkg ${dpkg}/share/dpkg 24 substituteInPlace scripts/debrebuild.pl --replace /usr/bin/perl ${perlPackages.perl}/bin/perl 25 patchShebangs scripts 26 ''; 27 28 nativeBuildInputs = [ makeWrapper pkg-config ]; 29 buildInputs = [ xz dpkg libxslt python setuptools curl gnupg diffutils bash-completion help2man ] ++ 30 (with perlPackages; [ perl CryptSSLeay LWP TimeDate DBFile FileDesktopEntry ParseDebControl LWPProtocolHttps Moo FileHomeDir IPCRun FileDirList FileTouch ]); 31 32 preConfigure = '' 33 export PERL5LIB="$PERL5LIB''${PERL5LIB:+:}${dpkg}"; 34 tgtpy="$out/lib/${python.libPrefix}/site-packages" 35 mkdir -p "$tgtpy" 36 export PYTHONPATH="$PYTHONPATH''${PYTHONPATH:+:}$tgtpy" 37 find lib po4a scripts -type f -exec sed -r \ 38 -e "s@/usr/bin/gpg(2|)@${gnupg}/bin/gpg@g" \ 39 -e "s@/usr/(s|)bin/sendmail@${sendmailPath}@g" \ 40 -e "s@/usr/bin/diff@${diffutils}/bin/diff@g" \ 41 -e "s@/usr/bin/gpgv(2|)@${gnupg}/bin/gpgv@g" \ 42 -e "s@(command -v|/usr/bin/)curl@${curl.bin}/bin/curl@g" \ 43 -e "s@sensible-editor@${sensible-editor}@g" \ 44 -e "s@(^|\W)/bin/bash@\1${stdenv.shell}@g" \ 45 -i {} + 46 sed -e "s@/usr/share/sgml/[^ ]*/manpages/docbook.xsl@${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl@" -i scripts/Makefile 47 sed -r \ 48 -e "s@/usr( |$|/)@$out\\1@g" \ 49 -e "s@/etc( |$|/)@$out/etc\\1@g" \ 50 -e 's/ translated_manpages//; s/--install-layout=deb//; s@--root="[^ ]*"@--prefix="'"$out"'"@' \ 51 -i Makefile* */Makefile* 52 ''; 53 54 makeFlags = [ 55 "DESTDIR=$(out)" 56 "PREFIX=" 57 "COMPL_DIR=/share/bash-completion/completions" 58 "PERLMOD_DIR=/share/devscripts" 59 ]; 60 61 postInstall = '' 62 sed -re 's@(^|[ !`"])/bin/bash@\1${stdenv.shell}@g' -i "$out/bin"/* 63 for i in "$out/bin"/*; do 64 wrapProgram "$i" \ 65 --prefix PERL5LIB : "$PERL5LIB" \ 66 --prefix PERL5LIB : "$out/share/devscripts" \ 67 --prefix PYTHONPATH : "$out/${python.sitePackages}" \ 68 --prefix PATH : "${dpkg}/bin" 69 done 70 ln -s cvs-debi $out/bin/cvs-debc 71 ln -s debchange $out/bin/dch 72 ln -s pts-subscribe $out/bin/pts-unsubscribe 73 ''; 74 75 meta = with lib; { 76 description = "Debian package maintenance scripts"; 77 license = licenses.free; # Mix of public domain, Artistic+GPL, GPL1+, GPL2+, GPL3+, and GPL2-only... TODO 78 maintainers = with maintainers; [raskin]; 79 platforms = with platforms; linux; 80 }; 81}