[packages/linux-gpib] - hopefully resolved udev/hotplug/firmwaredir packaging issues; added firmwaredir patch for hotplug

qboosh qboosh at pld-linux.org
Wed Jul 6 17:46:22 CEST 2016


commit 08f3bc97a5b3f182a8eb02264dc8b5f25e5a20c9
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Wed Jul 6 17:46:30 2016 +0200

    - hopefully resolved udev/hotplug/firmwaredir packaging issues; added firmwaredir patch for hotplug scripts

 linux-gpib-firmwaredir.patch | 51 +++++++++++++++++++++++++++++++++++++++++
 linux-gpib.spec              | 54 ++++++++++++++++++++++++++++++++++++--------
 2 files changed, 95 insertions(+), 10 deletions(-)
---
diff --git a/linux-gpib.spec b/linux-gpib.spec
index a068b36..b771b5b 100644
--- a/linux-gpib.spec
+++ b/linux-gpib.spec
@@ -1,5 +1,5 @@
 # TODO:
-# - resolve udev vs hotplug issues (use /lib/udev/rules.d, don't require /etc/hotplug dir with udev)
+# - where to get firmware from?
 # - guile 2 support
 # - PHP 7 support
 #
@@ -9,6 +9,7 @@
 %bcond_without	verbose		# verbose modules build (V=1)
 
 %bcond_without	docs		# documentation build
+%bcond_with	hotplug		# legacy hotplug support
 %bcond_without	static_libs	# static library
 %bcond_with	guile		# guile binding
 %bcond_without	perl		# Perl binding
@@ -30,6 +31,7 @@ Patch0:		%{name}-include_file.patch
 Patch1:		%{name}-destdir.patch
 Patch2:		%{name}-python.patch
 Patch3:		%{name}-perl.patch
+Patch4:		%{name}-firmwaredir.patch
 URL:		http://linux-gpib.sourceforge.net/
 BuildRequires:	autoconf >= 2.50
 BuildRequires:	automake
@@ -58,6 +60,19 @@ The Linux GPIB package provides support for GPIB (IEEE 488) hardware.
 %description -l pl.UTF-8
 Pakiet Linux GPIB służy do obsługi sprzętu GPIB (IEEE 488).
 
+%package hotplug
+Summary:	Linux GPIB support for legacy USB hotplug
+Summary(pl.UTF-8):	Obsługa Linux GPIB dla starego systemu hotplug USB
+Group:		Applications/System
+Requires:	%{name} = %{version}-%{release}
+Requires:	hotplug
+
+%description hotplug
+Linux GPIB support for legacy USB hotplug.
+
+%description hotplug -l pl.UTF-8
+Obsługa Linux GPIB dla starego systemu hotplug USB.
+
 %package libs
 Summary:	Shared GPIB library
 Summary(pl.UTF-8):	Biblioteka współdzielona GPIB
@@ -190,6 +205,7 @@ cd drivers/gpib\
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
 
 # disable modules build by default, just install userspace header
 echo 'SUBDIRS = gpib/include' > drivers/Makefile.am
