xbps-install(1): do not exit if pkg is up-to-date in dry-run mode.

Close #145
This commit is contained in:
Juan RP 2016-02-05 11:27:40 +01:00
parent 0fa676f50c
commit b759ca4b07
3 changed files with 36 additions and 1 deletions

4
NEWS
View File

@ -1,5 +1,9 @@
xbps-0.52 (???):
* xbps-install(1): in dry-run mode, do not stop after processing a package
that is already up-to-date. Fixes #145.
See https://github.com/voidlinux/xbps/issues/145
* libxbps: package INSTALL/REMOVE scripts are now executed via
posix_spawn(3), replacing vfork(3).

View File

@ -239,9 +239,12 @@ main(int argc, char **argv)
rv = dist_upgrade(&xh, maxcols, yes, drun);
} else if (update) {
/* Update target packages */
int npkgs = argc - optind;
for (i = optind; i < argc; i++) {
rv = update_pkg(&xh, argv[i]);
if (rv != 0) {
if (npkgs >= 2 && rv == EEXIST) {
rv = 0;
} else if (rv != 0) {
xbps_end(&xh);
exit(rv);
}

View File

@ -32,6 +32,34 @@ install_existent_body() {
atf_check_equal $? 0
}
atf_test_case update_existent
updated_existent_head() {
atf_set "descr" "xbps-install(8): update existent pkg"
}
update_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 -d -a $PWD/*.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 -d -a $PWD/*.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 -un A B
atf_check_equal $? 0
}
atf_init_test_cases() {
atf_add_test_case install_existent
atf_add_test_case update_existent
}