From 017184fab55b22c1efd8a7d6d6d832ca302d8e15 Mon Sep 17 00:00:00 2001 From: Olivier Brunel Date: Mon, 4 Mar 2013 09:48:10 +0100 Subject: libalpm: Search for replacers before literals Since 882bff36 literals would be searched before replacers, resulting in a package being replaced by another not actually being replaced under certain conditions (e.g. they're both in the same repo). This change effectively reversed the expectations in test sync132. This patch switches the order back to replacers first, thus making sure if a package is replacing another one, the change will always happen, even if both are in the same repo. Note that a package replacing another one in a repo with higher priority will not be done, see FS#11737 and test sync1105 Signed-off-by: Olivier Brunel Signed-off-by: Allan McRae --- lib/libalpm/sync.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'lib/libalpm') 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; } } } -- cgit v1.2.3-70-g09d2