Respect installation mode also on reinstall (and downgrade).

This commit is contained in:
Juan RP
2014-01-15 16:17:41 +01:00
parent 292be5c420
commit 98a3723902
5 changed files with 83 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ atf_test_program{name="issue20_test"}
atf_test_program{name="conf_files_test"}
atf_test_program{name="remove_test"}
atf_test_program{name="replace_test"}
atf_test_program{name="installmode_test"}
include('find_pkg_orphans/Kyuafile')
include('pkgdb/Kyuafile')

View File

@@ -2,7 +2,7 @@ TOPDIR = ../../../..
-include $(TOPDIR)/config.mk
TESTSHELL = conf_files_test issue6_test issue18_test issue20_test remove_test
TESTSHELL+= replace_test
TESTSHELL+= replace_test installmode_test
include ../Makefile.inc
include $(TOPDIR)/mk/test.mk

View File

@@ -0,0 +1,67 @@
#! /usr/bin/env atf-sh
# 1- preserve installation mode on updates
atf_test_case instmode_update
instmode_update_head() {
atf_set "descr" "Installation mode: preserve on update"
}
instmode_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 -a *.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root -C null.conf --repository=$PWD/some_repo -A -y A-1.0_1
atf_check_equal $? 0
cd some_repo
xbps-create -A noarch -n A-1.1_1 -s "foo pkg" ../pkg_B
atf_check_equal $? 0
xbps-rindex -a *.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root -C null.conf --repository=$PWD/some_repo -yu
atf_check_equal $? 0
out=$(xbps-query -r root --property=automatic-install A)
atf_check_equal $out yes
}
# 2- preserve installation mode on reinstall
atf_test_case instmode_reinstall
instmode_reinstall_head() {
atf_set "descr" "Installation mode: preserve on reinstall"
}
instmode_reinstall_body() {
mkdir some_repo
mkdir -p pkg_A/usr/bin
touch -f pkg_A/usr/bin/foo
cd some_repo
xbps-create -A noarch -n A-1.0_1 -s "foo pkg" ../pkg_A
atf_check_equal $? 0
xbps-rindex -a *.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root -C null.conf --repository=$PWD/some_repo -A -y A-1.0_1
atf_check_equal $? 0
xbps-install -r root -C null.conf --repository=$PWD/some_repo -yf A-1.0_1
atf_check_equal $? 0
out=$(xbps-query -r root --property=automatic-install A)
atf_check_equal $out yes
}
atf_init_test_cases() {
atf_add_test_case instmode_update
atf_add_test_case instmode_reinstall
}