diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-07-13 16:33:49 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-07-13 16:33:49 -0700 |
commit | dde6df65ecbc522dc23cb8d24be3e4dd52657da8 (patch) | |
tree | 9b0ca15a0ed3aa826654a6eb8c090e510c175268 /pym/portage/update.py | |
parent | 4f1558ec085d4d1716faf8558741aad2e542463f (diff) | |
download | portage-dde6df65ecbc522dc23cb8d24be3e4dd52657da8.tar.gz portage-dde6df65ecbc522dc23cb8d24be3e4dd52657da8.tar.bz2 portage-dde6df65ecbc522dc23cb8d24be3e4dd52657da8.zip |
slotmove: fix handling for EAPI 4-slot-abiv2.2.0_alpha118
This is just a really minimal fix, in order to prevent slotmove from
behaving incorrectly with packages that use EAPI 4-slot-abi. Any
slotmove commands that try so specify a sub-slot are treated as invalid
for now, since that will required additional EAPI conditional logic, as
reported in bug #426476.
Diffstat (limited to 'pym/portage/update.py')
-rw-r--r-- | pym/portage/update.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/pym/portage/update.py b/pym/portage/update.py index 34e466366..a5cb92eda 100644 --- a/pym/portage/update.py +++ b/pym/portage/update.py @@ -22,6 +22,8 @@ portage.proxy.lazyimport.lazyimport(globals(), ) from portage.const import USER_CONFIG_PATH +from portage.dep import _get_slot_re +from portage.eapi import _get_eapi_attrs from portage.exception import DirectoryNotFound, InvalidAtom, PortageException from portage.localization import _ @@ -30,7 +32,7 @@ if sys.hexversion >= 0x3000000: ignored_dbentries = ("CONTENTS", "environment.bz2") -def update_dbentry(update_cmd, mycontent): +def update_dbentry(update_cmd, mycontent, eapi=None): if update_cmd[0] == "move": old_value = str(update_cmd[1]) if old_value in mycontent: @@ -143,6 +145,8 @@ def grab_updates(updpath, prev_mtimes=None): def parse_updates(mycontent): """Valid updates are returned as a list of split update commands.""" + eapi_attrs = _get_eapi_attrs(None) + slot_re = _get_slot_re(eapi_attrs) myupd = [] errors = [] mylines = mycontent.splitlines() @@ -194,6 +198,23 @@ def parse_updates(mycontent): errors.append(_("ERROR: Malformed update entry '%s'") % myline) continue + invalid_slot = False + for slot in (origslot, newslot): + m = slot_re.match(slot) + if m is None: + invalid_slot = True + break + if "/" in slot: + # Don't support EAPI 4-slot-abi style SLOT in slotmove + # yet, since the relevant code isn't aware of EAPI yet + # (see bug #426476). + invalid_slot = True + break + + if invalid_slot: + errors.append(_("ERROR: Malformed update entry '%s'") % myline) + continue + # The list of valid updates is filtered by continue statements above. myupd.append(mysplit) return myupd, errors |