backport several upstream patches

This commit is contained in:
Zdenek Dohnal 2018-10-15 17:39:39 +02:00
parent 3d4c963398
commit 7545ec2060
10 changed files with 467 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From f52f192d241f49334aa46dca1fe9c22b2ee37ff3 Mon Sep 17 00:00:00 2001
From: Antonio Larrosa <antonio.larrosa@gmail.com>
Date: Thu, 31 May 2018 12:07:19 +0200
Subject: [PATCH] Fallback to using LC_CTYPE if LC_MESSAGES is empty and fix
_language use
On openSUSE, LC_MESSAGES is not set by default, so fallback to LC_CTYPE in
that case.
Also, self._language is not a list (unlike in other classes) but the language
itself, so if we get the first element, we would be getting the first letter,
not the language.
---
scp-dbus-service.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/scp-dbus-service.py b/scp-dbus-service.py
index 1338836b..b3c03217 100644
--- a/scp-dbus-service.py
+++ b/scp-dbus-service.py
@@ -471,6 +471,8 @@ class ConfigPrinting(dbus.service.Object):
self._jobappletpath = None
self._ppds = None
self._language = locale.getlocale (locale.LC_MESSAGES)[0]
+ if not self._language:
+ self._language = locale.getlocale (locale.LC_CTYPE)[0]
def destroy (self):
self._cupsconn.destroy ()
@@ -511,7 +513,7 @@ class ConfigPrinting(dbus.service.Object):
def GetBestDrivers(self, device_id, device_make_and_model, device_uri,
reply_handler, error_handler):
GetBestDriversRequest (device_id, device_make_and_model, device_uri,
- self._cupsconn, self._language[0],
+ self._cupsconn, self._language,
reply_handler, error_handler)
@dbus.service.method(dbus_interface=CONFIG_IFACE,
--
2.17.2

View File

@ -0,0 +1,29 @@
From 4ab0958643827777f526b180ece874d40009986d Mon Sep 17 00:00:00 2001
From: Tomas Korbar <tkorbar@redhat.com>
Date: Thu, 27 Sep 2018 17:27:39 +0200
Subject: [PATCH] Fix TypeError raised by debugprint call
- this error is caused by typo in options.py:424 debugprint call
- debugprint function takes only one parameter so i think it should
have been formated string
- fix https://bugzilla.redhat.com/show_bug.cgi?id=1619593
---
options.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/options.py b/options.py
index 4dc0b1fe..d756f98d 100644
--- a/options.py
+++ b/options.py
@@ -421,7 +421,7 @@ class OptionSelectOne(Option):
self.selector.set_active(selected)
else:
debugprint("Unknown value for %s: %s" % (name, value))
- debugprint("Choices:", supported)
+ debugprint("Choices: %s" % (supported))
if len(supported) > 0:
debugprint("Selecting from choices:", supported[0])
self.selector.set_active(0)
--
2.17.2

View File

@ -0,0 +1,26 @@
From 027ed8683a0ec30dbe705fe4d8f31c8ccb973199 Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Thu, 30 Aug 2018 12:05:53 +0200
Subject: [PATCH] Fix typo in debugprint call
(https://github.com/zdohnal/system-config-printer/issues/105)
---
newprinter.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/newprinter.py b/newprinter.py
index 850c986b..051fc253 100644
--- a/newprinter.py
+++ b/newprinter.py
@@ -1049,7 +1049,7 @@ class NewPrinterGUI(GtkGUI):
debugprint('No packages for driver')
return None
if len(arches) > 1:
- debugprint('Returned more than one matching architecture, please report this as a bug: %s', repr (arches))
+ debugprint('Returned more than one matching architecture, please report this as a bug: %s' % repr (arches))
return None
pkgs = pkgs[arches[0]]
--
2.17.2

View File

@ -0,0 +1,35 @@
From 3fee7c63c3aba395a3d8cf0bf4ea0fd2fae695ae Mon Sep 17 00:00:00 2001
From: Laurent Bigonville <bigon@bigon.be>
Date: Mon, 26 Feb 2018 11:54:10 +0100
Subject: [PATCH] Require proper version of GDK and GTK in scp-dbus-service as
well
scp-dbus-service can be D-Bus activated, that means that
gi.require_version() is not called before.
That needs to be kept in sync with the required version in the main
program file.
---
scp-dbus-service.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scp-dbus-service.py b/scp-dbus-service.py
index f0f51efc..3aefc6c6 100644
--- a/scp-dbus-service.py
+++ b/scp-dbus-service.py
@@ -21,9 +21,12 @@
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import dbus.service
+import gi
from gi.repository import GObject
from gi.repository import GLib
+gi.require_version('Gdk', '3.0')
from gi.repository import Gdk
+gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import sys
--
2.17.2

View File

@ -0,0 +1,41 @@
From d818802daefd66eafbcc1618dc731e65de3e08b8 Mon Sep 17 00:00:00 2001
From: Laurent Bigonville <bigon@bigon.be>
Date: Mon, 26 Feb 2018 13:59:26 +0100
Subject: [PATCH] Set programe name for scp-dbus-service as well
scp-dbus-service can be D-Bus activated, that means that the program
name is never set meaning that the icon and the fancy name in the window
list is never set.
This completes the fix for bug #53
---
scp-dbus-service.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scp-dbus-service.py b/scp-dbus-service.py
index 3aefc6c6..1338836b 100644
--- a/scp-dbus-service.py
+++ b/scp-dbus-service.py
@@ -20,8 +20,8 @@
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-import dbus.service
import gi
+import dbus.service
from gi.repository import GObject
from gi.repository import GLib
gi.require_version('Gdk', '3.0')
@@ -55,6 +55,9 @@ CONFIG_JOBVIEWER_IFACE=CONFIG_IFACE + ".JobViewer"
g_ppds = None
g_killtimer = None
+#set program name
+GLib.set_prgname("system-config-printer")
+
class FetchedPPDs(GObject.GObject):
__gsignals__ = {
'ready': (GObject.SIGNAL_RUN_LAST, None, ()),
--
2.17.2

View File

@ -0,0 +1,32 @@
From 96e1f5b242f4be5b20d408e6f526caaaecf34a48 Mon Sep 17 00:00:00 2001
From: Laurent Bigonville <bigon@bigon.be>
Date: Mon, 26 Feb 2018 11:17:22 +0100
Subject: [PATCH] Use ValueError instead of ImportError to catch exception when
importing GIR bindings
When importing specific version of GIR bindings, the ValueError
exception is raised instead of ImportError.
This should make libsecret optional as intended
Fixes: #94
---
jobviewer.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jobviewer.py b/jobviewer.py
index 6d9309ff..16b20300 100644
--- a/jobviewer.py
+++ b/jobviewer.py
@@ -57,7 +57,7 @@ try:
gi.require_version('Secret', '1')
from gi.repository import Secret
USE_SECRET=True
-except ImportError:
+except ValueError:
USE_SECRET=False
import gettext
--
2.17.2

View File

@ -0,0 +1,148 @@
From 42d95b7560c26f0fdf3b4f46823843861948c136 Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Thu, 30 Aug 2018 11:52:48 +0200
Subject: [PATCH] define classes for Secret only when libsecret is installed
(https://github.com/zdohnal/system-config-printer/issues/118,
https://github.com/zdohnal/system-config-printer/issues/115)
---
jobviewer.py | 123 ++++++++++++++++++++++++++-------------------------
1 file changed, 62 insertions(+), 61 deletions(-)
diff --git a/jobviewer.py b/jobviewer.py
index 16b20300..86f5feaf 100644
--- a/jobviewer.py
+++ b/jobviewer.py
@@ -73,67 +73,68 @@ SEARCHING_ICON="document-print-preview"
# We need to call Notify.init before we can check the server for caps
Notify.init('System Config Printer Notification')
-NETWORK_PASSWORD = Secret.Schema.new("org.system.config.printer.store", Secret.SchemaFlags.NONE,
- {
- "user": Secret.SchemaAttributeType.STRING,
- "domain": Secret.SchemaAttributeType.STRING,
- "object": Secret.SchemaAttributeType.STRING,
- "protocol": Secret.SchemaAttributeType.STRING,
- "port": Secret.SchemaAttributeType.INTEGER,
- "server": Secret.SchemaAttributeType.STRING,
- "authtype": Secret.SchemaAttributeType.STRING,
- "uri": Secret.SchemaAttributeType.STRING,
- }
- )
-
-
-class ServiceGet:
- service = Secret.Service()
-
- def on_get_service(self, source, result, unused):
- service = Secret.Service.get_finish(result)
-
- def __init__(self):
- Secret.Service.get(0,
- None,
- self.on_get_service,
- None)
-
- def get_service(self):
- return ServiceGet.service
-
-
-class ItemSearch:
- items = list()
-
- def on_search_item(self, source, result, unused):
- items = Secret.Service.search_finish(None, result)
-
- def __init__(self, service, attrs):
- Secret.Service.search(service,
- NETWORK_PASSWORD,
- attrs,
- Secret.SearchFlags.LOAD_SECRETS,
- None,
- self.on_search_item,
- None)
-
- def get_items(self):
- return ItemSearch.items
-
-
-class PasswordStore:
- def __init__(self, attrs, name, secret):
- Secret.password_store(NETWORK_PASSWORD,
- attrs,
- Secret.COLLECTION_DEFAULT,
- name,
- secret,
- None,
- self.on_password_stored)
-
- def on_password_stored(self, source, result, unused):
- Secret.password_store_finish(result)
+if USE_SECRET:
+ NETWORK_PASSWORD = Secret.Schema.new("org.system.config.printer.store", Secret.SchemaFlags.NONE,
+ {
+ "user": Secret.SchemaAttributeType.STRING,
+ "domain": Secret.SchemaAttributeType.STRING,
+ "object": Secret.SchemaAttributeType.STRING,
+ "protocol": Secret.SchemaAttributeType.STRING,
+ "port": Secret.SchemaAttributeType.INTEGER,
+ "server": Secret.SchemaAttributeType.STRING,
+ "authtype": Secret.SchemaAttributeType.STRING,
+ "uri": Secret.SchemaAttributeType.STRING,
+ }
+ )
+
+
+ class ServiceGet:
+ service = Secret.Service()
+
+ def on_get_service(self, source, result, unused):
+ service = Secret.Service.get_finish(result)
+
+ def __init__(self):
+ Secret.Service.get(0,
+ None,
+ self.on_get_service,
+ None)
+
+ def get_service(self):
+ return ServiceGet.service
+
+
+ class ItemSearch:
+ items = list()
+
+ def on_search_item(self, source, result, unused):
+ items = Secret.Service.search_finish(None, result)
+
+ def __init__(self, service, attrs):
+ Secret.Service.search(service,
+ NETWORK_PASSWORD,
+ attrs,
+ Secret.SearchFlags.LOAD_SECRETS,
+ None,
+ self.on_search_item,
+ None)
+
+ def get_items(self):
+ return ItemSearch.items
+
+
+ class PasswordStore:
+ def __init__(self, attrs, name, secret):
+ Secret.password_store(NETWORK_PASSWORD,
+ attrs,
+ Secret.COLLECTION_DEFAULT,
+ name,
+ secret,
+ None,
+ self.on_password_stored)
+
+ def on_password_stored(self, source, result, unused):
+ Secret.password_store_finish(result)
class PrinterURIIndex:
--
2.17.2

View File

@ -0,0 +1,66 @@
From e7940de50a7164a2de82e003222ecbf8b10c9ad5 Mon Sep 17 00:00:00 2001
From: xoduddk123 <xoduddk123@naver.com>
Date: Wed, 20 Jun 2018 12:24:13 +0900
Subject: [PATCH] encoding: Modified to use utf-8 in fdopen()
The following error occurred due to encoding problem in fdopen().
root@tykwon:~# cat /var/log/syslog
2018-02-12T17:08:24.208317+09:00 tykwon kernel: usb 1-1.2: new high-speed USB device number 4 using dwc_otg
2018-02-12T17:08:24.309341+09:00 tykwon kernel: usb 1-1.2: New USB device found, idVendor=03f0, idProduct=3b2a
2018-02-12T17:08:24.309398+09:00 tykwon kernel: usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
2018-02-12T17:08:24.309415+09:00 tykwon kernel: usb 1-1.2: Product: HP Color LaserJet MFP M277n
2018-02-12T17:08:24.309428+09:00 tykwon kernel: usb 1-1.2: Manufacturer: Hewlett-Packard
2018-02-12T17:08:24.318314+09:00 tykwon kernel: usb 1-1.2: SerialNumber: VNBKK97643
2018-02-12T17:08:24.340967+09:00 tykwon root: loading HP Device 001 004
2018-02-12T17:08:25.537224+09:00 tykwon python: io/hpmud/musb.c 2185: [307] hpmud_make_usb_uri() bus=001 dev=004
2018-02-12T17:08:25.540188+09:00 tykwon python: io/hpmud/musb.c 2282: hpmud_make_usb_uri() uri=hp:/usb/HP_Color_LaserJet_MFP_M277n?serial=VNBKK97643 bytes_read=53
2018-02-12T17:08:26.510021+09:00 tykwon kernel: usblp 1-1.2:1.1: usblp0: USB Bidirectional printer dev 4 if 1 alt 0 proto 2 vid 0x03F0 pid 0x3B2A
2018-02-12T17:08:26.518337+09:00 tykwon kernel: usbcore: registered new interface driver usblp
2018-02-12T17:08:26.523457+09:00 tykwon systemd[1]: Created slice system-configure\x2dprinter.slice.
2018-02-12T17:08:26.525835+09:00 tykwon systemd[1]: Started Configure Plugged-In Printer.
2018-02-12T17:08:26.527132+09:00 tykwon systemd[1]: Reached target Printer.
2018-02-12T17:08:26.546282+09:00 tykwon udev-configure-printer: add usb-001-004
2018-02-12T17:08:26.688365+09:00 tykwon udev-configure-printer: device devpath is /devices/lm1/usb1/1-1/1-1.2
2018-02-12T17:08:26.700706+09:00 tykwon udev-configure-printer: MFG:Hewlett-Packard MDL:HP Color LaserJet MFP M277n SERN:- serial:VNBKK97643
2018-02-12T17:08:31.788344+09:00 tykwon kernel: usblp0: removed
2018-02-12T17:08:31.798343+09:00 tykwon kernel: usblp 1-1.2:1.1: usblp0: USB Bidirectional printer dev 4 if 1 alt 0 proto 2 vid 0x03F0 pid 0x3B2A
2018-02-12T17:08:31.870363+09:00 tykwon udev-configure-printer: URI contains USB serial number
2018-02-12T17:08:31.871482+09:00 tykwon udev-configure-printer: URI match: usb://HP/Color%20LaserJet%20MFP%20M277n?serial=VNBKK97643&interface=1
2018-02-12T17:08:31.872536+09:00 tykwon udev-configure-printer: SERN field matches USB serial number
2018-02-12T17:08:31.873629+09:00 tykwon udev-configure-printer: URI match: hp:/usb/HP_Color_LaserJet_MFP_M277n?serial=VNBKK97643
2018-02-12T17:08:31.874594+09:00 tykwon udev-configure-printer: URI of detected printer: usb://HP/Color%20LaserJet%20MFP%20M277n?serial=VNBKK97643&interface=1, normalized: color laserjet mfp m277n serial vnbkk97643 interface 1
2018-02-12T17:08:31.875782+09:00 tykwon udev-configure-printer: URI of print queue: hp:/usb/HP_LaserJet_Professional_P1106?serial=000000000QN926Y1PR1a, normalized: laserjet professional p1106 serial 000000000qn926y1pr1a
2018-02-12T17:08:31.876985+09:00 tykwon udev-configure-printer: URI of detected printer: hp:/usb/HP_Color_LaserJet_MFP_M277n?serial=VNBKK97643, normalized: color laserjet mfp m277n serial vnbkk97643
2018-02-12T17:08:31.878166+09:00 tykwon udev-configure-printer: About to add queue for hp:/usb/HP_Color_LaserJet_MFP_M277n?serial=VNBKK97643
2018-02-12T17:08:34.760340+09:00 tykwon udev-add-printer: add_queue: URIs=['hp:/usb/HP_Color_LaserJet_MFP_M277n?serial=VNBKK97643', 'usb://HP/Color%20LaserJet%20MFP%20M277n?serial=VNBKK97643&interface=1']
2018-02-12T17:08:34.766174+09:00 tykwon udev-add-printer: D-Bus method call failed: org.freedesktop.DBus.Error.ServiceUnknown: The name com.redhat.NewPrinterNotification was not provided by any .service files
2018-02-12T17:08:41.722389+09:00 tykwon udev-add-printer: PPD: hplip:1/hp-color_laserjet_pro_mfp_m277-ps.ppd; Status: 0
2018-02-12T17:08:45.763635+09:00 tykwon udev-add-printer: File "/lib/udev/udev-add-printer", line 232, in <module>#012 add_queue (sys.argv[1], sys.argv[2:])
2018-02-12T17:08:45.764840+09:00 tykwon udev-add-printer: File "/lib/udev/udev-add-printer", line 169, in add_queue#012 installer)
2018-02-12T17:08:45.765979+09:00 tykwon udev-add-printer: File "/lib/udev/udev-add-printer", line 75, in create_queue#012 (pkgs, exes) = cupshelpers.missingPackagesAndExecutables (ppd)
2018-02-12T17:08:45.767236+09:00 tykwon udev-add-printer: File "/usr/lib/python3.5/site-packages/cupshelpers/cupshelpers.py", line 889, in missingPackagesAndExecutables#012 executables = missingExecutables(ppd)
2018-02-12T17:08:45.768527+09:00 tykwon udev-add-printer: File "/usr/lib/python3.5/site-packages/cupshelpers/cupshelpers.py", line 864, in missingExecutables#012 for line in f:
2018-02-12T17:08:45.769834+09:00 tykwon udev-add-printer: File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode#012 return codecs.ascii_decode(input, self.errors)[0]
2018-02-12T17:08:45.771056+09:00 tykwon udev-add-printer: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 4175: ordinal not in range(128)
root@tykwon:~#
---
cupshelpers/cupshelpers.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cupshelpers/cupshelpers.py b/cupshelpers/cupshelpers.py
index 978ab801..8fe7ead4 100755
--- a/cupshelpers/cupshelpers.py
+++ b/cupshelpers/cupshelpers.py
@@ -859,7 +859,7 @@ def missingExecutables(ppd):
os.unlink (tmpfname)
ppd.writeFd (tmpfd)
os.lseek (tmpfd, 0, os.SEEK_SET)
- f = os.fdopen (tmpfd, "rt")
+ f = os.fdopen (tmpfd, "rt", encoding="utf-8")
search = "*cupsFilter:"
for line in f:
if line.startswith (search):
--
2.17.2

View File

@ -0,0 +1,26 @@
From 8a623c2f038dd85da3df647531c6a881d235523c Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Fri, 23 Mar 2018 13:43:41 +0100
Subject: [PATCH] require Gtk and Gdk version 3.0 in asyncpk1.py
---
asyncpk1.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/asyncpk1.py b/asyncpk1.py
index 65d2e768..849c995f 100644
--- a/asyncpk1.py
+++ b/asyncpk1.py
@@ -22,7 +22,9 @@ import cups
import dbus
from functools import reduce
try:
+ gi.require_version('Gdk', '3.0')
from gi.repository import Gdk
+ gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
except:
pass
--
2.17.2

View File

@ -9,12 +9,22 @@
Summary: A printer administration tool Summary: A printer administration tool
Name: system-config-printer Name: system-config-printer
Version: 1.5.11 Version: 1.5.11
Release: 12%{?dist} Release: 13%{?dist}
License: GPLv2+ License: GPLv2+
URL: https://github.com/%{username}/%{name} URL: https://github.com/%{username}/%{name}
Source0: %{url}/releases/download/%{version}/%{name}-%{version}.tar.gz Source0: %{url}/releases/download/%{version}/%{name}-%{version}.tar.gz
# all upstream patches, remove with new release
Patch01: system-config-printer-authdialog.patch Patch01: system-config-printer-authdialog.patch
Patch02: 0001-Use-ValueError-instead-of-ImportError-to-catch-excep.patch
Patch03: 0001-Require-proper-version-of-GDK-and-GTK-in-scp-dbus-se.patch
Patch04: 0001-Set-programe-name-for-scp-dbus-service-as-well.patch
Patch05: 0001-require-Gtk-and-Gdk-version-3.0-in-asyncpk1.py.patch
Patch06: 0001-encoding-Modified-to-use-utf-8-in-fdopen.patch
Patch07: 0001-Fallback-to-using-LC_CTYPE-if-LC_MESSAGES-is-empty-a.patch
Patch08: 0001-define-classes-for-Secret-only-when-libsecret-is-ins.patch
Patch09: 0001-Fix-typo-in-debugprint-call-https-github.com-zdohnal.patch
Patch10: 0001-Fix-TypeError-raised-by-debugprint-call.patch
# gcc is no longer in buildroot by default # gcc is no longer in buildroot by default
# gcc is needed for udev-configure-printer.c # gcc is needed for udev-configure-printer.c
@ -86,6 +96,15 @@ printers.
%prep %prep
%setup -q %setup -q
%patch01 -p1 -b .authdialog %patch01 -p1 -b .authdialog
%patch02 -p1 -b .upstream0
%patch03 -p1 -b .upstream1
%patch04 -p1 -b .upstream2
%patch05 -p1 -b .upstream3
%patch06 -p1 -b .upstream4
%patch07 -p1 -b .upstream5
%patch08 -p1 -b .upstream6
%patch09 -p1 -b .upstream7
%patch10 -p1 -b .upstream8
%build %build
%configure --with-udev-rules %configure --with-udev-rules
@ -190,6 +209,9 @@ touch %buildroot%{_localstatedir}/run/udev-configure-printer/usb-uris
exit 0 exit 0
%changelog %changelog
* Mon Oct 15 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.5.11-13
- backport several upstream patches
* Thu Sep 27 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.5.11-12 * Thu Sep 27 2018 Zdenek Dohnal <zdohnal@redhat.com> - 1.5.11-12
- fix source url - fix source url