From 3c8d69c6942fd8e39417d5e16c4c0cdf2465596e Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 17 Oct 2012 21:18:56 -0700 Subject: [PATCH] emaint: sync MoveHandler check code with dbapi's --- pym/portage/emaint/modules/move/move.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pym/portage/emaint/modules/move/move.py b/pym/portage/emaint/modules/move/move.py index e05076bc3..9f9ba90cd 100644 --- a/pym/portage/emaint/modules/move/move.py +++ b/pym/portage/emaint/modules/move/move.py @@ -3,6 +3,7 @@ import portage from portage import os +from portage.exception import InvalidData from _emerge.Package import Package class MoveHandler(object): @@ -66,14 +67,21 @@ class MoveHandler(object): if update_cmd[0] == "move": origcp, newcp = update_cmd[1:] for cpv in match(origcp): - cpv = pkg_str(cpv, None) + try: + cpv = pkg_str(cpv, origcp.repo) + except (KeyError, InvalidData): + continue if repo_match(cpv.repo): errors.append("'%s' moved to '%s'" % (cpv, newcp)) elif update_cmd[0] == "slotmove": pkg, origslot, newslot = update_cmd[1:] - for cpv in match(pkg): - cpv = pkg_str(cpv, None) - if cpv.slot == origslot and repo_match(cpv.repo): + atom = pkg.with_slot(origslot) + for cpv in match(atom): + try: + cpv = pkg_str(cpv, atom.repo) + except (KeyError, InvalidData): + continue + if repo_match(cpv.repo): errors.append("'%s' slot moved from '%s' to '%s'" % \ (cpv, origslot, newslot)) if onProgress: -- 2.26.2