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:
Juan RP
2015-10-19 18:01:43 +02:00
parent 4e446968c5
commit b069eb14ae
3 changed files with 53 additions and 0 deletions

View File

@@ -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
}