From 8360526d2035a6848315168050f2e7626c42b64d Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Thu, 22 May 2014 11:46:59 +0200 Subject: [PATCH] Treat logging before importing of logger module (bug #984699). --- hplip-log-stderr.patch | 37 +++++++++++++++++++++++++++++++++++++ hplip.spec | 9 ++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 hplip-log-stderr.patch diff --git a/hplip-log-stderr.patch b/hplip-log-stderr.patch new file mode 100644 index 0000000..0959ea2 --- /dev/null +++ b/hplip-log-stderr.patch @@ -0,0 +1,37 @@ +diff -up hplip-3.14.4/fax/backend/hpfax.py.log hplip-3.14.4/fax/backend/hpfax.py +--- hplip-3.14.4/fax/backend/hpfax.py.log 2014-04-04 12:42:15.000000000 +0200 ++++ hplip-3.14.4/fax/backend/hpfax.py 2014-05-22 11:39:06.917683733 +0200 +@@ -52,7 +52,10 @@ home_dir = '' + + def bug(msg): + syslog.syslog("hpfax[%d]: error: %s\n" % (pid, msg)) +- log.stderr("ERROR: %s\n" % msg) ++ try: ++ log.stderr("ERROR: %s" % msg) ++ except NameError: ++ sys.stderr.write("ERROR: %s\n" % msg) + + + if os.path.exists(config_file): +diff -up hplip-3.14.4/prnt/filters/hpps.log hplip-3.14.4/prnt/filters/hpps +--- hplip-3.14.4/prnt/filters/hpps.log 2014-04-04 12:39:47.000000000 +0200 ++++ hplip-3.14.4/prnt/filters/hpps 2014-05-22 11:38:30.620187178 +0200 +@@ -49,10 +49,16 @@ home_dir = '' + + + def bug(m): +- log.stderr("ERROR: %s" % m) ++ try: ++ log.stderr("ERROR: %s" % m) ++ except NameError: ++ sys.stderr.write("ERROR: %s\n" % m) + + def msg(m): +- log.stderr("INFO: %s" % m) ++ try: ++ log.stderr("INFO: %s" % msg) ++ except NameError: ++ sys.stderr.write("INFO: %s\n" % msg) + + if os.path.exists(config_file): + config = ConfigParser.ConfigParser() diff --git a/hplip.spec b/hplip.spec index 034ff62..e4a80b0 100644 --- a/hplip.spec +++ b/hplip.spec @@ -7,7 +7,7 @@ Summary: HP Linux Imaging and Printing Project Name: hplip Version: 3.14.4 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv2+ and MIT Url: http://hplip.sourceforge.net/ @@ -31,6 +31,7 @@ Patch14: hplip-deviceIDs-ppd.patch Patch15: hplip-ppd-ImageableArea.patch Patch16: hplip-scan-tmp.patch Patch17: hplip-codec.patch +Patch18: hplip-log-stderr.patch %global hpijs_epoch 1 Requires: hpijs%{?_isa} = %{hpijs_epoch}:%{version}-%{release} @@ -238,6 +239,9 @@ done # Fixed codec issue (bug #984167). %patch17 -p1 -b .codec +# Treat logging before importing of logger module (bug #984699). +%patch18 -p1 -b .log-stderr + sed -i.duplex-constraints \ -e 's,\(UIConstraints.* \*Duplex\),//\1,' \ prnt/drv/hpcups.drv.in @@ -474,6 +478,9 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop %postun libs -p /sbin/ldconfig %changelog +* Thu May 22 2014 Jiri Popelka - 3.14.4-5 +- Treat logging before importing of logger module (bug #984699). + * Tue Apr 29 2014 Tim Waugh - 3.14.4-4 - Fixed scan-tmp patch (bug #1076954).