1{stdenv, fetchurl, perl, CryptSSLeay, LWP, unzip, xz, dpkg, TimeDate, DBFile
2, FileDesktopEntry, libxslt, docbook_xsl, python3, setuptools, makeWrapper
3, perlPackages
4}:
5stdenv.mkDerivation rec {
6 version = "2.15.4";
7 name = "debian-devscripts-${version}";
8 src = fetchurl {
9 url = "mirror://debian/pool/main/d/devscripts/devscripts_${version}.tar.xz";
10 sha256 = "03ldbx07ga9df7z9yiq6grb6cms1dr8hlbis2hvbmfcs6gcr3q72";
11 };
12 buildInputs = [ perl CryptSSLeay LWP unzip xz dpkg TimeDate DBFile
13 FileDesktopEntry libxslt python3 setuptools makeWrapper
14 perlPackages.ParseDebControl ];
15 preConfigure = ''
16 export PERL5LIB="$PERL5LIB''${PERL5LIB:+:}${dpkg}";
17 sed -e "s@/usr/share/sgml/[^ ]*/manpages/docbook.xsl@${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl@" -i scripts/Makefile
18 sed -e 's/ translated_manpages//; s/--install-layout=deb//; s@--root="[^ ]*"@--prefix="'"$out"'"@' -i Makefile */Makefile
19 tgtpy="$out/lib/${python3.libPrefix}/site-packages"
20 mkdir -p "$tgtpy"
21 export PYTHONPATH="$PYTHONPATH''${PYTHONPATH:+:}$tgtpy"
22 sed -re "s@/usr( |$|/)@$out\\1@" -i Makefile* */Makefile*
23 sed -re "s@/etc( |$|/)@$out/etc\\1@" -i Makefile* */Makefile*
24
25 # Completion currently spams every shell startup with an error. Disable for now:
26 sed "/\/bash_completion\.d/d" -i scripts/Makefile
27 '';
28 postInstall = ''
29 sed -re 's@(^|[ !`"])/bin/bash@\1${stdenv.shell}@g' -i "$out/bin"/*
30 for i in "$out/bin"/*; do
31 wrapProgram "$i" \
32 --prefix PERL5LIB : "$PERL5LIB" \
33 --prefix PERL5LIB : "$out/share/devscripts" \
34 --prefix PYTHONPATH : "$out/lib/python3.4/site-packages"
35 done
36 '';
37 meta = {
38 description = ''Debian package maintenance scripts'';
39 license = "GPL (various)"; # Mix of public domain, Artistic+GPL, GPL1+, GPL2+, GPL3+, and GPL2-only... TODO
40 maintainers = with stdenv.lib.maintainers; [raskin];
41 };
42}