[pacman-dev] [WIP] Fix for overzealous package removal with unmet dependencies
Allan McRae
allan at archlinux.org
Sun Sep 16 10:21:25 EDT 2012
Here goes a WIP patch for FS#30649. It fixes one the sync140.py
testcase just sent to the mailing list, but not sync141.py - it works
only when the root cause of the excess dependency removal is first in
the upgraded package list.
If anyone has an idea for how to get it fully fixed, I would appreciate
the help.
Allan
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 841e5d6..65a8f52 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -406,14 +406,29 @@ int _alpm_sync_prepare(alpm_handle_t *handle,
alpm_list_t **data)
/* Resolve packages in the transaction one at a time, in addition
building up a list of packages which could not be resolved. */
- for(i = trans->add; i; i = i->next) {
+
+ i = trans->add;
+ while(i != NULL) {
alpm_pkg_t *pkg = i->data;
if(_alpm_resolvedeps(handle, localpkgs, pkg, trans->add,
&resolved, remove, data) == -1) {
unresolvable = alpm_list_add(unresolvable, pkg);
+
+ /* remove the unresolvable package from the upgrade
+ list and recalculate localpkgs to allow the a local
+ version to satisfy future deps */
+
+ i = i->next;
+ trans->add = alpm_list_remove(trans->add, pkg,
+ _alpm_pkg_cmp, NULL);
+ localpkgs = alpm_list_diff(
+ _alpm_db_get_pkgcache(handle->db_local),
+ trans->add, _alpm_pkg_cmp);
+ } else {
+ /* [resolved] now additionally contains [pkg] and all of its
+ dependencies not already on the list */
+ i = i->next;
}
- /* Else, [resolved] now additionally contains [pkg] and all of its
- dependencies not already on the list */
}
alpm_list_free(localpkgs);
alpm_list_free(remove);
More information about the pacman-dev
mailing list