conflicts: another bugfix + test case.
This commit is contained in:
parent
da5ad3d052
commit
0cf4a2c0c0
3
NEWS
3
NEWS
@ -1,5 +1,8 @@
|
|||||||
xbps-0.50 (???):
|
xbps-0.50 (???):
|
||||||
|
|
||||||
|
* libxbps: another bugfix for conflicts; do not take into account conflicts
|
||||||
|
in installed pkgs when the same pkg is in the transaction.
|
||||||
|
|
||||||
* xbps-alternatives(1): symlinks are now always created relative to the
|
* xbps-alternatives(1): symlinks are now always created relative to the
|
||||||
rootdir of the target file. Implemented by Enno Boland (@Gottox).
|
rootdir of the target file. Implemented by Enno Boland (@Gottox).
|
||||||
|
|
||||||
|
@ -77,29 +77,26 @@ pkg_conflicts_trans(struct xbps_handle *xhp, xbps_array_t array,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* If there's an update for the conflicting pkg in
|
* If there's a pkg for the conflict in transaction,
|
||||||
* the transaction and does not match the pattern,
|
|
||||||
* ignore it.
|
* ignore it.
|
||||||
*/
|
*/
|
||||||
if ((tpkgd = xbps_find_pkg_in_array(array, pkgname, NULL))) {
|
if ((tpkgd = xbps_find_pkg_in_array(array, pkgname, NULL))) {
|
||||||
const char *tract, *p;
|
const char *tract;
|
||||||
|
|
||||||
xbps_dictionary_get_cstring_nocopy(tpkgd,
|
xbps_dictionary_get_cstring_nocopy(tpkgd,
|
||||||
"transaction", &tract);
|
"transaction", &tract);
|
||||||
xbps_dictionary_get_cstring_nocopy(tpkgd,
|
if (strcmp(tract, "remove")) {
|
||||||
"pkgver", &p);
|
|
||||||
if ((xbps_pkgpattern_match(p, cfpkg) == 0) &&
|
|
||||||
(strcmp(tract, "update") == 0)) {
|
|
||||||
free(pkgname);
|
free(pkgname);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(pkgname);
|
free(pkgname);
|
||||||
xbps_dbg_printf(xhp, "found conflicting installed "
|
xbps_dbg_printf(xhp, "found conflicting installed "
|
||||||
"pkg %s with pkg in transaction %s\n", pkgver,
|
"pkg %s with pkg in transaction %s "
|
||||||
repopkgver);
|
"(matched by %s)\n", pkgver, repopkgver, cfpkg);
|
||||||
buf = xbps_xasprintf("CONFLICT: %s with "
|
buf = xbps_xasprintf("CONFLICT: %s with "
|
||||||
"installed pkg %s", repopkgver, pkgver);
|
"installed pkg %s (matched by %s)",
|
||||||
|
repopkgver, pkgver, cfpkg);
|
||||||
if (!xbps_match_string_in_array(trans_cflicts, buf))
|
if (!xbps_match_string_in_array(trans_cflicts, buf))
|
||||||
xbps_array_add_cstring(trans_cflicts, buf);
|
xbps_array_add_cstring(trans_cflicts, buf);
|
||||||
|
|
||||||
@ -121,9 +118,11 @@ pkg_conflicts_trans(struct xbps_handle *xhp, xbps_array_t array,
|
|||||||
}
|
}
|
||||||
free(pkgname);
|
free(pkgname);
|
||||||
xbps_dbg_printf(xhp, "found conflicting pkgs in "
|
xbps_dbg_printf(xhp, "found conflicting pkgs in "
|
||||||
"transaction %s <-> %s\n", pkgver, repopkgver);
|
"transaction %s <-> %s (matched by %s)\n",
|
||||||
|
pkgver, repopkgver, cfpkg);
|
||||||
buf = xbps_xasprintf("CONFLICT: %s with "
|
buf = xbps_xasprintf("CONFLICT: %s with "
|
||||||
"%s in transaction", repopkgver, pkgver);
|
"%s in transaction (mached by %s)",
|
||||||
|
repopkgver, pkgver);
|
||||||
if (!xbps_match_string_in_array(trans_cflicts, buf))
|
if (!xbps_match_string_in_array(trans_cflicts, buf))
|
||||||
xbps_array_add_cstring(trans_cflicts, buf);
|
xbps_array_add_cstring(trans_cflicts, buf);
|
||||||
|
|
||||||
@ -155,6 +154,12 @@ pkgdb_conflicts_cb(struct xbps_handle *xhp, xbps_object_t obj,
|
|||||||
repopkgname = xbps_pkg_name(repopkgver);
|
repopkgname = xbps_pkg_name(repopkgver);
|
||||||
assert(repopkgname);
|
assert(repopkgname);
|
||||||
|
|
||||||
|
/* if a pkg is in the transaction, ignore the one from pkgdb */
|
||||||
|
if (xbps_find_pkg_in_array(pkgs, repopkgname, NULL)) {
|
||||||
|
free(repopkgname);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
iter = xbps_array_iterator(pkg_cflicts);
|
iter = xbps_array_iterator(pkg_cflicts);
|
||||||
assert(iter);
|
assert(iter);
|
||||||
|
|
||||||
@ -172,9 +177,11 @@ pkgdb_conflicts_cb(struct xbps_handle *xhp, xbps_object_t obj,
|
|||||||
}
|
}
|
||||||
free(pkgname);
|
free(pkgname);
|
||||||
xbps_dbg_printf(xhp, "found conflicting pkgs in "
|
xbps_dbg_printf(xhp, "found conflicting pkgs in "
|
||||||
"transaction %s <-> %s\n", pkgver, repopkgver);
|
"transaction %s <-> %s (matched by %s)\n",
|
||||||
|
pkgver, repopkgver, cfpkg);
|
||||||
buf = xbps_xasprintf("CONFLICT: %s with "
|
buf = xbps_xasprintf("CONFLICT: %s with "
|
||||||
"%s in transaction", repopkgver, pkgver);
|
"%s in transaction (matched by %s)",
|
||||||
|
repopkgver, pkgver, cfpkg);
|
||||||
if (!xbps_match_string_in_array(trans_cflicts, buf))
|
if (!xbps_match_string_in_array(trans_cflicts, buf))
|
||||||
xbps_array_add_cstring(trans_cflicts, buf);
|
xbps_array_add_cstring(trans_cflicts, buf);
|
||||||
|
|
||||||
|
@ -166,6 +166,51 @@ conflicts_trans_installed_body() {
|
|||||||
atf_check_equal $(xbps-query -r root -l|wc -l) 1
|
atf_check_equal $(xbps-query -r root -l|wc -l) 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
atf_test_case conflicts_trans_update
|
||||||
|
|
||||||
|
conflicts_trans_update_head() {
|
||||||
|
atf_set "descr" "Tests for pkg conflicts: no conflicts with updated pkgs in transaction"
|
||||||
|
}
|
||||||
|
|
||||||
|
conflicts_trans_update_body() {
|
||||||
|
mkdir repo repo2
|
||||||
|
mkdir -p pkg_{A,B}/usr/bin
|
||||||
|
|
||||||
|
cd repo
|
||||||
|
xbps-create -A noarch -n A-1.0_1 -s "A pkg" --provides "xserver-abi-video-19_1" ../pkg_A
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-create -A noarch -n B-1.0_1 -s "B pkg" --conflicts "xserver-abi-video<19" ../pkg_B
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-rindex -d -a $PWD/*.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
xbps-install -r root --repository=$PWD/repo -dy A B
|
||||||
|
atf_check_equal $? 0
|
||||||
|
|
||||||
|
cd repo2
|
||||||
|
xbps-create -A noarch -n A-1.1_1 -s "A pkg" --provides "xserver-abi-video-20_1" ../pkg_A
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-create -A noarch -n B-1.1_1 -s "B pkg" --conflicts "xserver-abi-video<20" ../pkg_B
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-rindex -d -a $PWD/*.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
xbps-install -r root --repository=$PWD/repo2 -dyuv
|
||||||
|
atf_check_equal $? 0
|
||||||
|
atf_check_equal $(xbps-query -r root -p pkgver A) A-1.1_1
|
||||||
|
atf_check_equal $(xbps-query -r root -p pkgver B) B-1.1_1
|
||||||
|
|
||||||
|
xbps-install -r root --repository=$PWD/repo -dyvf A B
|
||||||
|
atf_check_equal $? 0
|
||||||
|
atf_check_equal $(xbps-query -r root -p pkgver A) A-1.0_1
|
||||||
|
atf_check_equal $(xbps-query -r root -p pkgver B) B-1.0_1
|
||||||
|
|
||||||
|
xbps-install -r root --repository=$PWD/repo2 -dyvf B-1.1_1
|
||||||
|
atf_check_equal $? 11
|
||||||
|
}
|
||||||
|
|
||||||
atf_test_case conflicts_trans_installed_multi
|
atf_test_case conflicts_trans_installed_multi
|
||||||
|
|
||||||
conflicts_trans_installed_multi_head() {
|
conflicts_trans_installed_multi_head() {
|
||||||
@ -203,4 +248,5 @@ atf_init_test_cases() {
|
|||||||
atf_add_test_case conflicts_trans_installed_multi
|
atf_add_test_case conflicts_trans_installed_multi
|
||||||
atf_add_test_case conflicts_installed
|
atf_add_test_case conflicts_installed
|
||||||
atf_add_test_case conflicts_installed_multi
|
atf_add_test_case conflicts_installed_multi
|
||||||
|
atf_add_test_case conflicts_trans_update
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user