diff --git a/NEWS b/NEWS index 31ad8aed..c44b8668 100644 --- a/NEWS +++ b/NEWS @@ -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). diff --git a/bin/xbps-install/main.c b/bin/xbps-install/main.c index 3bedf677..b57f2fe9 100644 --- a/bin/xbps-install/main.c +++ b/bin/xbps-install/main.c @@ -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); } diff --git a/tests/xbps/xbps-install/behaviour_tests.sh b/tests/xbps/xbps-install/behaviour_tests.sh index 02f39ecf..fd7bb630 100644 --- a/tests/xbps/xbps-install/behaviour_tests.sh +++ b/tests/xbps/xbps-install/behaviour_tests.sh @@ -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 }