summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/sync.c26
-rw-r--r--test/pacman/tests/replace102.py2
-rw-r--r--test/pacman/tests/sync1105.py17
-rw-r--r--test/pacman/tests/sync132.py4
4 files changed, 33 insertions, 16 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 2a56115b..147a8377 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -209,24 +209,26 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade)
continue;
}
- /* Search for literal then replacers in each sync database. */
+ /* Search for replacers then literal (if no replacer) in each sync database. */
for(j = handle->dbs_sync; j; j = j->next) {
alpm_db_t *sdb = j->data;
/* Check sdb */
- alpm_pkg_t *spkg = _alpm_db_get_pkgfromcache(sdb, lpkg->name);
- int literal_upgrade = 0;
- if(spkg) {
- literal_upgrade = check_literal(handle, lpkg, spkg, enable_downgrade);
- if(literal_upgrade) {
- trans->add = alpm_list_add(trans->add, spkg);
- }
+ alpm_list_t *replacers;
+ replacers = check_replacers(handle, lpkg, sdb);
+ if(replacers) {
+ trans->add = alpm_list_join(trans->add, replacers);
/* jump to next local package */
break;
} else {
- alpm_list_t *replacers;
- replacers = check_replacers(handle, lpkg, sdb);
- if(replacers) {
- trans->add = alpm_list_join(trans->add, replacers);
+ alpm_pkg_t *spkg = _alpm_db_get_pkgfromcache(sdb, lpkg->name);
+ if(spkg) {
+ int literal_upgrade = 0;
+ literal_upgrade = check_literal(handle, lpkg, spkg, enable_downgrade);
+ if(literal_upgrade) {
+ trans->add = alpm_list_add(trans->add, spkg);
+ }
+ /* jump to next local package */
+ break;
}
}
}
diff --git a/test/pacman/tests/replace102.py b/test/pacman/tests/replace102.py
index ca05d4e6..fe0bdad5 100644
--- a/test/pacman/tests/replace102.py
+++ b/test/pacman/tests/replace102.py
@@ -21,5 +21,3 @@ self.addrule("PACMAN_RETCODE=0")
self.addrule("!PKG_EXIST=python-yaml")
self.addrule("PKG_VERSION=python2-yaml|5-1")
self.addrule("FILE_EXIST=lib/python2/file")
-
-self.expectfailure = True
diff --git a/test/pacman/tests/sync1105.py b/test/pacman/tests/sync1105.py
new file mode 100644
index 00000000..cc43c8ca
--- /dev/null
+++ b/test/pacman/tests/sync1105.py
@@ -0,0 +1,17 @@
+self.description = "Upgrade with a replacement in a repo with lower prioriy"
+
+sp1 = pmpkg("pkg2")
+self.addpkg2db("sync1", sp1)
+
+sp2 = pmpkg("pkg1")
+sp2.replaces = ["pkg2"]
+self.addpkg2db("sync2", sp2)
+
+lp = pmpkg("pkg2")
+self.addpkg2db("local", lp)
+
+self.args = "-Su"
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("!PKG_EXIST=pkg1")
+self.addrule("PKG_EXIST=pkg2")
diff --git a/test/pacman/tests/sync132.py b/test/pacman/tests/sync132.py
index 2d671c73..5e85727d 100644
--- a/test/pacman/tests/sync132.py
+++ b/test/pacman/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")