Fix parsing of avahi-daemon output (bug ).

This commit is contained in:
Jiri Popelka 2014-06-17 21:29:18 +02:00
parent 48e3a677be
commit 7e228058b1
2 changed files with 27 additions and 1 deletions

19
hplip-avahi-parsing.patch Normal file
View File

@ -0,0 +1,19 @@
diff -up hplip-3.14.6/base/avahi.py.avahi-parsing hplip-3.14.6/base/avahi.py
--- hplip-3.14.6/base/avahi.py.avahi-parsing 2014-06-17 14:42:57.557586402 +0100
+++ hplip-3.14.6/base/avahi.py 2014-06-17 14:45:56.104509934 +0100
@@ -59,9 +59,13 @@ def detectNetworkDevices(ttl=4, timeout=
'status_code': 0, 'device2': '0', 'device3': '0', 'note': ''}
y['ip'] = ip
y['hn'] = bits[6].replace('.local', '')
- details = bits[9].split('" "')
+ details = bits[9].rstrip ().strip ('"').split('" "')
for item in details:
- key, value = item.split('=', 1)
+ keyvalue = item.split('=', 1)
+ if len (keyvalue) < 2:
+ # Skip parts that don't match key=value
+ continue
+ key, value = keyvalue
if key == 'ty':
y['mdns'] = value
y['device1'] = "MFG:Hewlett-Packard;MDL:%s;CLS:PRINTER;" % value

View File

@ -7,7 +7,7 @@
Summary: HP Linux Imaging and Printing Project
Name: hplip
Version: 3.14.6
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+ and MIT
Url: http://hplip.sourceforge.net/
@ -32,6 +32,7 @@ Patch15: hplip-ppd-ImageableArea.patch
Patch16: hplip-scan-tmp.patch
Patch17: hplip-codec.patch
Patch18: hplip-log-stderr.patch
Patch19: hplip-avahi-parsing.patch
%global hpijs_epoch 1
Requires: hpijs%{?_isa} = %{hpijs_epoch}:%{version}-%{release}
@ -242,6 +243,9 @@ done
# Treat logging before importing of logger module (bug #984699).
%patch18 -p1 -b .log-stderr
# Fix parsing of avahi-daemon output (bug #1096939).
%patch19 -p1 -b .parsing
sed -i.duplex-constraints \
-e 's,\(UIConstraints.* \*Duplex\),//\1,' \
prnt/drv/hpcups.drv.in
@ -478,6 +482,9 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
%postun libs -p /sbin/ldconfig
%changelog
* Tue Jun 17 2014 Jiri Popelka <jpopelka@redhat.com> - 3.14.6-2
- Fix parsing of avahi-daemon output (bug #1096939).
* Thu Jun 05 2014 Jiri Popelka <jpopelka@redhat.com> - 3.14.6-1
- 3.14.6