Respect installation mode also on reinstall (and downgrade).
This commit is contained in:
parent
292be5c420
commit
98a3723902
3
NEWS
3
NEWS
@ -1,5 +1,8 @@
|
|||||||
xbps-0.30 (??):
|
xbps-0.30 (??):
|
||||||
|
|
||||||
|
* When reinstalling a package (or downgrading) make sure to also respect
|
||||||
|
its installation mode (automatic or manual).
|
||||||
|
|
||||||
* Fixed a bug where in some cases valid symlinks in a package were not removed
|
* Fixed a bug where in some cases valid symlinks in a package were not removed
|
||||||
(just dangling symlinks were removed).
|
(just dangling symlinks were removed).
|
||||||
|
|
||||||
|
@ -70,6 +70,10 @@ trans_find_pkg(struct xbps_handle *xhp, const char *pkg, int action)
|
|||||||
|
|
||||||
assert(pkg != NULL);
|
assert(pkg != NULL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Find out if pkg is installed first.
|
||||||
|
*/
|
||||||
|
pkg_pkgdb = xbps_pkgdb_get_pkg(xhp, pkg);
|
||||||
/*
|
/*
|
||||||
* Find out if the pkg has been found in repository pool.
|
* Find out if the pkg has been found in repository pool.
|
||||||
*/
|
*/
|
||||||
@ -81,7 +85,7 @@ trans_find_pkg(struct xbps_handle *xhp, const char *pkg, int action)
|
|||||||
return ENOENT;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((pkg_pkgdb = xbps_pkgdb_get_pkg(xhp, pkg)) == NULL)
|
if (pkg_pkgdb == NULL)
|
||||||
return ENODEV;
|
return ENODEV;
|
||||||
|
|
||||||
reason = "update";
|
reason = "update";
|
||||||
@ -105,7 +109,12 @@ trans_find_pkg(struct xbps_handle *xhp, const char *pkg, int action)
|
|||||||
repopkgver, instpkgver, repoloc);
|
repopkgver, instpkgver, repoloc);
|
||||||
return EEXIST;
|
return EEXIST;
|
||||||
}
|
}
|
||||||
/* respect current install mode from pkgdb */
|
}
|
||||||
|
if (pkg_pkgdb) {
|
||||||
|
/*
|
||||||
|
* If pkg is already installed, respect its automatic-install
|
||||||
|
* property.
|
||||||
|
*/
|
||||||
xbps_dictionary_get_bool(pkg_pkgdb, "automatic-install",
|
xbps_dictionary_get_bool(pkg_pkgdb, "automatic-install",
|
||||||
&autoinst);
|
&autoinst);
|
||||||
xbps_dictionary_set_bool(pkg_repod, "automatic-install",
|
xbps_dictionary_set_bool(pkg_repod, "automatic-install",
|
||||||
|
@ -14,6 +14,7 @@ atf_test_program{name="issue20_test"}
|
|||||||
atf_test_program{name="conf_files_test"}
|
atf_test_program{name="conf_files_test"}
|
||||||
atf_test_program{name="remove_test"}
|
atf_test_program{name="remove_test"}
|
||||||
atf_test_program{name="replace_test"}
|
atf_test_program{name="replace_test"}
|
||||||
|
atf_test_program{name="installmode_test"}
|
||||||
|
|
||||||
include('find_pkg_orphans/Kyuafile')
|
include('find_pkg_orphans/Kyuafile')
|
||||||
include('pkgdb/Kyuafile')
|
include('pkgdb/Kyuafile')
|
||||||
|
@ -2,7 +2,7 @@ TOPDIR = ../../../..
|
|||||||
-include $(TOPDIR)/config.mk
|
-include $(TOPDIR)/config.mk
|
||||||
|
|
||||||
TESTSHELL = conf_files_test issue6_test issue18_test issue20_test remove_test
|
TESTSHELL = conf_files_test issue6_test issue18_test issue20_test remove_test
|
||||||
TESTSHELL+= replace_test
|
TESTSHELL+= replace_test installmode_test
|
||||||
|
|
||||||
include ../Makefile.inc
|
include ../Makefile.inc
|
||||||
include $(TOPDIR)/mk/test.mk
|
include $(TOPDIR)/mk/test.mk
|
||||||
|
67
tests/xbps/libxbps/shell/installmode_test.sh
Normal file
67
tests/xbps/libxbps/shell/installmode_test.sh
Normal 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
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user