Fix #53 (xbps-install with multiple arguments shouldn't fail if one is already installed).

This commit is contained in:
Juan RP 2014-08-23 08:02:40 +02:00
parent 7cef93ce07
commit 4c14785480
6 changed files with 50 additions and 2 deletions

View File

@ -238,7 +238,9 @@ main(int argc, char **argv)
/* Install target packages */ /* Install target packages */
for (i = optind; i < argc; i++) { for (i = optind; i < argc; i++) {
rv = install_new_pkg(&xh, argv[i], reinstall); rv = install_new_pkg(&xh, argv[i], reinstall);
if (rv != 0) { if (optind >= 2 && rv == EEXIST) {
rv = 0;
} else if (rv != 0) {
xbps_pkgdb_unlock(&xh); xbps_pkgdb_unlock(&xh);
exit(rv); exit(rv);
} }

View File

@ -1,5 +1,5 @@
-include ../../config.mk -include ../../config.mk
SUBDIRS = common libxbps xbps-query xbps-rindex SUBDIRS = common libxbps xbps-install xbps-query xbps-rindex
include ../../mk/subdir.mk include ../../mk/subdir.mk

View File

@ -3,5 +3,6 @@ syntax("kyuafile", 1)
test_suite("xbps") test_suite("xbps")
include('libxbps/Kyuafile') include('libxbps/Kyuafile')
include('xbps-install/Kyuafile')
include('xbps-query/Kyuafile') include('xbps-query/Kyuafile')
include('xbps-rindex/Kyuafile') include('xbps-rindex/Kyuafile')

View File

@ -0,0 +1,4 @@
syntax("kyuafile", 1)
test_suite("xbps-install")
atf_test_program{name="behaviour_tests"}

View File

@ -0,0 +1,8 @@
TOPDIR = ../../..
-include $(TOPDIR)/config.mk
TESTSHELL = behaviour_tests
TESTSSUBDIR = xbps/xbps-install
EXTRA_FILES = Kyuafile
include $(TOPDIR)/mk/test.mk

View File

@ -0,0 +1,33 @@
#! /usr/bin/env atf-sh
atf_test_case install_existent
install_existent_head() {
atf_set "descr" "xbps-install(8): install multiple existent pkgs (issue #53)"
}
install_existent_body() {
mkdir -p some_repo pkg_A pkg_B
touch pkg_A/file00
touch pkg_B/file00
cd some_repo
xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A
atf_check_equal $? 0
xbps-rindex -a *.xbps
atf_check_equal $? 0
xbps-create -A noarch -n B-1.1_1 -s "B pkg" ../pkg_B
atf_check_equal $? 0
xbps-rindex -a *.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root -C empty.conf --repository=$PWD/some_repo -y A
atf_check_equal $? 0
xbps-install -r root -C empty.conf --repository=$PWD/some_repo -yn A B
atf_check_equal $? 0
xbps-install -r root -C empty.conf --repository=$PWD/some_repo -yn B A
atf_check_equal $? 0
}
atf_init_test_cases() {
atf_add_test_case install_existent
}