Fix dblink._unmerge_pkgfiles() to use the correct version of perform_md5
authorZac Medico <zmedico@gentoo.org>
Sat, 15 Aug 2009 00:15:11 +0000 (00:15 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 15 Aug 2009 00:15:11 +0000 (00:15 -0000)
when it falls back to utf8 encoding.

svn path=/main/trunk/; revision=14058

pym/portage/checksum.py
pym/portage/dbapi/vartree.py

index 5def1ac8aa64010fbb0e4273a05745be2becbeea..0e6a9d55248816942d2d74b554ea38e2a3f5e6bd 100644 (file)
@@ -6,6 +6,7 @@
 import portage
 from portage.const import PRIVATE_PATH,PRELINK_BINARY,HASHING_BLOCKSIZE
 from portage import os
+from portage import _fs_encoding
 from portage import _merge_encoding
 from portage import _unicode_encode
 import errno
@@ -233,7 +234,8 @@ def perform_checksum(filename, hashname="MD5", calc_prelink=0):
                        if hashname not in hashfunc_map:
                                raise portage.exception.DigestException(hashname + \
                                        " hash function not available (needs dev-python/pycrypto)")
-                       myhash, mysize = hashfunc_map[hashname](myfilename)
+                       myhash, mysize = hashfunc_map[hashname](_unicode_encode(myfilename,
+                               encoding=_fs_encoding, errors='strict'))
                except (OSError, IOError), e:
                        if e.errno == errno.ENOENT:
                                raise portage.exception.FileNotFound(myfilename)
index 6729e41e74ba370d49462ca202c20ffe0fb10fdf..40d20876d999149a1d2dbb38b01d193a77f06dfa 100644 (file)
@@ -2288,6 +2288,7 @@ class dblink(object):
                """
 
                os = _os_merge
+               perf_md5 = perform_md5
                showMessage = self._display_merge
                scheduler = self._scheduler
 
@@ -2391,6 +2392,7 @@ class dblink(object):
                                                        pass
                                                else:
                                                        os = portage.os
+                                                       perf_md5 = portage.checksum.perform_md5
 
                                file_data = pkgfiles[objkey]
                                file_type = file_data[0]
@@ -2481,7 +2483,7 @@ class dblink(object):
                                                continue
                                        mymd5 = None
                                        try:
-                                               mymd5 = perform_md5(obj, calc_prelink=1)
+                                               mymd5 = perf_md5(obj, calc_prelink=1)
                                        except FileNotFound, e:
                                                # the file has disappeared between now and our stat call
                                                show_unmerge("---", unmerge_desc["!obj"], file_type, obj)