@@ -238,7 +254,15 @@ cp -a drivers/gpib/installed/* $RPM_BUILD_ROOT
 
 %if %{with userspace}
 %{__make} install \
-	DESTDIR=$RPM_BUILD_ROOT
+	DESTDIR=$RPM_BUILD_ROOT \
+	HOTPLUG_USB_CONF_DIR=/lib/udev \
+	UDEV_RULES_DIR=/lib/udev/rules.d \
+	USB_FIRMWARE_DIR=/lib/firmware
+# use udev paths as base and legacy hotplug as addon (not the opposite)
+install -d $RPM_BUILD_ROOT/etc/hotplug/usb
+%{__mv} $RPM_BUILD_ROOT/lib/udev/*.usermap $RPM_BUILD_ROOT/etc/hotplug/usb
+ln -snf /lib/udev/agilent_82357a $RPM_BUILD_ROOT/etc/hotplug/usb/agilent_82357a
+ln -snf /lib/udev/ni_usb_gpib $RPM_BUILD_ROOT/etc/hotplug/usb/ni_usb_gpib
 
 # obsoleted by pkg-config
 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib.la
@@ -280,18 +304,28 @@ rm -rf $RPM_BUILD_ROOT
 %attr(755,root,root) %{_bindir}/ibterm
 %attr(755,root,root) %{_bindir}/ibtest
 %attr(755,root,root) %{_sbindir}/gpib_config
-# TODO: move to /lib/udev/rules.d
-/etc/udev/rules.d/99-agilent_82357a.rules
-/etc/udev/rules.d/99-gpib-generic.rules
-/etc/udev/rules.d/99-ni_usb_gpib.rules
-# TODO: paths to fix (scripts used also in udev .rules)
+/lib/udev/rules.d/99-agilent_82357a.rules
+/lib/udev/rules.d/99-gpib-generic.rules
+/lib/udev/rules.d/99-ni_usb_gpib.rules
+%attr(755,root,root) /lib/udev/agilent_82357a
+%attr(755,root,root) /lib/udev/ni_usb_gpib
+%dir /lib/firmware/agilent_82357a
+# TODO:
+#/lib/firmware/agilent_82357a/82357a_fw.hex
+#/lib/firmware/agilent_82357a/measat_releaseX1.8.hex
+%dir /lib/firmware/ni_usb_gpib
+# TODO:
+#/lib/firmware/ni_usb_gpib/niusbb_firmware.hex
+#/lib/firmware/ni_usb_gpib/niusbb_loader.hex
+
+%if %{with hotplug}
+%files hotplug
+%defattr(644,root,root,755)
 %attr(755,root,root) /etc/hotplug/usb/agilent_82357a
 %attr(755,root,root) /etc/hotplug/usb/ni_usb_gpib
 /etc/hotplug/usb/agilent_82357a.usermap
 /etc/hotplug/usb/ni_usb_gpib.usermap
-# /lib/firmware/...; and where are the files?
-%dir %{_datadir}/usb/agilent_82357a
-%dir %{_datadir}/usb/ni_usb_gpib
+%endif
 
 %files libs
 %defattr(644,root,root,755)
diff --git a/linux-gpib-firmwaredir.patch b/linux-gpib-firmwaredir.patch
new file mode 100644
index 0000000..ef3a4b1
--- /dev/null
+++ b/linux-gpib-firmwaredir.patch
@@ -0,0 +1,51 @@
+--- linux-gpib-4.0.3/usb/agilent_82357a/agilent_82357a.orig	2016-04-09 15:33:10.000000000 +0200
++++ linux-gpib-4.0.3/usb/agilent_82357a/agilent_82357a	2016-07-05 22:01:15.232112298 +0200
+@@ -1,7 +1,7 @@
+ #!/bin/sh
+ 
+ GPIB_CONFIG_OPTIONS="--minor 0"
+-DATADIR=/usr/share
++FIRMWAREDIR=/lib/firmware
+ FXLOAD=fxload
+ FXLOAD_OPTIONS=
+ 
+@@ -47,7 +47,7 @@
+ 
+ # 82357a without firmware
+ 957/7/*)
+-	FIRMWARE=$DATADIR/usb/agilent_82357a/82357a_fw.hex
++	FIRMWARE=$FIRMWAREDIR/agilent_82357a/82357a_fw.hex
+ 	;;
+ 
+ # 82357b with firmware already loaded
+@@ -57,7 +57,7 @@
+ 
+ # 82357b without firmware
+ 957/518/*)
+-	FIRMWARE=$DATADIR/usb/agilent_82357a/measat_releaseX1.8.hex
++	FIRMWARE=$FIRMWAREDIR/agilent_82357a/measat_releaseX1.8.hex
+ 	FXLOAD_OPTIONS="-t fx2"
+ 	;;
+ 
+--- linux-gpib-4.0.3/usb/ni_usb_gpib/ni_usb_gpib.orig	2016-04-09 15:33:10.000000000 +0200
++++ linux-gpib-4.0.3/usb/ni_usb_gpib/ni_usb_gpib	2016-07-05 22:01:43.015295116 +0200
+@@ -1,7 +1,7 @@
+ #!/bin/sh
+ 
+ GPIB_CONFIG_OPTIONS="--minor 0"
+-DATADIR=/usr/share
++FIRMWAREDIR=/lib/firmware
+ FXLOAD=fxload
+ FXLOAD_OPTIONS="-t fx"
+ 
+@@ -48,8 +48,8 @@
+ 
+ # ni-usb-b or kusb-488 without firmware
+ 3923/702b/* | 3923/713b/*)
+-	FIRMWARE=$DATADIR/usb/ni_usb_gpib/niusbb_firmware.hex
+-	SS_LOADER=$DATADIR/usb/ni_usb_gpib/niusbb_loader.hex
++	FIRMWARE=$FIRMWAREDIR/ni_usb_gpib/niusbb_firmware.hex
++	SS_LOADER=$FIRMWAREDIR/ni_usb_gpib/niusbb_loader.hex
+ 	;;
+ 
+ # ni-usb-hs
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/linux-gpib.git/commitdiff/08f3bc97a5b3f182a8eb02264dc8b5f25e5a20c9



More information about the pld-cvs-commit mailing list