]> git.pld-linux.org Git - packages/hplip.git/blob - hplip-binary-fixup.patch
- fix files
[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,32 @@
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 +        fs = os.path.basename(f)
31 +        if fs in patches:
32 +            d = open(f, 'rb').read()
33 +            m = md5()
34 +            m.update(d)
35 +            m.digest()
36 +            if patches[fs]['md5'] == m.hexdigest():
37 +                file = open(f, 'rb+')
38 +                for (addr, val) in patches[fs]['replace']:
39 +                    file.seek(addr)
40 +                    file.write(chr(val))
41 +                file.close()
42 +    except Exception, e:
43 +        log.error("Could not patch binary `%s' for known issues." % str(e))
44 +        return False
45 +    return True
46  
47  def copyPluginFiles(src_dir):
48      os.chdir(src_dir)
49 @@ -411,6 +441,9 @@
50              continue
51  
52          else:
53 +            
54 +            binaryPatch(trg)
55 +
56              if not os.path.exists(trg):
57                  log.error("Target file %s does not exist. File copy failed." % trg)
58                  continue
This page took 0.082998 seconds and 3 git commands to generate.