From bac6bc9e839aabce20d35b49d6710b264c55391c Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 3 Nov 2007 16:34:23 +0000 Subject: [PATCH] Bug #197932 - Make dbapi._cpv_sort_ascending() preserve explicit -r0 for consistency in findname and aux_get calls. svn path=/main/trunk/; revision=8390 --- pym/portage/dbapi/__init__.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py index 0bec4cce5..90e4ca779 100644 --- a/pym/portage/dbapi/__init__.py +++ b/pym/portage/dbapi/__init__.py @@ -30,16 +30,17 @@ class dbapi(object): if len(cpv_list) > 1: first_split = catpkgsplit(cpv_list[0]) cat = first_split[0] - cpv_list[0] = first_split[1:] - for i in xrange(1, len(cpv_list)): - cpv_list[i] = catpkgsplit(cpv_list[i])[1:] + # If the cpv includes explicit -r0, it has to be preserved + # for consistency in findname and aux_get calls, so use a + # dict to map strings back to their original values. + str_map = {} + for i, cpv in enumerate(cpv_list): + mysplit = tuple(catpkgsplit(cpv)[1:]) + str_map[mysplit] = cpv + cpv_list[i] = mysplit cpv_list.sort(pkgcmp) - for i, (pn, ver, rev) in enumerate(cpv_list): - if rev == "r0": - cpv = cat + "/" + pn + "-" + ver - else: - cpv = cat + "/" + pn + "-" + ver + "-" + rev - cpv_list[i] = cpv + for i, mysplit in enumerate(cpv_list): + cpv_list[i] = str_map[mysplit] def cpv_all(self): """Return all CPVs in the db -- 2.26.2