From 882bff36acad5c47df5b35fd3afb411dc4f092b0 Mon Sep 17 00:00:00 2001
From: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Date: Mon, 13 Apr 2009 15:08:38 +0200
Subject: Remove find_replacements()

"Foo replaces bar" simply means that "foo is a new version of bar".
So this patch refactors the code to use this "rule".

_alpm_sync_sysupgrade now does the following for each local package [bar]
(pseudo-code):
for db in syncdbs {
   if(db contains bar) {check if db/bar is an upgrade; break;}
   replacers = find(bar replacers in db);
   if(replacers!=NULL) {ask_user; break;}
}

Note:
1. Replacers are grouped per repo. If more than one package replace bar in
a repo, all of them are considered ("package set of bar replacers").
2. If repo1/foo1 and repo2/foo2 both replaces bar, only repo1/foo1 is
considered (if repo1 stands before repo2 in pacman.conf). FS#11737 is fixed.
3. It can happen that pacman doesn't consider any replacer, if it found a
literal "earlier", so sync132.py modified accordingly (btw, that situation
should not appear irl).

The new sysupgrade code doesn't use sync_newversion(), so I removed the
"local is newer than repo" message, which was annoying with -Qu and
SyncFirst.

Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
---
 pactest/tests/sync132.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'pactest/tests')

diff --git a/pactest/tests/sync132.py b/pactest/tests/sync132.py
index 5e85727d..2d671c73 100644
--- a/pactest/tests/sync132.py
+++ b/pactest/tests/sync132.py
@@ -14,5 +14,5 @@ self.addpkg2db("local", lp)
 self.args = "-Su"
 
 self.addrule("PACMAN_RETCODE=0")
-self.addrule("PKG_EXIST=pkg1")
-self.addrule("!PKG_EXIST=pkg2")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
-- 
cgit v1.2.3-70-g09d2