summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2013-12-11 17:58:28 +0100
committerAllan McRae <allan@archlinux.org>2013-12-19 06:19:52 +0100
commit2f8be5f8db1e157d3bcdac763b79c7989567ca6d (patch)
tree434e2718fe11193383c5cf737b033c718cf7f277 /lib/libalpm
parent714609639f9a316e037252d31437505520a7966f (diff)
downloadpacman-2f8be5f8db1e157d3bcdac763b79c7989567ca6d.tar.gz
pacman-2f8be5f8db1e157d3bcdac763b79c7989567ca6d.tar.xz
trans_prepare: always sort trans->remove by deps
Packages can be removed during a sync transaction either directly or due to conflicts and need to be sorted. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/remove.c7
-rw-r--r--lib/libalpm/sync.c5
-rw-r--r--lib/libalpm/trans.c16
3 files changed, 16 insertions, 12 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 9417a61e..6c50ab38 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -240,13 +240,6 @@ int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data)
}
}
- /* re-order w.r.t. dependencies */
- _alpm_log(handle, ALPM_LOG_DEBUG, "sorting by dependencies\n");
- lp = _alpm_sortbydeps(handle, trans->remove, NULL, 1);
- /* free the old alltargs */
- alpm_list_free(trans->remove);
- trans->remove = lp;
-
/* -Rcs == -Rc then -Rs */
if((trans->flags & ALPM_TRANS_FLAG_CASCADE)
&& (trans->flags & ALPM_TRANS_FLAG_RECURSE)) {
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index e358585e..dd4ac4b9 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -630,11 +630,6 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
}
goto cleanup;
}
-
- /* re-order w.r.t. dependencies */
- alpm_list_t *add_orig = trans->add;
- trans->add = _alpm_sortbydeps(handle, add_orig, trans->remove, 0);
- alpm_list_free(add_orig);
}
for(i = trans->add; i; i = i->next) {
/* update download size field */
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index a795a1fa..6ace823e 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -39,6 +39,7 @@
#include "remove.h"
#include "sync.h"
#include "alpm.h"
+#include "deps.h"
/** \addtogroup alpm_trans Transaction Functions
* @brief Functions to manipulate libalpm transactions
@@ -134,6 +135,21 @@ int SYMEXPORT alpm_trans_prepare(alpm_handle_t *handle, alpm_list_t **data)
}
}
+
+ if(!(trans->flags & ALPM_TRANS_FLAG_NODEPS)) {
+ _alpm_log(handle, ALPM_LOG_DEBUG, "sorting by dependencies\n");
+ if(trans->add) {
+ alpm_list_t *add_orig = trans->add;
+ trans->add = _alpm_sortbydeps(handle, add_orig, trans->remove, 0);
+ alpm_list_free(add_orig);
+ }
+ if(trans->remove) {
+ alpm_list_t *rem_orig = trans->remove;
+ trans->remove = _alpm_sortbydeps(handle, rem_orig, NULL, 1);
+ alpm_list_free(rem_orig);
+ }
+ }
+
trans->state = STATE_PREPARED;
return 0;