diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-02-12 11:55:48 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-02-12 11:55:48 +0000 |
commit | d164a10e2d5a3aece91b9e05d7c26842de3b4f93 (patch) | |
tree | 17f69a1fe5a80b86497e1fc8fe59f0a93223ec18 | |
parent | b76d2cb80bce6611dbd93db1819b4a449556acba (diff) | |
download | portage-d164a10e2d5a3aece91b9e05d7c26842de3b4f93.tar.gz portage-d164a10e2d5a3aece91b9e05d7c26842de3b4f93.tar.bz2 portage-d164a10e2d5a3aece91b9e05d7c26842de3b4f93.zip |
fix perform_checksum.perform_checksum() so that it wraps FileNotFound exceptions
svn path=/main/trunk/; revision=2697
-rw-r--r-- | pym/portage.py | 12 | ||||
-rw-r--r-- | pym/portage_checksum.py | 10 |
2 files changed, 12 insertions, 10 deletions
diff --git a/pym/portage.py b/pym/portage.py index 0a9186b5a..4c574b3f0 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -5780,13 +5780,11 @@ class dblink: mymd5 = None try: mymd5 = portage_checksum.perform_md5(obj, calc_prelink=1) - except (OSError,IOError), e: - if e.errno == errno.ENOENT: - # the file has disappeared between now and our stat call - writemsg_stdout("--- !obj %s %s\n" % ("obj", obj)) - continue - else: - raise e + except portage_exception.FileNotFound, e: + # the file has disappeared between now and our stat call + writemsg_stdout("--- !obj %s %s\n" % ("obj", obj)) + continue + # string.lower is needed because db entries used to be in upper-case. The # string.lower allows for backwards compatibility. if mymd5 != string.lower(pkgfiles[objkey][2]): diff --git a/pym/portage_checksum.py b/pym/portage_checksum.py index a11dbc4f6..2dd447df2 100644 --- a/pym/portage_checksum.py +++ b/pym/portage_checksum.py @@ -131,9 +131,13 @@ def perform_checksum(filename, hash_function=md5hash, calc_prelink=0): if retval==0: #portage_util.writemsg(">>> prelink checksum '"+str(filename)+"'.\n") myfilename=prelink_tmpfile - - myhash, mysize = hash_function(myfilename) - + try: + myhash, mysize = hash_function(myfilename) + except (OSError, IOError), e: + if e.errno == errno.ENOENT: + raise portage_exception.FileNotFound(e) + else: + raise e if calc_prelink and prelink_capable: try: os.unlink(prelink_tmpfile) |