summaryrefslogtreecommitdiff
path: root/lib/libalpm/sync.c
diff options
context:
space:
mode:
authorBryan Ischo <bji-keyword-pacman.3644cb@www.ischo.com>2009-03-09 09:56:13 +1300
committerDan McGee <dan@archlinux.org>2009-04-11 14:39:24 -0500
commitdb3e166503386b4f9e456017fd56d8bce84528fe (patch)
tree6be74c28ff430128c8a1a7a3064e32d3fe49d5ec /lib/libalpm/sync.c
parentd70465decc617412db0670c8169ec22421c8e3d1 (diff)
downloadpacman-db3e166503386b4f9e456017fd56d8bce84528fe.tar.xz
Look in target-list first to resolve dependencies
This fixes a bug introduced by my previous changes which changes the behavior of IgnorePkg/IgnoreGroup to allow the user to remove unresolvable packages from the transaction. The bug is that the target-list was no longer being consulted first to resolve dependencies, which means that if two packages in the sync database satisfied a dependency, and the user explicitly requested one of those two packages in the sync, the other package was still being pulled in. A new test was added, sync993.py, to verify the desired behavior. Signed-off-by: Bryan Ischo <bji-keyword-pacman.3644cb@www.ischo.com> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/sync.c')
-rw-r--r--lib/libalpm/sync.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index e6923abe..1dbd93d5 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -348,6 +348,7 @@ static int compute_download_size(pmpkg_t *newpkg)
int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync, alpm_list_t **data)
{
alpm_list_t *deps = NULL;
+ alpm_list_t *preferred = NULL;
alpm_list_t *unresolvable = NULL;
alpm_list_t *remove = NULL; /* allow checkdeps usage with trans->packages */
alpm_list_t *i, *j;
@@ -370,19 +371,21 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
EVENT(trans, PM_TRANS_EVT_RESOLVEDEPS_START, NULL, NULL);
_alpm_log(PM_LOG_DEBUG, "resolving target's dependencies\n");
- /* build remove list for resolvedeps */
+ /* build remove list and preferred list for resolvedeps */
for(i = trans->packages; i; i = i->next) {
pmpkg_t *spkg = i->data;
for(j = spkg->removes; j; j = j->next) {
remove = alpm_list_add(remove, j->data);
}
+ preferred = alpm_list_add(preferred, spkg);
}
/* Resolve packages in the transaction one at a time, in addtion
building up a list of packages which could not be resolved. */
for(i = trans->packages; i; i = i->next) {
pmpkg_t *pkg = i->data;
- if(_alpm_resolvedeps(db_local, dbs_sync, pkg, &resolved, remove, data) == -1) {
+ if(_alpm_resolvedeps(db_local, dbs_sync, pkg, preferred,
+ &resolved, remove, data) == -1) {
unresolvable = alpm_list_add(unresolvable, pkg);
}
/* Else, [resolved] now additionally contains [pkg] and all of its