rpms/system-config-printer/devel system-config-printer-check-install.patch, NONE, 1.1 system-config-printer.spec, 1.364, 1.365

Tim Waugh twaugh at fedoraproject.org
Mon Mar 1 16:36:24 UTC 2010


Author: twaugh

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

Modified Files:
	system-config-printer.spec 
Added Files:
	system-config-printer-check-install.patch 
Log Message:
* Mon Mar  1 2010 Tim Waugh <twaugh at redhat.com> - 1.1.93-3
- Attempt to install drivers in the Device ID checker.


system-config-printer-check-install.patch:
 check-device-ids.py |   49 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 44 insertions(+), 5 deletions(-)

--- NEW FILE system-config-printer-check-install.patch ---
diff -up system-config-printer-1.1.93/check-device-ids.py.check-install system-config-printer-1.1.93/check-device-ids.py
--- system-config-printer-1.1.93/check-device-ids.py.check-install	2010-02-27 10:33:00.000000000 +0000
+++ system-config-printer-1.1.93/check-device-ids.py	2010-03-01 16:16:01.088735654 +0000
@@ -20,6 +20,7 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
+import dbus
 import cups
 import cupshelpers
 from cupshelpers.ppds import PPDs, ppdMakeModelSplit
@@ -27,10 +28,6 @@ import sys
 
 cups.setUser ('root')
 c = cups.Connection ()
-print "Fetching driver list"
-ppds = PPDs (c.getPPDs ())
-ppds._init_ids ()
-makes = ppds.getMakes ()
 
 devices = None
 if len (sys.argv) > 1 and sys.argv[1] == '--help':
@@ -66,14 +63,56 @@ if len (devices) == 0:
     sys.exit (0)
 
 n = 0
+device_ids = []
 for device, attrs in devices.iteritems ():
     make_and_model = attrs.get ('device-make-and-model')
     device_id = attrs.get ('device-id')
     if not (make_and_model and device_id):
         continue
 
+    id_fields = cupshelpers.parseDeviceID (device_id)
+    this_id = "MFG:%s;MDL:%s;" % (id_fields['MFG'], id_fields['MDL'])
+    device_ids.append (this_id)
     n += 1
 
+if device_ids:
+    try:
+        bus = dbus.SessionBus ()
+
+        print "Installing relevant drivers using session service"
+        try:
+            obj = bus.get_object ("org.freedesktop.PackageKit",
+                                  "/org/freedesktop/PackageKit")
+            proxy = dbus.Interface (obj, "org.freedesktop.PackageKit.Modify")
+            proxy.InstallPrinterDrivers (0, device_ids,
+                                         "hide-finished", timeout=3600)
+        except dbus.exceptions.DBusException, (e, r):
+            print "Ignoring exception: %s" % e
+    except dbus.exceptions.DBusException:
+        try:
+            bus = dbus.SystemBus ()
+
+            print "Installing relevant drivers using system service"
+            try:
+                obj = bus.get_object ("com.redhat.PrinterDriversInstaller",
+                                      "/com/redhat/PrinterDriversInstaller")
+                proxy = dbus.Interface (obj,
+                                        "com.redhat.PrinterDriversInstaller")
+                for device_id in device_ids:
+                    id_dict = cupshelpers.parseDeviceID (device_id)
+                    proxy.InstallDrivers (id_dict['MFG'], id_dict['MDL'], '',
+                                          timeout=3600)
+            except dbus.exceptions.DBusException:
+                print "Ignoring exception: %s" % e
+        except dbus.exceptions.DBusException:
+            print "D-Bus not available so skipping package installation"
+
+
+print "Fetching driver list"
+ppds = PPDs (c.getPPDs ())
+ppds._init_ids ()
+makes = ppds.getMakes ()
+
 i = 1
 item = unichr (0x251c) + unichr (0x2500) + unichr (0x2500)
 last = unichr (0x2514) + unichr (0x2500) + unichr (0x2500)
@@ -92,7 +131,7 @@ for device, attrs in devices.iteritems (
     print "%s %s: MFG:%s;MDL:%s;" % (line, make_and_model,
                                      id_fields['MFG'],
                                      id_fields['MDL'])
-    
+
     try:
         drivers = ppds.ids[id_fields['MFG'].lower ()][id_fields['MDL'].lower ()]
     except KeyError:


Index: system-config-printer.spec
===================================================================
RCS file: /cvs/pkgs/rpms/system-config-printer/devel/system-config-printer.spec,v
retrieving revision 1.364
retrieving revision 1.365
diff -u -p -r1.364 -r1.365
--- system-config-printer.spec	1 Mar 2010 13:31:06 -0000	1.364
+++ system-config-printer.spec	1 Mar 2010 16:36:24 -0000	1.365
@@ -7,7 +7,7 @@
 Summary: A printer administration tool
 Name: system-config-printer
 Version: 1.1.93
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: GPLv2+
 URL: http://cyberelk.net/tim/software/system-config-printer/
 Group: System Environment/Base
@@ -18,6 +18,7 @@ Source2: http://cyberelk.net/tim/data/py
 Patch1: system-config-printer-no-epydoc.patch
 Patch2: system-config-printer-lowercase-mfg-mdl.patch
 Patch3: system-config-printer-import-gobject.patch
+Patch4: system-config-printer-check-install.patch
 
 BuildRequires: cups-devel >= 1.2
 BuildRequires: python-devel >= 2.4
@@ -78,7 +79,8 @@ printers.
 %setup -q -a 1 -a 2
 %patch1 -p1 -b .no-epydoc
 %patch2 -p1 -b .lowercase-mfg-mdl
-%patch3 -p1 -b .import_gobject
+%patch3 -p1 -b .import-gobject
+%patch4 -p1 -b .check-install
 
 %build
 %configure --with-udev-rules --with-polkit-1
@@ -195,6 +197,9 @@ rm -rf %buildroot
 exit 0
 
 %changelog
+* Mon Mar  1 2010 Tim Waugh <twaugh at redhat.com> - 1.1.93-3
+- Attempt to install drivers in the Device ID checker.
+
 * Sun Feb 28 2010 Tim Waugh <twaugh at redhat.com> - 1.1.93-2
 - Import gobject in gtkspinner.py.
 



More information about the scm-commits mailing list