From 999907a64249d9bfd2e42e477bfb9dd9a3cb535a Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 14 May 2012 16:56:20 -0700 Subject: bintree: validate remove cpv more --- pym/portage/dbapi/bintree.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'pym') diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 51c093658..a8027ee6c 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -24,7 +24,7 @@ from portage.cache.mappings import slot_dict_class from portage.const import CACHE_PATH from portage.dbapi.virtual import fakedbapi from portage.dep import Atom, use_reduce, paren_enclose -from portage.exception import AlarmSignal, InvalidPackageName, \ +from portage.exception import AlarmSignal, InvalidData, InvalidPackageName, \ PermissionDenied, PortageException from portage.localization import _ from portage import _movefile @@ -219,6 +219,13 @@ def _pkgindex_cpv_map_latest_build(pkgindex): for d in pkgindex.packages: cpv = d["CPV"] + try: + cpv = _pkg_str(cpv) + except InvalidData: + writemsg(_("!!! Invalid remote binary package: %s\n") % cpv, + noiselevel=-1) + continue + btime = d.get('BUILD_TIME', '') try: btime = int(btime) @@ -1003,7 +1010,12 @@ class binarytree(object): noiselevel=-1) continue mycat = mycat.strip() - fullpkg = mycat+"/"+mypkg[:-5] + try: + fullpkg = _pkg_str(mycat+"/"+mypkg[:-5]) + except InvalidData: + writemsg(_("!!! Invalid remote binary package: %s\n") % mypkg, + noiselevel=-1) + continue if fullpkg in metadata: # When using this old protocol, comparison with the remote -- cgit v1.2.3-1-g7c22