libxbps: extend the fix for #116 even more for the expected case.

This now catches both test cases correctly.
This commit is contained in:
Juan RP 2015-10-19 18:19:24 +02:00
parent b069eb14ae
commit 103caf0694
2 changed files with 38 additions and 2 deletions

View File

@ -96,7 +96,8 @@ xbps_transaction_package_replace(struct xbps_handle *xhp, xbps_array_t pkgs)
"transaction", &tract);
if (strcmp(tract, "remove") == 0)
continue;
if (xbps_pkgpattern_match(rpkgver, pattern) == 0)
if (!xbps_match_virtual_pkg_in_dict(reppkgd, pattern) &&
!xbps_pkgpattern_match(rpkgver, pattern))
continue;
/*
* Package contains replaces="pkgpattern", but the

View File

@ -209,7 +209,7 @@ replace_pkg_files_unmodified_body() {
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)"
atf_set "descr" "Tests for package replace: replace a pkg that needs to be updated with a vpkg"
}
replace_pkg_with_update_body() {
@ -240,6 +240,40 @@ replace_pkg_with_update_body() {
atf_check_equal $(xbps-query -C xbps.d -r root -p state B) installed
}
atf_test_case replace_vpkg_with_update
replace_vpkg_with_update_head() {
atf_set "descr" "Tests for package replace: replace a vpkg that needs to be updated with a vpkg (#116)"
}
replace_vpkg_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" --replaces "awk>=0" --provides="awk-0_1" ../pkg_A
atf_check_equal $? 0
xbps-create -A noarch -n B-1.0_1 -s "B pkg" --replaces "awk>=0" --provides="awk-0_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" --replaces "awk>=0" --provides "awk-0_1" ../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
@ -247,5 +281,6 @@ atf_init_test_cases() {
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 replace_vpkg_with_update
atf_add_test_case self_replace
}