rpms/system-config-printer/devel system-config-printer-a6cf4d3.patch, NONE, 1.1 system-config-printer-getdevices.patch, NONE, 1.1 system-config-printer.spec, 1.274, 1.275 system-config-printer-525e996.patch, 1.1, NONE

Tim Waugh twaugh at fedoraproject.org
Fri Jul 31 14:14:42 UTC 2009


Author: twaugh

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

Modified Files:
	system-config-printer.spec 
Added Files:
	system-config-printer-a6cf4d3.patch 
	system-config-printer-getdevices.patch 
Removed Files:
	system-config-printer-525e996.patch 
Log Message:
* Fri Jul 31 2009 Tim Waugh <twaugh at redhat.com> 1.1.10-7
- Sync with 1.1.x.
- Added patch for cupspk DevicesGet method call.


system-config-printer-a6cf4d3.patch:
 Makefile.am                              |   82 +-
 PhysicalDevice.py                        |    8 
 aclocal.m4                               |  156 +++
 configure.in                             |    3 
 cupshelpers/ppds.py                      |   27 
 cupspk.py                                |    4 
 jobviewer.py                             |   10 
 po/el.po                                 |  567 +++++---------
 po/it.po                                 | 1114 ++++++++++++---------------
 system-config-printer.py                 |   94 +-
 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 +++++++++++
 19 files changed, 3131 insertions(+), 1055 deletions(-)

--- NEW FILE system-config-printer-a6cf4d3.patch ---
diff -up system-config-printer-1.1.10/aclocal.m4.a6cf4d3 system-config-printer-1.1.10/aclocal.m4
--- system-config-printer-1.1.10/aclocal.m4.a6cf4d3	2009-07-22 13:54:02.000000000 +0100
+++ system-config-printer-1.1.10/aclocal.m4	2009-07-31 15:09:03.192962439 +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.a6cf4d3 system-config-printer-1.1.10/configure.in
--- system-config-printer-1.1.10/configure.in.a6cf4d3	2009-07-22 13:53:25.000000000 +0100
+++ system-config-printer-1.1.10/configure.in	2009-07-31 15:09:03.194961651 +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.a6cf4d3 system-config-printer-1.1.10/cupshelpers/ppds.py
--- system-config-printer-1.1.10/cupshelpers/ppds.py.a6cf4d3	2009-07-22 13:22:49.000000000 +0100
+++ system-config-printer-1.1.10/cupshelpers/ppds.py	2009-07-31 15:09:03.198961636 +0100
@@ -113,7 +113,7 @@ def ppdMakeModelSplit (ppd_make_and_mode
         model = ppd_make_and_model
 
     # Handle PPDs provided by Turboprint
-    elif l.startswith ("turboprint"):
+    elif l.find ("turboprint") != -1:
         t = ppd_make_and_model.find (" TurboPrint")
         if t != -1:
             ppd_make_and_model = ppd_make_and_model[:t]
@@ -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
[...6139 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;
+}

system-config-printer-getdevices.patch:
 cupspk.py |   48 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 47 insertions(+), 1 deletion(-)

--- NEW FILE system-config-printer-getdevices.patch ---
diff -up system-config-printer-1.1.10/cupspk.py.getdevices system-config-printer-1.1.10/cupspk.py
--- system-config-printer-1.1.10/cupspk.py.getdevices	2009-07-31 15:11:10.285962319 +0100
+++ system-config-printer-1.1.10/cupspk.py	2009-07-31 15:11:23.732961871 +0100
@@ -300,7 +300,53 @@ class Connection:
 #    getPPDs
 #    getServerPPD
 #    getDocument
-#    getDevices
+
+
+    def getDevices(self, *args, **kwds):
+        use_pycups = False
+        pk_args = ()
+
+        result = self._call_with_pk_and_fallback(use_pycups,
+                                                 'DevicesGet', pk_args,
+                                                 self._connection.getDevices,
+                                                 *args, **kwds)
+
+        result_str = {}
+        if result != None:
+            for i in result.keys():
+                if type(i) == dbus.String:
+                    result_str[str(i)] = str(result[i])
+                else:
+                    result_str[i] = result[i]
+
+        # cups-pk-helper returns all devices in one dictionary.
+        # Keys of different devices are distinguished by ':n' postfix.
+
+        devices = {}
+        n = 0
+        postfix = ':' + str (n)
+        device_keys = [x for x in result_str.keys() if x.endswith(postfix)]
+        while len (device_keys) > 0:
+
+            device_uri = None
+            device_dict = {}
+            for i in device_keys:
+                key = i[:len(i)-len(postfix)]
+                if key != 'device-uri':
+                    device_dict[key] = result_str[i]
+                else:
+                    device_uri = result_str[i]
+
+            if device_uri != None:
+                devices[device_uri] = device_dict
+
+            n += 1
+            postfix = ':' + str (n)
+            device_keys = [x for x in result_str.keys() if x.endswith(postfix)]
+
+        return devices
+
+
 #    getJobs
 #    getJobAttributes
 


Index: system-config-printer.spec
===================================================================
RCS file: /cvs/pkgs/rpms/system-config-printer/devel/system-config-printer.spec,v
retrieving revision 1.274
retrieving revision 1.275
diff -u -p -r1.274 -r1.275
--- system-config-printer.spec	27 Jul 2009 04:43:29 -0000	1.274
+++ system-config-printer.spec	31 Jul 2009 14:14:42 -0000	1.275
@@ -7,14 +7,15 @@
 Summary: A printer administration tool
 Name: system-config-printer
 Version: 1.1.10
-Release: 6%{?dist}
+Release: 7%{?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-525e996.patch
+Patch1: system-config-printer-a6cf4d3.patch
+Patch2: system-config-printer-getdevices.patch
 
 BuildRequires: cups-devel >= 1.2
 BuildRequires: python-devel >= 2.4
@@ -79,7 +80,8 @@ printers.
 
 %prep
 %setup -q -a 1 -a 2
-%patch1 -p1 -b .525e996
+%patch1 -p1 -b .a6cf4d3
+%patch2 -p1 -b .getdevices
 automake --copy --add-missing
 autoconf
 
@@ -194,6 +196,10 @@ rm -rf %buildroot
 exit 0
 
 %changelog
+* Fri Jul 31 2009 Tim Waugh <twaugh at redhat.com> 1.1.10-7
+- Sync with 1.1.x.
+- Added patch for cupspk DevicesGet method call.
+
 * Mon Jul 27 2009 Matthias Clasen <mclasen at redhat.com> 1.1.10-6
 - Drop no-longer-used python-sexy dep
 


--- system-config-printer-525e996.patch DELETED ---




More information about the fedora-extras-commits mailing list