github-backup: 0.48.0 -> 0.49.0 (#379003)
[NixPkgs.git] / pkgs / by-name / de / debian-devscripts / package.nix
blob2d92cac2eea7f3423d413b83d0f3708aaf459d9f
2   lib,
3   stdenv,
4   fetchurl,
5   fetchpatch,
6   xz,
7   dpkg,
8   libxslt,
9   docbook_xsl,
10   makeWrapper,
11   writeShellScript,
12   python3Packages,
13   perlPackages,
14   curl,
15   gnupg,
16   diffutils,
17   nano,
18   pkg-config,
19   bash-completion,
20   help2man,
21   sendmailPath ? "/run/wrappers/bin/sendmail",
24 let
25   inherit (python3Packages) python setuptools;
26   sensible-editor = writeShellScript "sensible-editor" ''
27     exec ''${EDITOR-${nano}/bin/nano} "$@"
28   '';
30 stdenv.mkDerivation rec {
31   version = "2.23.5";
32   pname = "debian-devscripts";
34   src = fetchurl {
35     url = "mirror://debian/pool/main/d/devscripts/devscripts_${version}.tar.xz";
36     hash = "sha256-j0fUVTS/lPKFdgeMhksiJz2+E5koB07IK2uEj55EWG0=";
37   };
39   patches = [
40     (fetchpatch {
41       name = "hardening-check-obey-binutils-env-vars.patch";
42       url = "https://github.com/Debian/devscripts/pull/2/commits/c6a018e0ef50a1b0cb4962a2f96dae7c6f21f1d4.patch";
43       hash = "sha256-UpS239JiAM1IYxNuJLdILq2h0xlR5t0Tzhj47xiMHww=";
44     })
45   ];
47   postPatch = ''
48     substituteInPlace scripts/Makefile --replace /usr/share/dpkg ${dpkg}/share/dpkg
49     substituteInPlace scripts/debrebuild.pl --replace /usr/bin/perl ${perlPackages.perl}/bin/perl
50     patchShebangs scripts
51   '';
53   nativeBuildInputs = [
54     makeWrapper
55     pkg-config
56   ];
57   buildInputs =
58     [
59       xz
60       dpkg
61       libxslt
62       python
63       setuptools
64       curl
65       gnupg
66       diffutils
67       bash-completion
68       help2man
69     ]
70     ++ (with perlPackages; [
71       perl
72       CryptSSLeay
73       LWP
74       TimeDate
75       DBFile
76       FileDesktopEntry
77       ParseDebControl
78       LWPProtocolHttps
79       Moo
80       FileHomeDir
81       IPCRun
82       FileDirList
83       FileTouch
84     ]);
86   preConfigure = ''
87     export PERL5LIB="$PERL5LIB''${PERL5LIB:+:}${dpkg}";
88     tgtpy="$out/${python.sitePackages}"
89     mkdir -p "$tgtpy"
90     export PYTHONPATH="$PYTHONPATH''${PYTHONPATH:+:}$tgtpy"
91     find lib po4a scripts -type f -exec sed -r \
92       -e "s@/usr/bin/gpg(2|)@${gnupg}/bin/gpg@g" \
93       -e "s@/usr/(s|)bin/sendmail@${sendmailPath}@g" \
94       -e "s@/usr/bin/diff@${diffutils}/bin/diff@g" \
95       -e "s@/usr/bin/gpgv(2|)@${gnupg}/bin/gpgv@g" \
96       -e "s@(command -v|/usr/bin/)curl@${curl.bin}/bin/curl@g" \
97       -e "s@sensible-editor@${sensible-editor}@g" \
98       -e "s@(^|\W)/bin/bash@\1${stdenv.shell}@g" \
99       -i {} +
100     sed -e "s@/usr/share/sgml/[^ ]*/manpages/docbook.xsl@${docbook_xsl}/xml/xsl/docbook/manpages/docbook.xsl@" -i scripts/Makefile
101     sed -r \
102       -e "s@/usr( |$|/)@$out\\1@g" \
103       -e "s@/etc( |$|/)@$out/etc\\1@g" \
104       -e 's/ translated_manpages//; s/--install-layout=deb//; s@--root="[^ ]*"@--prefix="'"$out"'"@' \
105       -i Makefile* */Makefile*
106   '';
108   makeFlags = [
109     "DESTDIR=$(out)"
110     "PREFIX="
111     "COMPL_DIR=/share/bash-completion/completions"
112     "PERLMOD_DIR=/share/devscripts"
113   ];
115   postInstall = ''
116     sed -re 's@(^|[ !`"])/bin/bash@\1${stdenv.shell}@g' -i "$out/bin"/*
117     for i in "$out/bin"/*; do
118       wrapProgram "$i" \
119         --prefix PERL5LIB : "$PERL5LIB" \
120         --prefix PERL5LIB : "$out/share/devscripts" \
121         --prefix PYTHONPATH : "$out/${python.sitePackages}" \
122         --prefix PATH : "${dpkg}/bin"
123     done
124     ln -s cvs-debi $out/bin/cvs-debc
125     ln -s debchange $out/bin/dch
126     ln -s pts-subscribe $out/bin/pts-unsubscribe
127   '';
129   meta = with lib; {
130     description = "Debian package maintenance scripts";
131     license = licenses.free; # Mix of public domain, Artistic+GPL, GPL1+, GPL2+, GPL3+, and GPL2-only... TODO
132     maintainers = with maintainers; [ raskin ];
133     platforms = platforms.unix;
134   };