libxbps: fixed issue #116 (vpkg does not replace pkg with update in trans).
Thanks to @dominikh for the test case.
This commit is contained in:
parent
4e446968c5
commit
b069eb14ae
4
NEWS
4
NEWS
@ -1,5 +1,9 @@
|
||||
xbps-0.48 (???):
|
||||
|
||||
* libxbps: fixed another issue when replacing an existing pkg with a virtual
|
||||
pkg, and there's an update for the original pkg in the transaction.
|
||||
Fixes #116 (https://github.com/voidlinux/xbps/issues/116).
|
||||
|
||||
* libxbps: the rpool functions now set errno to ENOENT when the target
|
||||
pkg cannot be found in registered repos.
|
||||
|
||||
|
@ -88,10 +88,16 @@ xbps_transaction_package_replace(struct xbps_handle *xhp, xbps_array_t pkgs)
|
||||
xbps_dictionary_get_bool(instd, "automatic-install", &instd_auto);
|
||||
reppkgd = xbps_find_pkg_in_array(pkgs, curpkgname, NULL);
|
||||
if (reppkgd) {
|
||||
const char *rpkgver;
|
||||
|
||||
xbps_dictionary_get_cstring_nocopy(reppkgd,
|
||||
"pkgver", &rpkgver);
|
||||
xbps_dictionary_get_cstring_nocopy(reppkgd,
|
||||
"transaction", &tract);
|
||||
if (strcmp(tract, "remove") == 0)
|
||||
continue;
|
||||
if (xbps_pkgpattern_match(rpkgver, pattern) == 0)
|
||||
continue;
|
||||
/*
|
||||
* Package contains replaces="pkgpattern", but the
|
||||
* package that should be replaced is also in the
|
||||
@ -99,8 +105,16 @@ xbps_transaction_package_replace(struct xbps_handle *xhp, xbps_array_t pkgs)
|
||||
*/
|
||||
xbps_dictionary_set_bool(reppkgd,
|
||||
"automatic-install", instd_auto);
|
||||
xbps_dictionary_set_cstring_nocopy(reppkgd,
|
||||
"transaction", "remove");
|
||||
xbps_dictionary_set_bool(reppkgd,
|
||||
"replaced", true);
|
||||
xbps_array_replace_dict_by_name(pkgs,
|
||||
reppkgd, curpkgname);
|
||||
xbps_dbg_printf(xhp,
|
||||
"Package `%s' in transaction will be "
|
||||
"replaced by `%s', matched with `%s'\n",
|
||||
curpkgver, pkgver, pattern);
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
|
@ -206,11 +206,46 @@ replace_pkg_files_unmodified_body() {
|
||||
atf_check_equal $result 123456789
|
||||
}
|
||||
|
||||
atf_test_case replace_pkg_with_update
|
||||
|
||||
replace_pkg_with_update_head() {
|
||||
atf_set "descr" "Tests for package replace: replace a pkg that needs to be updated with a vpkg (#116)"
|
||||
}
|
||||
|
||||
replace_pkg_with_update_body() {
|
||||
mkdir some_repo root
|
||||
mkdir -p pkg_A/usr/bin pkg_B/usr/bin
|
||||
echo "A-1.0_1" > pkg_A/usr/bin/foo
|
||||
echo "B-1.0_1" > pkg_B/usr/bin/foo
|
||||
cd some_repo
|
||||
xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A
|
||||
atf_check_equal $? 0
|
||||
xbps-create -A noarch -n B-1.0_1 -s "B pkg" --replaces "A>=0" --provides="A-1.1_1" ../pkg_B
|
||||
atf_check_equal $? 0
|
||||
xbps-rindex -d -a $PWD/*.xbps
|
||||
atf_check_equal $? 0
|
||||
cd ..
|
||||
xbps-install -C xbps.d -r root --repository=$PWD/some_repo -yd A
|
||||
atf_check_equal $? 0
|
||||
cd some_repo
|
||||
xbps-create -A noarch -n A-1.1_1 -s "A pkg" ../pkg_A
|
||||
atf_check_equal $? 0
|
||||
xbps-rindex -d -a $PWD/*.xbps
|
||||
atf_check_equal $? 0
|
||||
cd ..
|
||||
xbps-install -C xbps.d -r root --repository=$PWD/some_repo -yfd A B
|
||||
atf_check_equal $? 0
|
||||
result=$(xbps-query -C xbps.d -r root -l|wc -l)
|
||||
atf_check_equal $result 1
|
||||
atf_check_equal $(xbps-query -C xbps.d -r root -p state B) installed
|
||||
}
|
||||
|
||||
atf_init_test_cases() {
|
||||
atf_add_test_case replace_dups
|
||||
atf_add_test_case replace_ntimes
|
||||
atf_add_test_case replace_vpkg
|
||||
atf_add_test_case replace_pkg_files
|
||||
atf_add_test_case replace_pkg_files_unmodified
|
||||
atf_add_test_case replace_pkg_with_update
|
||||
atf_add_test_case self_replace
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user