rpms/hal-cups-utils/F-7 hal-cups-utils-lpinfo.patch, NONE, 1.1 hal-cups-utils-no-disable.patch, NONE, 1.1 hal-cups-utils.spec, 1.58, 1.59
Tim Waugh (twaugh)
fedora-extras-commits at redhat.com
Thu Oct 25 17:02:47 UTC 2007
Author: twaugh
Update of /cvs/pkgs/rpms/hal-cups-utils/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv27638
Modified Files:
hal-cups-utils.spec
Added Files:
hal-cups-utils-lpinfo.patch hal-cups-utils-no-disable.patch
Log Message:
* Thu Oct 25 2007 Tim Waugh <twaugh at redhat.com> 0.6.13-2
- Avoid running hplip commands directly so that we don't trigger SELinux
AVC messages.
- Don't disable printers that are unplugged (works around bug #352681 and
bug #352691).
hal-cups-utils-lpinfo.patch:
--- NEW FILE hal-cups-utils-lpinfo.patch ---
diff -up hal-cups-utils-0.6.13/systemv/hal_lpadmin.lpinfo hal-cups-utils-0.6.13/systemv/hal_lpadmin
--- hal-cups-utils-0.6.13/systemv/hal_lpadmin.lpinfo 2007-10-25 17:43:09.000000000 +0100
+++ hal-cups-utils-0.6.13/systemv/hal_lpadmin 2007-10-25 17:58:20.000000000 +0100
@@ -10,6 +10,7 @@ class HalPrinter:
self.get_properties()
self.uris = None
self.hp_fax_uris = None
+ self.devices = None
try:
self.cups_connection = cups.Connection()
except RuntimeError, e:
@@ -81,15 +82,15 @@ class HalPrinter:
# Perhaps HPLIP can drive this device. If so, we
# should use an 'hp:...' URI for CUPS.
try:
- time.sleep (1) # Give HPLIP a chance to reconnect
- cmd = "LC_ALL=C hp-probe -b usb 2> /dev/null"
+ if self.devices == None:
+ time.sleep (1) # Give HPLIP a chance to reconnect
+ self.devices = cupshelpers.getDevices (self.cups_connection)
# Try to match serial number (support for having more
# than one printer of the same model on one machine)
matchfound = 0
if self.properties.has_key("printer.serial"):
- for line in os.popen (cmd, 'r').readlines ():
- if not line.strip ().startswith ("hp:"): continue
- uri = line.split ()[0]
+ for uri in self.devices.keys ():
+ if not uri.startswith ("hp:"): continue
s = uri.find ("?serial=")
if s == -1: continue
s += 8
@@ -102,9 +103,8 @@ class HalPrinter:
break
# Fall back to printer model
if matchfound == 0:
- for line in os.popen (cmd, 'r').readlines ():
- if not line.strip ().startswith ("hp:"): continue
- uri = line.split ()[0]
+ for uri in self.devices.keys ():
+ if not uri.startswith ("hp:"): continue
s = uri.find ("/usb/")
if s == -1: s = uri.find ("/par/")
if s == -1: s = uri.find ("/net/")
@@ -143,8 +143,9 @@ class HalPrinter:
# We only can have a fax URI if we have an HP printer
# supported by HPLIP
try:
- time.sleep (1) # Give HPLIP a chance to reconnect
- cmd = "LC_ALL=C hp-probe -b usb -e fax 2> /dev/null"
+ if self.devices == None:
+ time.sleep (1) # Give HPLIP a chance to reconnect
+ self.devices = cupshelpers.getDevices (self.cups_connection)
# Try to find a matching HPLIP fax URI for the HPLIP
# print URI for this device
uris = self.get_cups_uris ()
@@ -152,12 +153,9 @@ class HalPrinter:
for uri in uris:
if not uri.startswith ("hp:"): continue
faxuri = uri.replace("hp:/", "hpfax:/")
- for line in os.popen (cmd, 'r').readlines ():
- if not line.strip ().startswith ("hp:"): continue
- u = line.split ()[0]
- if uri == u:
- faxurisfound = 1
- faxuris.append (faxuri)
+ if faxuri in self.devices.keys ():
+ faxurisfound = 1
+ faxuris.append (faxuri)
except:
pass
hal-cups-utils-no-disable.patch:
--- NEW FILE hal-cups-utils-no-disable.patch ---
diff -up hal-cups-utils-0.6.13/systemv/hal_lpadmin.no-disable hal-cups-utils-0.6.13/systemv/hal_lpadmin
--- hal-cups-utils-0.6.13/systemv/hal_lpadmin.no-disable 2007-10-25 17:29:36.000000000 +0100
+++ hal-cups-utils-0.6.13/systemv/hal_lpadmin 2007-10-25 17:33:08.000000000 +0100
@@ -305,6 +305,8 @@ class HalPrinter:
def remove(self):
syslog (LOG_DEBUG, "remove")
+ return
+
# Disable all print queues which print to the device which
# we detected as having been removed. This prevents from
# jobs being retried every 30 seconds. The jobs wait in the
Index: hal-cups-utils.spec
===================================================================
RCS file: /cvs/pkgs/rpms/hal-cups-utils/F-7/hal-cups-utils.spec,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- hal-cups-utils.spec 24 Oct 2007 10:05:41 -0000 1.58
+++ hal-cups-utils.spec 25 Oct 2007 17:02:12 -0000 1.59
@@ -6,6 +6,8 @@
Group: Applications/System
Source: %{name}-%{version}.tar.gz
Source1: cups-config-daemon
+Patch1: hal-cups-utils-lpinfo.patch
+Patch2: hal-cups-utils-no-disable.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: glib2-devel
BuildRequires: dbus-devel >= 0.60
@@ -27,6 +29,8 @@
rm -rf $RPM_BUILD_ROOT
%setup -q
+%patch1 -p1 -b .lpinfo
+%patch2 -p1 -b .no-disable
%build
@@ -58,6 +62,12 @@
%{_initrddir}/cups-config-daemon
%changelog
+* Thu Oct 25 2007 Tim Waugh <twaugh at redhat.com> 0.6.13-2
+- Avoid running hplip commands directly so that we don't trigger SELinux
+ AVC messages.
+- Don't disable printers that are unplugged (works around bug #352681 and
+ bug #352691).
+
* Wed Oct 24 2007 Tim Waugh <twaugh at redhat.com> 0.6.13-1
- 0.6.13. Numerous changes.
More information about the scm-commits
mailing list