[Spice-devel] [PATCH spice-streaming-agent v2 1/5] Install udev rule

Frediano Ziglio fziglio at redhat.com
Tue May 22 11:11:15 UTC 2018


> 
> On Mon, May 21, 2018 at 11:45:27AM +0100, Frediano Ziglio wrote:
> > The udev rule is used to do some action when the device is added to the
> > system. Current rule change the permission of the special file to allow to
> > open it by any user.
> 
> I thought this was a temporary 'hack' until we have a better way of
> handling this?
> 

Yes, you can note the rule is changed in a following patch.

> > Some systems use /lib/udev while others use /usr/lib/udev.
> > Allow to specify the full path to support both type of systems.
> 
> Maybe $ pkg-config udev --variable udevdir
> /usr/lib/udev
> could be used for that?
> 

I suppose we can use pkg-config to get the default.
About rpm and spec file is not clear which dependency to add to
get the pkg-config file. Maybe "pkgconfig(udev)" ?

> Christophe
> 

I think something like this could do (tested):


diff --git a/configure.ac b/configure.ac
index a75f22c..4e4f5c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,10 +52,12 @@ PKG_CHECK_MODULES(JPEG, libjpeg, , [
 ])
 AC_SUBST(JPEG_LIBS)

+PKG_CHECK_VAR([UDEVRULESDIR], [udev], [udevdir],
+[UDEVRULESDIR="$UDEVRULESDIR/rules.d"], [UDEVRULESDIR=/usr/lib/udev/rules.d])
+
 AC_ARG_WITH(udevrulesdir,
     [AS_HELP_STRING([--with-udevrulesdir=DIR], [udev rules.d directory])],
-    [UDEVRULESDIR="$withval"],
-    [UDEVRULESDIR=/usr/lib/udev/rules.d]
+    [UDEVRULESDIR="$withval"]
 )
 AC_SUBST(UDEVRULESDIR)

diff --git a/spice-streaming-agent.spec.in b/spice-streaming-agent.spec.in
index 5f4eec9..801e81e 100644
--- a/spice-streaming-agent.spec.in
+++ b/spice-streaming-agent.spec.in
@@ -1,5 +1,3 @@
-%{!?_udevrulesdir:%define _udevrulesdir /usr/lib/udev/rules.d}
-
 Name:           spice-streaming-agent
 Version:        @VERSION@
 Release:        1%{?dist}
@@ -13,6 +11,7 @@ BuildRequires:  libX11-devel libXfixes-devel
 BuildRequires:  libjpeg-turbo-devel
 BuildRequires:  catch-devel
 BuildRequires:  systemd-devel
+BuildRequires:  pkgconfig(udev)
 # we need /usr/sbin/semanage program which is available on different
 # packages depending on distribution
 Requires(post): /usr/sbin/semanage
@@ -34,7 +33,7 @@ agent plugins.
 %setup -q

 %build
-%configure --enable-tests --with-udevrulesdir=%{_udevrulesdir}
+%configure --enable-tests %{?_udevrulesdir:--with-udevrulesdir=%{_udevrulesdir}}
 make %{?_smp_mflags} V=1

 %check


Frediano


More information about the Spice-devel mailing list