diff -u system-config-printer-1.5.1+20141010/debian/changelog system-config-printer-1.5.1+20141010/debian/changelog --- system-config-printer-1.5.1+20141010/debian/changelog +++ system-config-printer-1.5.1+20141010/debian/changelog @@ -1,3 +1,18 @@ +system-config-printer (1.5.1+20141010-0ubuntu2.1) utopic-proposed; urgency=medium + + * debian/patches/60_newprinter-fix-package-installation.patch: Fixed several + bugs in system-config-printers's facility to install missing packages of + the printing stack (currently smbclient and libsane-hpaio. LP: #1366756). + * debian/patches/63_ppdcache-return-exception-rather-than-looping.patch: + Fixed infinite loop generating millions of links in /tmp when PPD file + requested from a print queue is not readable (LP: #1156398). + * debian/patches/65_fix-hp-fax-type-parsing.patch: Fix parsing of the HPLIP + fax type (LP: #1369789). + * debian/patches/67_jobviewer-always-fetch-auth-info-required-attribute.patch: + jobviewer: Always fetch auth-info-required attribute (LP: #1380514). + + -- Till Kamppeter Thu, 30 Oct 2014 18:21:36 +0100 + system-config-printer (1.5.1+20141010-0ubuntu2) utopic; urgency=medium * debian/patches/35_more-debugging-output.patch, only in patch2: unchanged: --- system-config-printer-1.5.1+20141010.orig/debian/patches/60_newprinter-fix-package-installation.patch +++ system-config-printer-1.5.1+20141010/debian/patches/60_newprinter-fix-package-installation.patch @@ -0,0 +1,113 @@ +diff -Nur -x '*.orig' -x '*~' system-config-printer-1.5.1+20141010/installpackage.py system-config-printer-1.5.1+20141010.new/installpackage.py +--- system-config-printer-1.5.1+20141010/installpackage.py 2014-10-30 19:38:07.164669152 +0100 ++++ system-config-printer-1.5.1+20141010.new/installpackage.py 2014-10-30 19:38:08.380689825 +0100 +@@ -20,11 +20,40 @@ + ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + import os ++import dbus ++import dbus.glib + from gi.repository import GLib ++from debug import * + + class PackageKit: ++ DBUS_NAME="org.freedesktop.PackageKit" ++ DBUS_PATH="/org/freedesktop/PackageKit" ++ DBUS_IFACE="org.freedesktop.PackageKit.Modify" ++ + def __init__ (self): +- raise RuntimeError("Package installation not implemented") ++ try: ++ bus = dbus.SessionBus () ++ remote_object = bus.get_object(self.DBUS_NAME, self.DBUS_PATH) ++ iface = dbus.Interface(remote_object, self.DBUS_IFACE) ++ except dbus.exceptions.DBusException: ++ # System bus not running. ++ iface = None ++ self.iface = iface + + def InstallPackageName (self, xid, timestamp, name): +- raise RuntimeError("Package installation not implemented") ++ try: ++ if self.iface != None: ++ self.iface.InstallPackageNames(xid, [name], \ ++ "hide-finished,show-warnings", \ ++ timeout = 999999) ++ except dbus.exceptions.DBusException: ++ pass ++ ++ def InstallProvideFile (self, xid, timestamp, filename): ++ try: ++ if self.iface != None: ++ self.iface.InstallProvideFiles(xid, [filename], \ ++ "hide-finished,show-warnings", \ ++ timeout = 999999) ++ except dbus.exceptions.DBusException: ++ pass +diff -Nur -x '*.orig' -x '*~' system-config-printer-1.5.1+20141010/newprinter.py system-config-printer-1.5.1+20141010.new/newprinter.py +--- system-config-printer-1.5.1+20141010/newprinter.py 2014-10-30 19:38:07.160669084 +0100 ++++ system-config-printer-1.5.1+20141010.new/newprinter.py 2014-10-30 19:38:20.884902305 +0100 +@@ -64,6 +64,7 @@ + import asyncconn + import ppdsloader + import dnssdresolve ++import installpackage + + import gettext + gettext.install(domain=config.PACKAGE, localedir=config.localedir) +@@ -1056,12 +1057,16 @@ + uri = SMBURI (uri=uri[6:]).sanitize_uri () + + # Does the backend need to be installed? +- if ((self._host == 'localhost' or ++ if (self.nextnptab_rerun == False and ++ not self.searchedfordriverpackages and ++ ++ (self._host == 'localhost' or + self._host[0] == '/') and + not os.access ("/usr/lib/cups/backend/smb", os.F_OK)): ++ debugprint ("No smb backend so attempting install") + try: + pk = installpackage.PackageKit () +- pk.InstallPackageName (0, 0, "samba-client") ++ pk.InstallPackageName (0, 0, "smbclient") + except: + pass + +@@ -1184,9 +1189,13 @@ + self.nextnptab_rerun = False + + if page_nr == 1 or page_nr == 2: +- if (hasattr (self.device, 'hp_scannable') and ++ if (self.nextnptab_rerun == False and ++ hasattr (self.device, 'hp_scannable') and + self.device.hp_scannable and +- not os.access ("/etc/sane.d/dll.d/hpaio", os.R_OK)): ++ not os.access ("/etc/sane.d/dll.d/hpaio", os.R_OK) and ++ not os.access ("/etc/sane.d/dll.d/hplip", os.R_OK)): ++ debugprint ("No HPLIP sane backend so " ++ "attempting install") + try: + pk = installpackage.PackageKit () + pk.InstallPackageName (0, 0, "libsane-hpaio") +@@ -2813,6 +2822,10 @@ + dev.menuentry = "HP Linux Imaging and Printing (HPLIP)" + physicaldevice.add_device (dev) + ++ # Can we scan using this device? ++ if self.get_hplip_scan_type_for_uri (device.uri): ++ hp_scannable = True ++ + # Now check to see if we can also send faxes using + # this device. + faxuri = self.get_hplip_uri_for_network_printer (hpliphost, +@@ -2826,7 +2839,8 @@ + "HP Linux Imaging and Printing (HPLIP)" + physicaldevice.add_device (faxdev) + +- physicaldevice.hp_scannable = True ++ if hp_scannable: ++ physicaldevice.hp_scannable = True + physicaldevice.checked_hplip = True + + device.hp_scannable = getattr (physicaldevice, 'hp_scannable', None) only in patch2: unchanged: --- system-config-printer-1.5.1+20141010.orig/debian/patches/63_ppdcache-return-exception-rather-than-looping.patch +++ system-config-printer-1.5.1+20141010/debian/patches/63_ppdcache-return-exception-rather-than-looping.patch @@ -0,0 +1,43 @@ +diff -Nur -x '*.orig' -x '*~' system-config-printer-1.5.1+20141010/ppdcache.py system-config-printer-1.5.1+20141010.new/ppdcache.py +--- system-config-printer-1.5.1+20141010/ppdcache.py 2014-10-10 17:19:07.000000000 +0200 ++++ system-config-printer-1.5.1+20141010.new/ppdcache.py 2014-10-30 18:36:22.868086983 +0100 +@@ -107,14 +107,20 @@ + + def _got_ppd (self, connection, name, result, callback): + if isinstance (result, Exception): +- self._schedule_callback (callback, name, result, None) ++ self._schedule_callback (callback, name, None, result) + else: + # Store an open file object, then remove the actual file. + # This way we don't leave temporary files around. +- self._cache[name] = open (result) +- debugprint ("%s: caching %s (fd %d)" % (self, result, +- self._cache[name].fileno())) +- os.unlink (result) ++ try: ++ self._cache[name] = file (result) ++ debugprint ("%s: caching %s (fd %d)" % ++ (self, result, ++ self._cache[name].fileno())) ++ os.unlink (result) ++ except IOError as exc: ++ self._schedule_callback (callback, name, None, exc) ++ return ++ + self.fetch_ppd (name, callback) + + def _got_ppd3 (self, connection, name, result, callback): +@@ -144,10 +150,12 @@ + modtime, status)) + os.unlink (filename) + self._modtimes[name] = modtime +- except IOError: ++ except IOError as exc: + # File disappeared? + debugprint ("%s: file %s disappeared? Unable to cache it" + % (self, filename)) ++ self._schedule_callback (callback, name, None, exc) ++ return + + # Now fetch it from our own cache. + self.fetch_ppd (name, callback, check_uptodate=False) only in patch2: unchanged: --- system-config-printer-1.5.1+20141010.orig/debian/patches/65_fix-hp-fax-type-parsing.patch +++ system-config-printer-1.5.1+20141010/debian/patches/65_fix-hp-fax-type-parsing.patch @@ -0,0 +1,15 @@ +diff -Nur -x '*.orig' -x '*~' system-config-printer-1.5.1+20141010/newprinter.py system-config-printer-1.5.1+20141010.new/newprinter.py +--- system-config-printer-1.5.1+20141010/newprinter.py 2014-10-30 18:47:35.404029038 +0100 ++++ system-config-printer-1.5.1+20141010.new/newprinter.py 2014-10-30 18:48:07.700600973 +0100 +@@ -1804,7 +1804,10 @@ + res = re.search ("(\d+)", line) + if res: + resg = res.groups() +- faxtype = resg[0] ++ try: ++ faxtype = int(resg[0]) ++ except: ++ faxtype = -1 + if faxtype >= 0: + break + if faxtype <= 0: only in patch2: unchanged: --- system-config-printer-1.5.1+20141010.orig/debian/patches/67_jobviewer-always-fetch-auth-info-required-attribute.patch +++ system-config-printer-1.5.1+20141010/debian/patches/67_jobviewer-always-fetch-auth-info-required-attribute.patch @@ -0,0 +1,11 @@ +diff -Nur -x '*.orig' -x '*~' system-config-printer-1.5.1+20141010/jobviewer.py system-config-printer-1.5.1+20141010.new/jobviewer.py +--- system-config-printer-1.5.1+20141010/jobviewer.py 2014-10-10 17:19:05.000000000 +0200 ++++ system-config-printer-1.5.1+20141010.new/jobviewer.py 2014-10-30 18:53:50.306659960 +0100 +@@ -314,6 +314,7 @@ + 'job-printer-uri', + 'job-state', + 'time-at-creation', ++ 'auth-info-required' + 'job-preserved']) + + __gsignals__ = {