From 3452672b3d369544175ec44ed0986d022fdfb200 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arkadiusz=20Mi=C5=9Bkiewicz?= Date: Wed, 30 Nov 2011 18:09:28 +0000 Subject: [PATCH] - patch binary plugin to fix https://bugs.launchpad.net/hplip/+bug/666780 (32bit only fix for now) Changed files: hplip-binary-fixup.patch -> 1.1 hplip.spec -> 1.92 --- hplip-binary-fixup.patch | 44 ++++++++++++++++++++++++++++++++++++++++ hplip.spec | 4 +++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 hplip-binary-fixup.patch diff --git a/hplip-binary-fixup.patch b/hplip-binary-fixup.patch new file mode 100644 index 0000000..6bf1056 --- /dev/null +++ b/hplip-binary-fixup.patch @@ -0,0 +1,44 @@ +--- hplip-3.11.10/base/pkit.py~ 2011-10-02 05:06:15.000000000 +0200 ++++ hplip-3.11.10/base/pkit.py 2011-11-30 19:07:51.344925378 +0100 +@@ -318,7 +318,28 @@ + log.debug("shutdown: %s" % str(e)) + return False + +- ++def binaryPatch(f): ++ try ++ # file, md5sum, replace content at address with specified byte ++ patches = { 'lj-x86_32.so' : { 'md5': '30bdf8c844508a53d80362f9eba670c5', ++ # https://bugs.launchpad.net/hplip/+bug/666780 ++ 'replace' : [ (0xA068, 0x10) ] ++ } } ++ if f in patches: ++ d = open(f, 'rb').read() ++ m = hashlib.md5() ++ m.update(d) ++ m.digest() ++ if patches[f]['md5'] == m.hexdigest(): ++ file = open(f, 'rb+') ++ for (addr, val) in patches[f]['replace']: ++ file.seek(addr) ++ file.write(chr(val)) ++ file.close() ++ except Exception, e: ++ log.debug("binaryPatch: %s" % str(e)) ++ return False ++ return True + + def copyPluginFiles(src_dir): + os.chdir(src_dir) +@@ -411,6 +432,11 @@ + continue + + else: ++ ++ if not binaryPatch(trg): ++ log.error("Target file %s could not be binary patched to fixup bugs." % trg) ++ continue ++ + if not os.path.exists(trg): + log.error("Target file %s does not exist. File copy failed." % trg) + continue diff --git a/hplip.spec b/hplip.spec index c2e8854..99664b1 100644 --- a/hplip.spec +++ b/hplip.spec @@ -11,7 +11,7 @@ Summary: Hewlett-Packard Linux Imaging and Printing suite - printing and scannin Summary(pl.UTF-8): Narzędzia Hewlett-Packard Linux Imaging and Printing - drukowanie i skanowanie przy użyciu urządzeń HP Name: hplip Version: 3.11.10 -Release: 1 +Release: 1.2 License: BSD (hpijs), MIT (low-level scanning and printing code), GPL v2 (the rest) Group: Applications/System Source0: http://downloads.sourceforge.net/hplip/%{name}-%{version}.tar.gz @@ -19,6 +19,7 @@ Source0: http://downloads.sourceforge.net/hplip/%{name}-%{version}.tar.gz Patch0: %{name}-desktop.patch Patch1: unresolved.patch Patch2: pld-distro.patch +Patch3: %{name}-binary-fixup.patch URL: http://hplipopensource.com/ BuildRequires: autoconf BuildRequires: automake @@ -156,6 +157,7 @@ urządzenia HP AiO. %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 %{__sed} -i -e's,^#!/usr/bin/env python$,#!/usr/bin/python,' *.py %{__sed} -i -e 's#test -d /usr/share/polkit-1#true#' configure.in -- 2.44.0