lib/package_alternatives.c: remove previous symlinks

This commit is contained in:
Duncaen
2016-09-04 17:20:44 +02:00
parent 2aa538bf35
commit dd7a0d073b
2 changed files with 46 additions and 2 deletions

View File

@@ -429,6 +429,35 @@ update_pkgs_body() {
atf_check_equal $rv 0
}
atf_test_case less_entries
less_entries_pkgs_head() {
atf_set "descr" "xbps-alternatives: remove symlinks not provided by the new alternative"
}
less_entries_body() {
mkdir -p repo pkg_A/usr/bin pkg_B/usr/bin
touch pkg_A/usr/bin/A1 pkg_A/usr/bin/A2 pkg_B/usr/bin/B1
cd repo
xbps-create -A noarch -n A-1.1_1 -s "A pkg" --alternatives "1:1:/usr/bin/A1 1:2:/usr/bin/A2" ../pkg_A
atf_check_equal $? 0
xbps-create -A noarch -n B-1.1_1 -s "B pkg" --alternatives "1:1:/usr/bin/B1" ../pkg_B
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root --repository=repo -ydv A B
atf_check_equal $? 0
xbps-alternatives -r root -s B
atf_check_equal $? 0
rv=1
[ -e root/usr/bin/2 ] || rv=0
atf_check_equal $rv 0
}
atf_init_test_cases() {
atf_add_test_case register_one
atf_add_test_case register_one_dangling
@@ -441,4 +470,5 @@ atf_init_test_cases() {
atf_add_test_case set_pkg
atf_add_test_case set_pkg_group
atf_add_test_case update_pkgs
atf_add_test_case less_entries
}