From d4a1b1095779af81dcd786911d27a5bb862d8e91 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 15 Aug 2009 00:15:11 +0000 Subject: Fix dblink._unmerge_pkgfiles() to use the correct version of perform_md5 when it falls back to utf8 encoding. svn path=/main/trunk/; revision=14058 --- pym/portage/checksum.py | 4 +++- pym/portage/dbapi/vartree.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'pym') diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py index 5def1ac8a..0e6a9d552 100644 --- a/pym/portage/checksum.py +++ b/pym/portage/checksum.py @@ -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) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 6729e41e7..40d20876d 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -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) -- cgit v1.2.3-1-g7c22