conflicts: really fix the issue with on hold pkgs and update test case.
This commit is contained in:
parent
e9dbb7b2e9
commit
2202482e0e
@ -68,6 +68,11 @@ pkg_conflicts_trans(struct xbps_handle *xhp, xbps_array_t array,
|
|||||||
*/
|
*/
|
||||||
if ((pkgd = xbps_pkgdb_get_pkg(xhp, cfpkg)) ||
|
if ((pkgd = xbps_pkgdb_get_pkg(xhp, cfpkg)) ||
|
||||||
(pkgd = xbps_pkgdb_get_virtualpkg(xhp, cfpkg))) {
|
(pkgd = xbps_pkgdb_get_virtualpkg(xhp, cfpkg))) {
|
||||||
|
/* If the conflicting pkg is on hold, ignore it */
|
||||||
|
if (xbps_dictionary_get(pkgd, "hold"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Ignore itself */
|
||||||
xbps_dictionary_get_cstring_nocopy(pkgd,
|
xbps_dictionary_get_cstring_nocopy(pkgd,
|
||||||
"pkgver", &pkgver);
|
"pkgver", &pkgver);
|
||||||
pkgname = xbps_pkg_name(pkgver);
|
pkgname = xbps_pkg_name(pkgver);
|
||||||
@ -76,13 +81,6 @@ pkg_conflicts_trans(struct xbps_handle *xhp, xbps_array_t array,
|
|||||||
free(pkgname);
|
free(pkgname);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* If the conflicting pkg is on hold, ignore it.
|
|
||||||
*/
|
|
||||||
if (xbps_dictionary_get(pkgd, "hold")) {
|
|
||||||
free(pkgname);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* If there's a pkg for the conflict in transaction,
|
* If there's a pkg for the conflict in transaction,
|
||||||
* ignore it.
|
* ignore it.
|
||||||
@ -115,6 +113,13 @@ pkg_conflicts_trans(struct xbps_handle *xhp, xbps_array_t array,
|
|||||||
*/
|
*/
|
||||||
if ((pkgd = xbps_find_pkg_in_array(array, cfpkg, NULL)) ||
|
if ((pkgd = xbps_find_pkg_in_array(array, cfpkg, NULL)) ||
|
||||||
(pkgd = xbps_find_virtualpkg_in_array(xhp, array, cfpkg, NULL))) {
|
(pkgd = xbps_find_virtualpkg_in_array(xhp, array, cfpkg, NULL))) {
|
||||||
|
/* ignore pkgs to be removed or on hold */
|
||||||
|
if (xbps_dictionary_get_cstring_nocopy(pkgd,
|
||||||
|
"transaction", &tract)) {
|
||||||
|
if (!strcmp(tract, "remove") || !strcmp(tract, "hold"))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* ignore itself */
|
||||||
xbps_dictionary_get_cstring_nocopy(pkgd,
|
xbps_dictionary_get_cstring_nocopy(pkgd,
|
||||||
"pkgver", &pkgver);
|
"pkgver", &pkgver);
|
||||||
pkgname = xbps_pkg_name(pkgver);
|
pkgname = xbps_pkg_name(pkgver);
|
||||||
@ -124,12 +129,6 @@ pkg_conflicts_trans(struct xbps_handle *xhp, xbps_array_t array,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
free(pkgname);
|
free(pkgname);
|
||||||
/* ignore pkgs to be removed or on hold */
|
|
||||||
if (xbps_dictionary_get_cstring_nocopy(pkgd,
|
|
||||||
"transaction", &tract)) {
|
|
||||||
if (!strcmp(tract, "remove") || !strcmp(tract, "hold"))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
xbps_dbg_printf(xhp, "found conflicting pkgs in "
|
xbps_dbg_printf(xhp, "found conflicting pkgs in "
|
||||||
"transaction %s <-> %s (matched by %s [trans])\n",
|
"transaction %s <-> %s (matched by %s [trans])\n",
|
||||||
pkgver, repopkgver, cfpkg);
|
pkgver, repopkgver, cfpkg);
|
||||||
@ -155,7 +154,7 @@ pkgdb_conflicts_cb(struct xbps_handle *xhp, xbps_object_t obj,
|
|||||||
xbps_dictionary_t pkgd;
|
xbps_dictionary_t pkgd;
|
||||||
xbps_object_t obj2;
|
xbps_object_t obj2;
|
||||||
xbps_object_iterator_t iter;
|
xbps_object_iterator_t iter;
|
||||||
const char *cfpkg, *repopkgver, *pkgver;
|
const char *cfpkg, *repopkgver, *pkgver, *tract;
|
||||||
char *pkgname, *repopkgname, *buf;
|
char *pkgname, *repopkgname, *buf;
|
||||||
|
|
||||||
pkg_cflicts = xbps_dictionary_get(obj, "conflicts");
|
pkg_cflicts = xbps_dictionary_get(obj, "conflicts");
|
||||||
@ -182,6 +181,13 @@ pkgdb_conflicts_cb(struct xbps_handle *xhp, xbps_object_t obj,
|
|||||||
(pkgd = xbps_find_virtualpkg_in_array(xhp, pkgs, cfpkg, NULL))) {
|
(pkgd = xbps_find_virtualpkg_in_array(xhp, pkgs, cfpkg, NULL))) {
|
||||||
xbps_dictionary_get_cstring_nocopy(pkgd,
|
xbps_dictionary_get_cstring_nocopy(pkgd,
|
||||||
"pkgver", &pkgver);
|
"pkgver", &pkgver);
|
||||||
|
/* ignore pkgs to be removed or on hold */
|
||||||
|
if (xbps_dictionary_get_cstring_nocopy(pkgd,
|
||||||
|
"transaction", &tract)) {
|
||||||
|
if (!strcmp(tract, "remove") || !strcmp(tract, "hold"))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* ignore itself */
|
||||||
pkgname = xbps_pkg_name(pkgver);
|
pkgname = xbps_pkg_name(pkgver);
|
||||||
assert(pkgname);
|
assert(pkgname);
|
||||||
if (strcmp(pkgname, repopkgname) == 0) {
|
if (strcmp(pkgname, repopkgname) == 0) {
|
||||||
|
@ -35,9 +35,9 @@ conflicts_trans_hold_body() {
|
|||||||
mkdir some_repo
|
mkdir some_repo
|
||||||
mkdir -p pkg_{A,B}/usr/bin
|
mkdir -p pkg_{A,B}/usr/bin
|
||||||
cd some_repo
|
cd some_repo
|
||||||
xbps-create -A noarch -n A-1.0_1 -s "A pkg" --conflicts "B>=1.1_1" ../pkg_A
|
xbps-create -A noarch -n A-1.0_1 -s "A pkg" --conflicts "vpkg>19_1" ../pkg_A
|
||||||
atf_check_equal $? 0
|
atf_check_equal $? 0
|
||||||
xbps-create -A noarch -n B-1.0_1 -s "B pkg" ../pkg_B
|
xbps-create -A noarch -n B-1.0_1 -s "B pkg" --provides "vpkg-19_1" ../pkg_B
|
||||||
atf_check_equal $? 0
|
atf_check_equal $? 0
|
||||||
xbps-rindex -d -a $PWD/*.xbps
|
xbps-rindex -d -a $PWD/*.xbps
|
||||||
atf_check_equal $? 0
|
atf_check_equal $? 0
|
||||||
@ -47,17 +47,19 @@ conflicts_trans_hold_body() {
|
|||||||
atf_check_equal $? 0
|
atf_check_equal $? 0
|
||||||
|
|
||||||
cd some_repo
|
cd some_repo
|
||||||
xbps-create -A noarch -n A-1.1_1 -s "A pkg" --conflicts "B>=1.1_1" ../pkg_A
|
xbps-create -A noarch -n A-1.1_1 -s "A pkg" --conflicts "vpkg>19_1" ../pkg_B
|
||||||
atf_check_equal $? 0
|
atf_check_equal $? 0
|
||||||
xbps-create -A noarch -n B-1.1_1 -s "B pkg" ../pkg_B
|
xbps-create -A noarch -n B-1.1_1 -s "B pkg" --provides "vpkg-20_1" ../pkg_B
|
||||||
atf_check_equal $? 0
|
atf_check_equal $? 0
|
||||||
xbps-rindex -d -a $PWD/*.xbps
|
xbps-rindex -d -a $PWD/*.xbps
|
||||||
atf_check_equal $? 0
|
atf_check_equal $? 0
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
xbps-install -r root --repository=$PWD/some_repo -dyuv
|
echo "B updated to 1.1_1"
|
||||||
|
xbps-install -r root --repository=$PWD/some_repo -dyuv B
|
||||||
atf_check_equal $? 11
|
atf_check_equal $? 11
|
||||||
|
|
||||||
|
echo "B is now on hold"
|
||||||
xbps-pkgdb -r root -m hold B
|
xbps-pkgdb -r root -m hold B
|
||||||
xbps-install -r root --repository=$PWD/some_repo -dyuv
|
xbps-install -r root --repository=$PWD/some_repo -dyuv
|
||||||
atf_check_equal $? 0
|
atf_check_equal $? 0
|
||||||
|
Loading…
Reference in New Issue
Block a user