summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/trans.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/trans.c')
-rw-r--r--lib/libalpm/trans.c16
1 files changed, 16 insertions, 0 deletions
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;