From 8560887e887e1dc2218554e99f755eefdd4bd42b Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 1 Dec 2018 14:07:00 +0100 Subject: [PATCH] usbutils: fix usb.ids path The utility switched from /usr/share to ${datadir}, but it is still not enough for use. It would be nice if upstream provided configure flag. --- pkgs/os-specific/linux/usbutils/default.nix | 17 +++++++++-------- pkgs/os-specific/linux/usbutils/fix-paths.patch | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 pkgs/os-specific/linux/usbutils/fix-paths.patch diff --git a/pkgs/os-specific/linux/usbutils/default.nix b/pkgs/os-specific/linux/usbutils/default.nix index 8d53756d5101..d58c5a7e67c2 100644 --- a/pkgs/os-specific/linux/usbutils/default.nix +++ b/pkgs/os-specific/linux/usbutils/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, pkgconfig, libusb1, hwdata }: +{ stdenv, fetchurl, substituteAll, autoreconfHook, pkgconfig, libusb1, hwdata }: stdenv.mkDerivation rec { name = "usbutils-010"; @@ -8,14 +8,15 @@ stdenv.mkDerivation rec { sha256 = "06aag4jfgsfjxk563xsp9ik9nadihmasrr37a1gb0vwqni5kdiv1"; }; - nativeBuildInputs = [ pkgconfig ]; - buildInputs = [ libusb1 ]; + patches = [ + (substituteAll { + src = ./fix-paths.patch; + inherit hwdata; + }) + ]; - postInstall = - '' - substituteInPlace $out/bin/lsusb.py \ - --replace /usr/share/usb.ids ${hwdata}/share/hwdata/usb.ids - ''; + nativeBuildInputs = [ autoreconfHook pkgconfig ]; + buildInputs = [ libusb1 ]; meta = with stdenv.lib; { homepage = http://www.linux-usb.org/; diff --git a/pkgs/os-specific/linux/usbutils/fix-paths.patch b/pkgs/os-specific/linux/usbutils/fix-paths.patch new file mode 100644 index 000000000000..d75c68505efc --- /dev/null +++ b/pkgs/os-specific/linux/usbutils/fix-paths.patch @@ -0,0 +1,16 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -51,11 +51,11 @@ + usbreset.c + + lsusb.py: $(srcdir)/lsusb.py.in +- sed 's|VERSION|$(VERSION)|g;s|@usbids@|$(datadir)/usb.ids|g' $< >$@ ++ sed 's|VERSION|$(VERSION)|g;s|@usbids@|@hwdata@/share/hwdata/usb.ids|g' $< >$@ + chmod 755 $@ + + lsusb.8: $(srcdir)/lsusb.8.in +- sed 's|VERSION|$(VERSION)|g;s|@usbids@|$(datadir)/usb.ids|g' $< >$@ ++ sed 's|VERSION|$(VERSION)|g;s|@usbids@|@hwdata@/share/hwdata/usb.ids|g' $< >$@ + + usb-devices.1: $(srcdir)/usb-devices.1.in + sed 's|VERSION|$(VERSION)|g' $< >$@