From d2ccf03fa0b2fa71cabb968c766fd5ce9d5de800 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Wed, 23 Dec 2009 16:17:13 +0000 Subject: [PATCH] - Prefer foomatic-recommended drivers (bug #550108). --- ...-config-printer-foomatic-recommended.patch | 37 +++++++++++++++++++ system-config-printer.spec | 3 ++ 2 files changed, 40 insertions(+) create mode 100644 system-config-printer-foomatic-recommended.patch diff --git a/system-config-printer-foomatic-recommended.patch b/system-config-printer-foomatic-recommended.patch new file mode 100644 index 0000000..8eb7f92 --- /dev/null +++ b/system-config-printer-foomatic-recommended.patch @@ -0,0 +1,37 @@ +diff -up system-config-printer-1.1.16/cupshelpers/ppds.py.foomatic-recommended system-config-printer-1.1.16/cupshelpers/ppds.py +--- system-config-printer-1.1.16/cupshelpers/ppds.py.foomatic-recommended 2009-12-22 14:27:37.000000000 +0000 ++++ system-config-printer-1.1.16/cupshelpers/ppds.py 2009-12-23 16:13:13.234214808 +0000 +@@ -248,14 +248,25 @@ def _getDriverType (ppdname, ppds=None): + # Foomatic (generated) -- but which driver? + if ppdname.find ("Generic")!= -1: + return DRIVER_TYPE_FOOMATIC_GENERIC +- if (ppds != None and +- ppds.getInfoFromPPDName (ppdname).\ +- get ('ppd-make-and-model', '').find ("(recommended)") != -1): +- if ppds.getInfoFromPPDName (ppdname).\ +- get ('ppd-make-and-model', '').find ("Postscript") != -1: +- return DRIVER_TYPE_FOOMATIC_RECOMMENDED_POSTSCRIPT +- else: +- return DRIVER_TYPE_FOOMATIC_RECOMMENDED_NON_POSTSCRIPT ++ if ppds != None: ++ info = ppds.getInfoFromPPDName (ppdname) ++ device_id = info.get ('ppd-device-id', '') ++ id_dict = parseDeviceID (device_id) ++ drv = id_dict.get ('DRV', '') ++ drvfields = dict() ++ for field in drv.split (','): ++ if len (field) == 0: ++ continue ++ key = field[0] ++ drvfields[key] = field[1:] ++ ++ ppd_make_and_model = info.get ('ppd-make-and-model', '') ++ if (drvfields.get ('R', '0') == '1' or ++ ppd_make_and_model.find ("(recommended)") != -1): ++ if ppd_make_and_model.find ("Postscript") != -1: ++ return DRIVER_TYPE_FOOMATIC_RECOMMENDED_POSTSCRIPT ++ else: ++ return DRIVER_TYPE_FOOMATIC_RECOMMENDED_NON_POSTSCRIPT + if ppdname.find ("-Postscript")!= -1: + return DRIVER_TYPE_FOOMATIC_PS + if ppdname.find ("-hpijs") != -1: diff --git a/system-config-printer.spec b/system-config-printer.spec index 1966ba7..a7d6f96 100644 --- a/system-config-printer.spec +++ b/system-config-printer.spec @@ -18,6 +18,7 @@ Source2: http://cyberelk.net/tim/data/pysmbc/pysmbc-%{pysmbc_version}.tar.bz2 Patch1: system-config-printer-no-epydoc.patch Patch2: system-config-printer-typo.patch Patch3: system-config-printer-driver-pre-selection.patch +Patch4: system-config-printer-foomatic-recommended.patch BuildRequires: cups-devel >= 1.2 BuildRequires: python-devel >= 2.4 @@ -80,6 +81,7 @@ printers. %patch1 -p1 -b .no-epydoc %patch2 -p1 -b .typo %patch3 -p1 -b .driver-pre-selection +%patch4 -p1 -b .foomatic-recommended %build %configure --with-udev-rules --with-polkit-1 @@ -197,6 +199,7 @@ exit 0 %changelog * Wed Dec 23 2009 Tim Waugh - 1.1.16-2 +- Prefer foomatic-recommended drivers (bug #550108). - Pre-select correct driver when adding or changing a queue (bug #550075). - Fixed typo (bug #550096).