summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libalpm/remove.c7
-rw-r--r--lib/libalpm/sync.c5
-rw-r--r--lib/libalpm/trans.c16
-rw-r--r--test/pacman/tests/TESTS1
-rw-r--r--test/pacman/tests/sync046.py29
5 files changed, 46 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;
diff --git a/test/pacman/tests/TESTS b/test/pacman/tests/TESTS
index fc6a7e8b..f52a1f74 100644
--- a/test/pacman/tests/TESTS
+++ b/test/pacman/tests/TESTS
@@ -158,6 +158,7 @@ TESTS += test/pacman/tests/sync042.py
TESTS += test/pacman/tests/sync043.py
TESTS += test/pacman/tests/sync044.py
TESTS += test/pacman/tests/sync045.py
+TESTS += test/pacman/tests/sync046.py
TESTS += test/pacman/tests/sync050.py
TESTS += test/pacman/tests/sync051.py
TESTS += test/pacman/tests/sync052.py
diff --git a/test/pacman/tests/sync046.py b/test/pacman/tests/sync046.py
new file mode 100644
index 00000000..63e8cc36
--- /dev/null
+++ b/test/pacman/tests/sync046.py
@@ -0,0 +1,29 @@
+self.description = "Install a sync package with interdependent conflicts"
+
+sp = pmpkg("pkg1")
+sp.conflicts = ["pkg2", "pkg3", "pkg4"]
+self.addpkg2db("sync", sp);
+
+lp1 = pmpkg("pkg2")
+lp1.depends = ["pkg3"]
+lp1.install['pre_remove'] = "[ -f pkg3file ] && echo '' > pkg2ok"
+self.addpkg2db("local", lp1);
+
+lp2 = pmpkg("pkg3")
+lp2.files = ["pkg3file"]
+self.addpkg2db("local", lp2);
+
+lp3 = pmpkg("pkg4")
+lp3.depends = ["pkg3"]
+lp3.install['pre_remove'] = "[ -f pkg3file ] && echo '' > pkg4ok"
+self.addpkg2db("local", lp3);
+
+self.args = "-S %s --ask=4" % sp.name
+
+self.addrule("PACMAN_RETCODE=0")
+self.addrule("PKG_EXIST=pkg1")
+self.addrule("!PKG_EXIST=pkg2")
+self.addrule("!PKG_EXIST=pkg3")
+self.addrule("!PKG_EXIST=pkg4")
+self.addrule("FILE_EXIST=pkg2ok")
+self.addrule("FILE_EXIST=pkg4ok")