[libconcord] fix build with gcc 4.7, add modern udev-acl support and finally fix perms

Adam Williamson adamwill at fedoraproject.org
Tue Jan 17 02:18:22 UTC 2012


commit 41b2d07a463d3cca8a1b46d590726186d926515f
Author: Adam Williamson <awilliam at redhat.com>
Date:   Mon Jan 16 18:04:15 2012 -0800

    fix build with gcc 4.7, add modern udev-acl support and finally fix perms

 libconcord-0.23-gcc47.patch       |   20 +++++
 libconcord-0.23-modern_udev.patch |  160 +++++++++++++++++++++++++++++++++++++
 libconcord-0.23-udev_acl.patch    |   13 ---
 libconcord.spec                   |   25 +++++-
 4 files changed, 203 insertions(+), 15 deletions(-)
---
diff --git a/libconcord-0.23-gcc47.patch b/libconcord-0.23-gcc47.patch
new file mode 100644
index 0000000..41a58d4
--- /dev/null
+++ b/libconcord-0.23-gcc47.patch
@@ -0,0 +1,20 @@
+--- concordance-0.23/libconcord/web.cpp	2008-10-12 15:35:26.000000000 -0700
++++ concordance-0.23/libconcord/web.cpp.new	2012-01-16 15:00:33.217383495 -0800
+@@ -34,6 +34,7 @@
+ #include <strings.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
++#include <unistd.h>
+ #define closesocket close
+ #define SOCKET int
+ #define SOCKET_ERROR -1
+--- concordance-0.23/libconcord/usblan.cpp	2012-01-16 15:03:45.612257649 -0800
++++ concordance-0.23/libconcord/usblan.cpp.new	2012-01-16 15:03:52.264341295 -0800
+@@ -31,6 +31,7 @@
+ #else
+ #include <sys/socket.h>
+ #include <netdb.h>
++#include <unistd.h>
+ #define closesocket close
+ #define SOCKET int
+ #define SOCKET_ERROR -1
diff --git a/libconcord-0.23-modern_udev.patch b/libconcord-0.23-modern_udev.patch
new file mode 100644
index 0000000..5efd8f4
--- /dev/null
+++ b/libconcord-0.23-modern_udev.patch
@@ -0,0 +1,160 @@
+diff -urN concordance-0.23/libconcord/gen_udev_support concordance-0.23-new/libconcord/gen_udev_support
+--- concordance-0.23/libconcord/gen_udev_support	2009-02-26 10:22:49.000000000 -0800
++++ concordance-0.23-new/libconcord/gen_udev_support	2012-01-16 17:37:26.867310609 -0800
+@@ -15,7 +15,8 @@
+ #
+ 
+ UDEV_POLICY_TEMPLATE='ATTR{idVendor}=="%s", ATTR{idProduct}=="%s", SYMLINK+="harmony-%%k"'
+-UDEV_NO_POLICY_TEMPLATE='SYSFS{idVendor}=="%s", SYSFS{idProduct}=="%s", MODE="0660", GROUP="dialout"'
++UDEV_NEW_NO_POLICY_TEMPLATE='ATTR{idVendor}=="%s", ATTR{idProduct}=="%s", ENV{ID_REMOTE_CONTROL}="1"'
++UDEV_OLD_NO_POLICY_TEMPLATE='SYSFS{idVendor}=="%s", SYSFS{idProduct}=="%s", MODE="0660", GROUP="dialout"'
+ 
+ HAL_PRE_TEMPLATE='    <match key="usb_device.vendor_id" int="0x%s">'
+ HAL_RULE_TEMPLATE='      <match key="usb_device.product_id" int="0x%s">
+@@ -66,7 +67,7 @@
+ # Neat trick so that non-harmony devices don't read through a million rules
+ SUBSYSTEM=="usb_device", GOTO="harmony_usb_rules"
+ SUBSYSTEM=="usb", GOTO="harmony_usb_rules"
+-BUS!="usb", GOTO="harmony_rules_end"
++SUBSYSTEM!="usb", GOTO="harmony_rules_end"
+ GOTO="harmony_rules_end"
+ LABEL="harmony_usb_rules"
+ END
+@@ -85,8 +86,10 @@
+     type="$2"
+     if [ "$type" == 'policykit' -o "$type" == 'consolekit' ]; then
+         template="$UDEV_POLICY_TEMPLATE"
++    elif [ "$type" == 'old_udev' ]; then
++        template="$UDEV_OLD_NO_POLICY_TEMPLATE"
+     else
+-        template="$UDEV_NO_POLICY_TEMPLATE"
++        template="$UDEV_NEW_NO_POLICY_TEMPLATE"
+     fi
+ 
+     emit_for_all $file "$template" 'yes'
+@@ -192,14 +195,14 @@
+ #
+ 
+ usage() {
+-    echo "Usage: $0 <-u|-p|-c>"
++    echo "Usage: $0 <-u|-p|-c|-o>"
+ }
+ 
+ #
+ # MAIN
+ #
+ 
+-while getopts upc opt; do
++while getopts upco opt; do
+     case $opt in
+         u)
+             MODE='udev_only'
+@@ -210,6 +213,9 @@
+         c)
+             MODE='consolekit'
+             ;;
++        o)
++            MODE='old_udev'
++            ;;
+         *)
+             usage
+             exit 1
+diff -urN concordance-0.23/libconcord/INSTALL.linux concordance-0.23-new/libconcord/INSTALL.linux
+--- concordance-0.23/libconcord/INSTALL.linux	2010-08-01 09:00:42.000000000 -0700
++++ concordance-0.23-new/libconcord/INSTALL.linux	2012-01-16 17:47:03.024191082 -0800
+@@ -31,34 +31,62 @@
+ 3. INSTALL UDEV/CONSOLEKIT/POLICYKIT SUPPORT (OPTIONAL)
+ 
+ If you don't want to have to be root to use concordance (or any other
+-libconcord frontend), you'll need to set up udev, consolekit, or policykit
+-support. If you don't know which of these your distribution uses, then the
+-plain udev support will work:
++libconcord frontend), you'll need to set up udev-acl, hal/consolekit, 
++hal/policykit or old udev support.
++
++Most modern distributions should use the udev-acl support. udev versions since
++167, released on 2011-03-30, have the necessary support for this method to
++work.
++
++With this option, all locally logged-in users will be able to have access
++to the remote control, but remote users (such as those logged in via ssh or
++fast user switching) will not. This support does not depend on anything beyond
++a sufficiently recent version of udev itself. To use the udev-acl support, do:
+ 
+   make udev
+   sudo make install_udev
+ 
+-This will allow anyone in the "dialout" group to read and write to harmony
+-remote controls connected to the machine.
++If you have an older distribution without a recent enough version of udev, you
++can choose between old-style generic udev support, hal/consolekit support, and
++hal/policykit support.
+ 
+-Alternatively, if you use policykit (fedora, and ubuntu, for example), you can
+-do:
++To use hal/policykit support, you can do:
+ 
+   make policykit
+   sudo make install_policykit
+ 
+-This will generate a different udev file and all the appropriate policykit
++This will generate a different udev file and all the appropriate HAL/policykit
+ files and install them in the right place for the console user to have access
+-to the remote when it's plugged in. In otherwords, there is no need to do udev
+-and policykit - policykit will take care of everything needed for policykit.
++to the remote when it's plugged in. It will work only if your distribution has
++udev, HAL and PolicyKit of around the correct vintage - approximately, the
++versions that were current in early 2009 - correctly built to work with each
++other.
+ 
+-If your system is using consolekit, then you can use:
++To use hal/consolekit, you can do:
+ 
+   make consolekit
+   sudo make install_consolekit
+ 
+-If you're not sure which method your system uses, the udev one will work on
+-all systems. 
++This will do much the same as the hal/policykit support does, only with
++consolekit instead. As with the hal/policykit support, it depends on having
++udev, HAL and ConsoleKit of an early 2009 vintage, correctly built to work
++together.
++
++The safest option for old systems is the old generic udev support:
++
++  make old-udev
++  sudo make install_old-udev
++
++This will allow anyone in the "dialout" group to read and write to harmony
++remote controls connected to the machine. It should work with any udev system,
++including modern ones, but is a less sophisticated solution than the udev-acl
++support and requires you to add your user to the "dialout" group. 
++
++If you are not sure which method to use, and your distribution came out since
++March 2011, try the new udev option first, as it provides the cleanest
++configuration and most transparent operation. If it does not work, you can try
++the hal/consolekit or hal/policykit options, but old-udev is the most likely
++to work.
+ 
+ NOTE: By default the install prefix is /usr/local which means that the
+ udev/policykit/consolekit make targets will install in /usr/local/etc which
+diff -urN concordance-0.23/libconcord/Makefile.am concordance-0.23-new/libconcord/Makefile.am
+--- concordance-0.23/libconcord/Makefile.am	2010-08-14 14:17:04.000000000 -0700
++++ concordance-0.23-new/libconcord/Makefile.am	2012-01-16 17:12:27.975236664 -0800
+@@ -15,10 +15,15 @@
+ install_udev_generic:
+ 	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/udev/rules.d
+ 	$(install_sh_DATA) libconcord.rules \
+-		$(DESTDIR)$(sysconfdir)/udev/rules.d/99-libconcord.rules
++		$(DESTDIR)$(sysconfdir)/udev/rules.d/60-libconcord.rules
+ 
+ install_udev: udev install_udev_generic
+ 
++old-udev:
++	./gen_udev_support -o
++
++install_old-udev: old-udev install_udev_generic
++
+ policykit:
+ 	./gen_udev_support -p
+ 
diff --git a/libconcord.spec b/libconcord.spec
index 9b3ced3..e4399f4 100644
--- a/libconcord.spec
+++ b/libconcord.spec
@@ -3,7 +3,7 @@
 
 Name: libconcord
 Version: 0.23
