lib: fix preservation of install mode for updated dependencies

This commit is contained in:
Duncan Overbruck
2023-06-24 18:49:28 +02:00
parent 50fb2017d0
commit c1176447f3
3 changed files with 134 additions and 14 deletions
@@ -123,9 +123,118 @@ instmode_reinstall_body() {
atf_check_equal $out yes
}
atf_test_case instmode_dependency_update
instmode_dependency_update_head() {
atf_set "descr" "Installation mode: preserve on install with dependency update"
}
instmode_dependency_update_body() {
mkdir some_repo
mkdir -p pkg_A/usr/bin pkg_B/usr/bin
touch -f pkg_A/usr/bin/foo pkg_B/usr/bin/blah
cd some_repo
xbps-create -A noarch -n A-1.0_1 -s "foo pkg" ../pkg_A
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root -C null.conf --repository=$PWD/some_repo -yd A-1.0_1
atf_check_equal $? 0
cd some_repo
xbps-create -A noarch -n A-1.1_1 -s "foo pkg" ../pkg_A
atf_check_equal $? 0
xbps-create -A noarch -n B-1.1_1 -s "foo pkg" -D "A>=1.1_1" ../pkg_B
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root -C null.conf --repository=$PWD/some_repo -yd B
atf_check_equal $? 0
out="$(xbps-query -r root --property=automatic-install A)"
atf_check_equal $out ""
}
atf_test_case instmode_dependency_update_automatic
instmode_dependency_update_automatic_head() {
atf_set "descr" "Installation mode: preserve on install with dependency update marked automatic"
}
instmode_dependency_update_automatic_body() {
mkdir some_repo
mkdir -p pkg_A/usr/bin pkg_B/usr/bin
touch -f pkg_A/usr/bin/foo pkg_B/usr/bin/blah
cd some_repo
xbps-create -A noarch -n A-1.0_1 -s "foo pkg" ../pkg_A
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root -C null.conf --repository=$PWD/some_repo -Ayd A-1.0_1
atf_check_equal $? 0
cd some_repo
xbps-create -A noarch -n A-1.1_1 -s "foo pkg" ../pkg_A
atf_check_equal $? 0
xbps-create -A noarch -n B-1.1_1 -s "foo pkg" -D "A>=1.1_1" ../pkg_B
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root -C null.conf --repository=$PWD/some_repo -yd B
atf_check_equal $? 0
out="$(xbps-query -r root --property=automatic-install A)"
atf_check_equal $out "yes"
}
atf_test_case instmode_dependency_configure
instmode_dependency_configure_head() {
atf_set "descr" "Installation mode: preserve on install with dependency configure"
}
instmode_dependency_configure_body() {
mkdir some_repo
mkdir -p pkg_A/usr/bin pkg_B/usr/bin
touch -f pkg_A/usr/bin/foo pkg_B/usr/bin/blah
cd some_repo
xbps-create -A noarch -n A-1.0_1 -s "foo pkg" ../pkg_A
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root -C null.conf --repository=$PWD/some_repo -Uyd A-1.0_1
atf_check_equal $? 0
cd some_repo
xbps-create -A noarch -n B-1.1_1 -s "foo pkg" -D "A>=0" ../pkg_B
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root -C null.conf --repository=$PWD/some_repo -yd B
atf_check_equal $? 0
out="$(xbps-query -r root --property=automatic-install A)"
atf_check_equal $out ""
}
atf_init_test_cases() {
atf_add_test_case instmode
atf_add_test_case instmode_auto
atf_add_test_case instmode_update
atf_add_test_case instmode_reinstall
atf_add_test_case instmode_dependency_update
atf_add_test_case instmode_dependency_update_automatic
atf_add_test_case instmode_dependency_configure
}