From d27cf48d48b1fe61ea10ccd8cb4ebca54ec70035 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Wed, 21 Jul 2010 15:33:29 +0200 Subject: [PATCH] [entropy.client.interfaces.dep] Client.calculate_updates: properly handle tagged packages upgrade --- libraries/entropy/client/interfaces/dep.py | 42 ++++++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/libraries/entropy/client/interfaces/dep.py b/libraries/entropy/client/interfaces/dep.py index 4b8e0e452..1671b9ad2 100644 --- a/libraries/entropy/client/interfaces/dep.py +++ b/libraries/entropy/client/interfaces/dep.py @@ -1767,14 +1767,42 @@ class CalculatorsMixin: continue use_match_cache = True do_continue = False + + # try to search inside package tag, if it's available, + # otherwise, do the usual duties. + cl_pkgkey_tag = None + if cl_tag: + cl_pkgkey_tag = cl_pkgkey + etpConst['entropytagprefix'] + \ + cl_tag + while True: try: - match = self.atom_match( - cl_pkgkey, - match_slot = cl_slot, - extended_results = True, - use_cache = use_match_cache - ) + match = None + if cl_pkgkey_tag is not None: + # search with tag first, if nothing pops up, fallback + # to usual search? + match = self.atom_match( + cl_pkgkey_tag, + match_slot = cl_slot, + extended_results = True, + use_cache = use_match_cache + ) + try: + if const_isnumber(match[1]): + match = None + except TypeError: + if not use_match_cache: + raise + use_match_cache = False + continue + + if match is None: + match = self.atom_match( + cl_pkgkey, + match_slot = cl_slot, + extended_results = True, + use_cache = use_match_cache + ) except OperationalError: # ouch, but don't crash here do_continue = True @@ -1802,7 +1830,7 @@ class CalculatorsMixin: if (m_idpackage, repoid) not in update: update.append((m_idpackage, repoid)) continue - elif (cl_revision != revision): + if cl_revision != revision: # different revision if cl_revision == 9999 and ignore_spm_downgrades: # no difference, we're ignoring revision 9999