-Release: 8%{?dist}
+Release: 9%{?dist}
 Summary: Library to talk to Logitech Harmony universal remote controls
 
 Group: Development/Libraries
@@ -11,7 +11,11 @@ License: GPLv3+
 URL: http://phildev.net/concordance/
 Source0: http://downloads.sourceforge.net/sourceforge/concordance/%{mainpkg}-%{version}.tar.bz2
 Patch0: libconcord-0.23-mime-type-def.patch
-Patch1: libconcord-0.23-udev_acl.patch
+# Fix build with GCC 4.7 - include unistd.h in two places
+Patch1: libconcord-0.23-gcc47.patch
+# Add a 'modern udev' option to the rules generator, which hooks into
+# udev-acl support, and also update some long-deprecated key names
+Patch2: libconcord-0.23-modern_udev.patch
 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 
 BuildRequires: libusb-devel
@@ -19,6 +23,11 @@ BuildRequires: swig
 BuildRequires: perl(ExtUtils::MakeMaker)
 BuildRequires: python-devel
 BuildRequires: python-setuptools-devel
+
+# only so long as modern_udev.patch is downstream
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: libtool
 Requires: udev
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
@@ -59,9 +68,14 @@ Python bindings for libconcord
 %setup -q -n %{mainpkg}-%{version}
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 %build
 cd %{name}
+
+# for modern_udev.patch
+autoreconf -i
+
 %configure --disable-static --disable-mime-update
 make %{_smp_mflags}
 
@@ -166,6 +180,13 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
 
 
 %changelog
+* Mon Jan 16 2012 Adam Williamson <awilliam at redhat.com> - 0.23-9
+- gcc47.patch: fix build with gcc 4.7 by including unistd.h
+- modern_udev.patch: add a 'modern udev' option to the rules generator
+  which uses udev-acl support, and use it. should finally fix
+  permissions issues, RHBZ #559412. Also fixes RHBZ #622670
+- drop the old acl patch, modern_udev.patch supersedes it
+
 * Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.23-8
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 


More information about the scm-commits mailing list