]> git.pld-linux.org Git - packages/hplip.git/blob - hplip-binary-fixup.patch
- rel 2; patch binary plugin for 64bit, too
[packages/hplip.git] / hplip-binary-fixup.patch
1 --- hplip-3.11.10/base/pkit.py.org      2011-11-30 20:01:59.640469386 +0100
2 +++ hplip-3.11.10/base/pkit.py  2011-11-30 20:06:43.216664960 +0100
3 @@ -30,6 +30,11 @@
4  import shutil
5  import stat
6  
7 +try:
8 +    from hashlib import md5 as md5
9 +except ImportError:
10 +    from md5 import md5
11 +
12  # Local
13  from base.logger import *
14  from base.g import *
15 @@ -318,7 +323,31 @@
16              log.debug("shutdown: %s" % str(e))
17              return False
18  
19 -
20 +def binaryPatch(f):
21 +    try
22 +        # file, md5sum, replace content at address with specified byte
23 +        patches = { 'lj-x86_32.so' : { 'md5': '30bdf8c844508a53d80362f9eba670c5',
24 +                                       # https://bugs.launchpad.net/hplip/+bug/666780
25 +                                       'replace' : [ (0xA068, 0x10) ] },
26 +                    'lj-x86_64.so' : { 'md5': '28e1b2cde011cbbcd4b5c85c1866c893',
27 +                                       # https://bugs.launchpad.net/hplip/+bug/666780
28 +                                       'replace' : [ (0xD0D0, 0x10) ] }
29 +                  }
30 +        if f in patches:
31 +            d = open(f, 'rb').read()
32 +            m = md5()
33 +            m.update(d)
34 +            m.digest()
35 +            if patches[f]['md5'] == m.hexdigest():
36 +                file = open(f, 'rb+')
37 +                for (addr, val) in patches[f]['replace']:
38 +                    file.seek(addr)
39 +                    file.write(chr(val))
40 +                file.close()
41 +    except Exception, e:
42 +        log.debug("binaryPatch: %s" % str(e))
43 +        return False
44 +    return True
45  
46  def copyPluginFiles(src_dir):
47      os.chdir(src_dir)
48 @@ -411,6 +440,11 @@
49              continue
50  
51          else:
52 +            
53 +            if not binaryPatch(trg):
54 +                log.error("Target file %s could not be binary patched to fixup bugs." % trg)
55 +                continue
56 +
57              if not os.path.exists(trg):
58                  log.error("Target file %s does not exist. File copy failed." % trg)
59                  continue
This page took 0.035604 seconds and 3 git commands to generate.