sortbydeps: skip local packages being updated

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Andrew Gregory 2015-09-15 01:08:16 -04:00 committed by Allan McRae
parent 486643083c
commit 75fe6ef104
3 changed files with 41 additions and 3 deletions

View File

@ -105,7 +105,13 @@ static alpm_list_t *dep_graph_init(alpm_handle_t *handle,
alpm_list_t *i, *j;
alpm_list_t *vertices = NULL;
alpm_list_t *localpkgs = alpm_list_diff(
alpm_db_get_pkgcache(handle->db_local), ignore, _alpm_pkg_cmp);
alpm_db_get_pkgcache(handle->db_local), targets, _alpm_pkg_cmp);
if(ignore) {
alpm_list_t *oldlocal = localpkgs;
localpkgs = alpm_list_diff(oldlocal, ignore, _alpm_pkg_cmp);
alpm_list_free(oldlocal);
}
/* We create the vertices */
for(i = targets; i; i = i->next) {
@ -137,8 +143,7 @@ static alpm_list_t *dep_graph_init(alpm_handle_t *handle,
alpm_graph_t *vertex_j = _alpm_graph_new();
vertex_j->data = (void *)j->data;
vertices = alpm_list_add(vertices, vertex_j);
vertex_i->children =
alpm_list_add(vertex_i->children, vertex_j);
vertex_i->children = alpm_list_add(vertex_i->children, vertex_j);
localpkgs = alpm_list_remove_item(localpkgs, j);
free(j);
}

View File

@ -14,6 +14,7 @@ TESTS += test/pacman/tests/depconflict100.py
TESTS += test/pacman/tests/depconflict110.py
TESTS += test/pacman/tests/depconflict111.py
TESTS += test/pacman/tests/depconflict120.py
TESTS += test/pacman/tests/dependency-cycle-fixed-by-upgrade.py
TESTS += test/pacman/tests/deptest001.py
TESTS += test/pacman/tests/dummy001.py
TESTS += test/pacman/tests/epoch001.py

View File

@ -0,0 +1,32 @@
self.description = "Circular dependency fixed by removed dependency"
lp1 = pmpkg("pkg1", "1-1")
lp1.depends = ["pkg2"]
lp2 = pmpkg("pkg2", "1-1")
lp2.depends = ["pkg3"]
lp3 = pmpkg("pkg3", "1-1")
lp3.depends = ["pkg1"]
for p in lp1, lp2, lp3:
self.addpkg2db("local", p);
sp1 = pmpkg("pkg1", "1-2")
sp1.depends = ["pkg2"]
sp2 = pmpkg("pkg2", "1-2")
sp3 = pmpkg("pkg3", "1-2")
sp3.depends = ["pkg1"]
for p in sp1, sp2, sp3:
self.addpkg2db("sync", p);
self.args = "-S %s %s %s" % (sp1.name, sp2.name, sp3.name)
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_VERSION=pkg1|1-2")
self.addrule("PKG_VERSION=pkg2|1-2")
self.addrule("PKG_VERSION=pkg3|1-2")
self.addrule("!PACMAN_OUTPUT=dependency cycle detected")