@@ -170,6 +170,36 @@ clean_cache_uninstalled_body() {
170170 atf_check_equal $? 0
171171}
172172
173+ clean_cache_installed_head () {
174+ atf_set " descr" " xbps-remove(1): do not clean currently installed packages"
175+ }
176+
177+ clean_cache_installed_body () {
178+ mkdir -p repo pkg_A/B/C pkg_B
179+ mkdir -p root/etc/xbps.d root/var/db/xbps/https___localhost_ root/var/cache/xbps
180+
181+ cd repo
182+ atf_check -o ignore -- xbps-create -A noarch -n A-1.0_1 -s " A pkg" ../pkg_A
183+ atf_check -o ignore -- xbps-rindex -a $PWD /* .xbps
184+ cd ..
185+ atf_check -- cp repo/* -repodata root/var/db/xbps/https___localhost_
186+ atf_check -- cp repo/* .xbps root/var/cache/xbps
187+
188+ echo " repository=https://localhost/" > root/etc/xbps.d/localrepo.conf
189+ atf_check -o ignore -e ignore -- xbps-install -r root -C etc/xbps.d -R repo -dvy A
190+
191+ cd repo
192+ atf_check -o ignore -- xbps-create -A noarch -n A-1.0_2 -s " A pkg" ../pkg_A
193+ atf_check -o ignore -e ignore -- xbps-rindex -a $PWD /* .xbps
194+ cd ..
195+ atf_check -- cp repo/* -repodata root/var/db/xbps/https___localhost_
196+ atf_check -- cp repo/* .xbps root/var/cache/xbps
197+
198+ atf_check -- xbps-remove -r root -C etc/xbps.d -O
199+ atf_check -- test -f root/var/cache/xbps/A-1.0_2.noarch.xbps
200+ atf_check -- test -f root/var/cache/xbps/A-1.0_1.noarch.xbps
201+ }
202+
173203atf_test_case remove_msg
174204
175205remove_msg_head () {
@@ -205,5 +235,6 @@ atf_init_test_cases() {
205235 atf_add_test_case clean_cache_dry_run
206236 atf_add_test_case clean_cache_dry_run_perm
207237 atf_add_test_case clean_cache_uninstalled
238+ atf_add_test_case clean_cache_installed
208239 atf_add_test_case remove_msg
209240}
0 commit comments