nixpkgs-suyu/pkgs/tools/X11/xdg-utils/default.nix
aszlig 2467c437b7
xdg_utils: Fix wrong substitution of grep command.
Fixes regression introduced by 16406e63b3.

Not replacing "egrep" with a negated character class on [^e] needs to be
put back into the replacement, because if we have something like:

foo="$(grep xxx)"

The replacement would be something like this:

foo="$/nix/store/.../bin/grep xxx)"

Which will lead to wrong behavior and in cases of for example
"xdg-screensaver", even directly to a syntax error:

xdg-screensaver: line 178: syntax error near unexpected token `('
xdg-screensaver: line 178: `command="/nix/store/.../bin/grep -E
                            "^Exec(\[[^]=]*])?=" "$file" |
                            /nix/store/.../bin/cut -d= -f 2- |
                            first_word`"'

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2015-07-05 09:25:13 +02:00

35 lines
1.3 KiB
Nix

{ stdenv, fetchgit, file, libxslt, docbook_xml_dtd_412, docbook_xsl, xmlto
, w3m, which, gnugrep, gnused, coreutils }:
stdenv.mkDerivation rec {
name = "xdg-utils-1.1.0-rc3p7";
src = fetchgit {
url = "http://anongit.freedesktop.org/git/xdg/xdg-utils.git";
rev = "e8ee3b18d16e41b95148111b920a0c8beed3ac6c";
sha256 = "0qy9h7vh6sw7wmadjvasw4sdhb9fvv7bn32ifgasdx7ag3r3939w";
};
# just needed when built from git
buildInputs = [ libxslt docbook_xml_dtd_412 docbook_xsl xmlto w3m ];
postInstall = ''
for item in $out/bin/*; do
substituteInPlace $item --replace "cut " "${coreutils}/bin/cut "
substituteInPlace $item --replace "sed " "${gnused}/bin/sed "
substituteInPlace $item --replace "egrep " "${gnugrep}/bin/egrep "
sed -i $item -re "s#([^e])grep #\1${gnugrep}/bin/grep #g" # Don't replace 'egrep'
substituteInPlace $item --replace "which " "${which}/bin/which "
substituteInPlace $item --replace "/usr/bin/file" "${file}/bin/file"
done
'';
meta = {
homepage = http://portland.freedesktop.org/wiki/;
description = "A set of command line tools that assist applications with a variety of desktop integration tasks";
license = stdenv.lib.licenses.free;
maintainers = [ stdenv.lib.maintainers.eelco ];
platforms = stdenv.lib.platforms.linux;
};
}