rpms/system-config-printer/devel system-config-printer-525e996.patch, NONE, 1.1 system-config-printer.spec, 1.271, 1.272 system-config-printer-a05bd9c.patch, 1.1, NONE

Tim Waugh twaugh at fedoraproject.org
Sun Jul 26 18:43:25 UTC 2009


Author: twaugh

Update of /cvs/pkgs/rpms/system-config-printer/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv7096

Modified Files:
	system-config-printer.spec 
Added Files:
	system-config-printer-525e996.patch 
Removed Files:
	system-config-printer-a05bd9c.patch 
Log Message:
* Sun Jul 26 2009 Tim Waugh <twaugh at redhat.com> 1.1.10-4
- Split out D-Bus service for udev helper.


system-config-printer-525e996.patch:
 Makefile.am                              |   73 +
 aclocal.m4                               |  156 +++
 configure.in                             |    3 
 cupshelpers/ppds.py                      |   25 
 system-config-printer.py                 |    2 
 udev/70-printers.rules                   |    6 
 udev/com.redhat.PrinterConfig.conf       |   16 
 udev/com.redhat.PrinterConfig.service.in |    4 
 udev/com.redhat.PrinterConfig.xml        |   71 +
 udev/printer-config-daemon.c             | 1248 +++++++++++++++++++++++++++++++
 udev/printer-config-main.c               |  159 +++
 udev/printer-config.h                    |   76 +
 udev/udev-add-printer                    |   87 +-
 udev/udev-usb-printer.c                  |  454 +++++++++++
 14 files changed, 2325 insertions(+), 55 deletions(-)

--- NEW FILE system-config-printer-525e996.patch ---
diff -up system-config-printer-1.1.10/aclocal.m4.525e996 system-config-printer-1.1.10/aclocal.m4
--- system-config-printer-1.1.10/aclocal.m4.525e996	2009-07-22 13:54:02.000000000 +0100
+++ system-config-printer-1.1.10/aclocal.m4	2009-07-26 19:01:45.683356020 +0100
@@ -1867,6 +1867,162 @@ AC_DEFUN([AM_NLS],
   AC_SUBST(USE_NLS)
 ])
 
+# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
+# 
+# Copyright © 2004 Scott James Remnant <scott at netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+	_pkg_min_version=m4_default([$1], [0.9.0])
+	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+		AC_MSG_RESULT([yes])
+	else
+		AC_MSG_RESULT([no])
+		PKG_CONFIG=""
+	fi
+		
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists.  Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+#
+# Similar to PKG_CHECK_MODULES, make sure that the first instance of
+# this or PKG_CHECK_MODULES is called, or make sure to call
+# PKG_CHECK_EXISTS manually
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+  m4_ifval([$2], [$2], [:])
+m4_ifvaln([$3], [else
+  $3])dnl
+fi])
+
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+    pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+    PKG_CHECK_EXISTS([$3],
+                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
+		     [pkg_failed=yes])
+ else
+    pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+#
+#
+# --------------------------------------------------------------
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
+        else 
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+	ifelse([$4], , [AC_MSG_ERROR(dnl
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT
+])],
+		[AC_MSG_RESULT([no])
+                $4])
+elif test $pkg_failed = untried; then
+	ifelse([$4], , [AC_MSG_FAILURE(dnl
+[The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
+		[$4])
+else
+	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        AC_MSG_RESULT([yes])
+	ifelse([$3], , :, [$3])
+fi[]dnl
+])# PKG_CHECK_MODULES
+
 # po.m4 serial 15 (gettext-0.17)
 dnl Copyright (C) 1995-2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
diff -up system-config-printer-1.1.10/configure.in.525e996 system-config-printer-1.1.10/configure.in
--- system-config-printer-1.1.10/configure.in.525e996	2009-07-22 13:53:25.000000000 +0100
+++ system-config-printer-1.1.10/configure.in	2009-07-26 19:01:45.685355364 +0100
@@ -40,6 +40,9 @@ AC_ARG_WITH(udev-rules,
 AM_CONDITIONAL([UDEV_RULES], [test x$with_udev_rules != xno])
 
 if test x$with_udev_rules != xno; then
+   PKG_CHECK_MODULES(DBUS_GLIB, [dbus-glib-1 >= 0.76])
+   AC_SUBST(DBUS_GLIB_CFLAGS)
+   AC_SUBST(DBUS_GLIB_LIBS)
    AM_PROG_CC_C_O
 fi
 
diff -up system-config-printer-1.1.10/cupshelpers/ppds.py.525e996 system-config-printer-1.1.10/cupshelpers/ppds.py
--- system-config-printer-1.1.10/cupshelpers/ppds.py.525e996	2009-07-22 13:22:49.000000000 +0100
+++ system-config-printer-1.1.10/cupshelpers/ppds.py	2009-07-26 19:01:45.686355890 +0100
@@ -159,29 +159,32 @@ def ppdMakeModelSplit (ppd_make_and_mode
     # HP PPDs give NickNames like:
     # *NickName: "HP LaserJet 4 Plus v2013.111 Postscript (recommended)"
     # Find the version number.
-    v = model.find (" v")
+    modell = model.lower ()
+    v = modell.find (" v")
     if v != -1 and (model[v + 2].isdigit () or
                     (model[v + 2] == '.' and
                      model[v + 3].isdigit ())):
         # Truncate at that point.
         model = model[:v]
+        modell = modell[:v]
 
     for suffix in [" hpijs",
-                   " Foomatic/",
+                   " foomatic/",
[...2169 lines suppressed...]
+
+  syslog (LOG_DEBUG, "Device vendor/product is %04zX:%04zX",
+	  idVendor, idProduct);
+
+  usb_init ();
+  usb_find_busses ();
+  usb_find_devices ();
+  for (bus = usb_get_busses (); bus && !got; bus = bus->next)
+    {
+      struct usb_device *device;
+      for (device = bus->devices; device && !got; device = device->next)
+	{
+	  struct usb_config_descriptor *confptr;
+	  if (device->descriptor.idVendor != idVendor ||
+	      device->descriptor.idProduct != idProduct ||
+	      !device->config)
+	    continue;
+
+	  conf = 0;
+	  for (confptr = device->config;
+	       conf < device->descriptor.bNumConfigurations && !got;
+	       conf++, confptr++)
+	    {
+	      struct usb_interface *ifaceptr;
+	      iface = 0;
+	      for (ifaceptr = confptr->interface;
+		   iface < confptr->bNumInterfaces && !got;
+		   iface++, ifaceptr++)
+		{
+		  struct usb_interface_descriptor *altptr;
+		  int altset = 0;
+		  for (altptr = ifaceptr->altsetting;
+		       altset < ifaceptr->num_altsetting && !got;
+		       altset++, altptr++)
+		    {
+		      if (altptr->bInterfaceClass == USB_CLASS_PRINTER &&
+			  altptr->bInterfaceSubClass == 1)
+			{
+			  int n;
+			  handle = usb_open (device);
+			  if (!handle)
+			    {
+			      syslog (LOG_DEBUG, "failed to open device");
+			      continue;
+			    }
+
+			  n = altptr->bInterfaceNumber;
+			  if (usb_claim_interface (handle, n) < 0)
+			    {
+			      usb_close (handle);
+			      handle = NULL;
+			      syslog (LOG_DEBUG, "failed to claim interface");
+			      continue;
+			    }
+
+			  if (n != 0 && usb_claim_interface (handle, 0) < 0)
+			    {
+			      usb_close (handle);
+			      handle = NULL;
+			      syslog (LOG_DEBUG, "failed to claim interface 0");
+			      continue;
+			    }
+
+			  n = altptr->bAlternateSetting;
+			  if (usb_set_altinterface (handle, n) < 0)
+			    {
+			      usb_close (handle);
+			      handle = NULL;
+			      syslog (LOG_DEBUG, "failed set altinterface");
+			      continue;
+			    }
+
+			  memset (ieee1284_id, '\0', sizeof (ieee1284_id));
+			  if (usb_control_msg (handle,
+					       USB_TYPE_CLASS |
+					       USB_ENDPOINT_IN |
+					       USB_RECIP_INTERFACE,
+					       0, conf, iface,
+					       ieee1284_id,
+					       sizeof (ieee1284_id),
+					       5000) < 0)
+			    {
+			      usb_close (handle);
+			      handle = NULL;
+			      syslog (LOG_ERR, "Failed to fetch Device ID");
+			      continue;
+			    }
+
+			  got = 1;
+			  usb_close (handle);
+			  break;
+			}
+		    }
+		}
+	    }
+	}
+    }
+
+ got_deviceid:
+  if (got)
+    {
+      if (!device_id)
+	device_id = ieee1284_id + 2;
+      parse_device_id (device_id, id);
+    }
+
+  udev_device_unref (dev);
+  udev_unref (udev);
+  return usb_device_devpath;
+}
+
+static int
+do_add (DBusGProxy *proxy, const char *devpath)
+{
+  GError *error = NULL;
+  struct device_id id;
+  char *usb_device_devpath;
+  char usbserial[256];
+
+  syslog (LOG_DEBUG, "add %s", devpath);
+
+  usb_device_devpath = device_id_from_devpath (devpath, &id,
+					       usbserial, sizeof (usbserial));
+
+  if (!id.mfg || !id.mdl)
+    {
+      syslog (LOG_ERR, "invalid or missing IEEE 1284 Device ID%s%s",
+	      id.full_device_id ? " " : "",
+	      id.full_device_id ? id.full_device_id : "");
+      exit (1);
+    }
+
+  syslog (LOG_DEBUG, "MFG:%s MDL:%s SERN:%s serial:%s", id.mfg, id.mdl,
+	  id.sern ? id.sern : "-", usbserial);
+
+  com_redhat_PrinterConfig_usb_printer_add (proxy,
+					    usb_device_devpath,
+					    id.full_device_id,
+					    &error);
+  free (usb_device_devpath);
+  free_device_id (&id);
+  return 0;
+}
+
+static int
+do_remove (DBusGProxy *proxy, const char *devpath)
+{
+  GError *error = NULL;
+  syslog (LOG_DEBUG, "remove %s", devpath);
+
+  com_redhat_PrinterConfig_usb_printer_remove (proxy,
+					       devpath,
+					       &error);
+  return 0;
+}
+
+int
+main (int argc, char **argv)
+{
+  DBusGConnection *connection;
+  DBusGProxy *proxy;
+  GError *error = NULL;
+  int add;
+
+  g_type_init ();
+
+  if (argc != 3 ||
+      !((add = !strcmp (argv[1], "add")) ||
+	!strcmp (argv[1], "remove")))
+    {
+      fprintf (stderr,
+	       "Syntax: %s add {USB device path}\n"
+	       "        %s remove {USB device path}\n",
+	       argv[0], argv[0]);
+      return 1;
+    }
+
+  openlog ("udev-usb-printer", 0, LOG_LPR);
+
+  connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+  if (connection == NULL)
+    {
+      syslog (LOG_ERR, "unable to connect to D-Bus: %s", error->message);
+      g_error_free (error);
+      exit (1);
+    }
+
+  proxy = dbus_g_proxy_new_for_name (connection,
+				     "com.redhat.PrinterConfig",
+				     "/com/redhat/PrinterConfig",
+				     "com.redhat.PrinterConfig");
+
+  if (add)
+    do_add (proxy, argv[2]);
+  else
+    do_remove (proxy, argv[2]);
+
+  g_object_unref (proxy);
+  return 0;
+}


Index: system-config-printer.spec
===================================================================
RCS file: /cvs/pkgs/rpms/system-config-printer/devel/system-config-printer.spec,v
retrieving revision 1.271
retrieving revision 1.272
diff -u -p -r1.271 -r1.272
--- system-config-printer.spec	24 Jul 2009 09:03:38 -0000	1.271
+++ system-config-printer.spec	26 Jul 2009 18:43:24 -0000	1.272
@@ -7,14 +7,14 @@
 Summary: A printer administration tool
 Name: system-config-printer
 Version: 1.1.10
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: GPLv2+
 URL: http://cyberelk.net/tim/software/system-config-printer/
 Group: System Environment/Base
 Source0: http://cyberelk.net/tim/data/system-config-printer/1.1/system-config-printer-%{version}.tar.bz2
 Source1: http://cyberelk.net/tim/data/pycups/pycups-%{pycups_version}.tar.bz2
 Source2: http://cyberelk.net/tim/data/pysmbc/pysmbc-%{pysmbc_version}.tar.bz2
-Patch1: system-config-printer-a05bd9c.patch
+Patch1: system-config-printer-525e996.patch
 
 BuildRequires: cups-devel >= 1.2
 BuildRequires: python-devel >= 2.4
@@ -25,6 +25,9 @@ BuildRequires: intltool
 BuildRequires: libusb-devel, libudev-devel
 BuildRequires: xmlto
 BuildRequires: epydoc
+
+BuildRequires: automake, autoconf
+
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 Requires: pygtk2 >= 2.4.0, pygtk2-libglade
@@ -76,7 +79,9 @@ printers.
 
 %prep
 %setup -q -a 1 -a 2
-%patch1 -p1 -b .a05bd9c
+%patch1 -p1 -b .525e996
+automake --copy --add-missing
+autoconf
 
 %build
 %configure --with-udev-rules
@@ -127,7 +132,12 @@ rm -rf %buildroot
 %files udev
 %defattr(-,root,root,-)
 %{_sysconfdir}/udev/rules.d/*.rules
-/lib/udev/*
+%{_sysconfdir}/dbus-1/system.d/*.conf
+%{_libexecdir}/printer-config-daemon
+%{_libexecdir}/udev-add-printer
+%{_datadir}/dbus-1/interfaces/*.xml
+%{_datadir}/dbus-1/system-services/*.service
+/lib/udev/udev-usb-printer
 
 %files
 %defattr(-,root,root,-)
@@ -184,6 +194,9 @@ rm -rf %buildroot
 exit 0
 
 %changelog
+* Sun Jul 26 2009 Tim Waugh <twaugh at redhat.com> 1.1.10-4
+- Split out D-Bus service for udev helper.
+
 * Fri Jul 24 2009 Tim Waugh <twaugh at redhat.com> 1.1.10-3
 - Removed gnome-packagekit dependency.  The presence of
   gpk-install-package-name is detected at run-time, and the program


--- system-config-printer-a05bd9c.patch DELETED ---




More information about the fedora-extras-commits mailing list