From 5b7c54e0704f59c31767e890965249871da2085c Mon Sep 17 00:00:00 2001 From: Denis Silakov Date: Thu, 12 Nov 2015 18:12:12 +0300 Subject: [PATCH] Reposync: recognize situations when one of conflicting packages obsoletes another --- urpm-reposync.py | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/urpm-reposync.py b/urpm-reposync.py index 94030ba..f33b758 100755 --- a/urpm-reposync.py +++ b/urpm-reposync.py @@ -219,19 +219,30 @@ def emulate_install(pkg): ''' Reurns True if something was done, False - if package was not installed ''' global actions, not_provided_packages, conflicting_packages vprint('Emulating package installation: ' + pkg) - + + # TODO: Currently we only check that new package obsoletes the name of conflicting + # package. It would be more correct to check obsoleted version; on the other hand, + # removal of conflicting package is the only chance for us to avoid conflict, + # otherwise reposync will refuse to work + pkg_obseletes = [] + for obs in repository.packages[pkg]['obsoletes']: + pkg_obseletes.append(obs.N) + conflicts = False for confl in repository.packages[pkg]['conflicts']: res = installed.whatprovides(confl) for item in res[:]: if item in to_remove_pre: res.remove(item) + if item in pkg_obseletes: + res.remove(item) + to_remove_pre.append(item) if res: conflicts = True conflicting_packages.append( (pkg, res) ) - vprint("New conflict: %s, %s" % (str(pkg), str(res))) - - + vprint("New conflict1: %s, %s" % (str(pkg), str(res))) + + for prov in repository.packages[pkg]['provides']: res = installed.whatconflicts(prov) for item in res[:]: @@ -240,13 +251,13 @@ def emulate_install(pkg): if res: conflicts = True conflicting_packages.append( (res, pkg) ) - vprint("New conflict: %s, %s" % (str(res), str(pkg))) - + vprint("New conflict2: %s, %s" % (str(res), str(pkg))) + if conflicts: return False - + # remove the previosly added conflicts for this package - + for item in conflicting_packages[:]: pkg1, pkgs2 = item if isinstance(pkgs2, basestring):