Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/xbps-install/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ update_pkg(struct xbps_handle *xhp, const char *pkg, bool force)

rv = xbps_transaction_update_pkg(xhp, pkg, force);
if (rv == EEXIST)
printf("Package '%s' is up to date.\n", pkg);
fprintf(stderr, "Package '%s' is up to date.\n", pkg);
else if (rv == ENOENT)
xbps_error_printf("Package '%s' not found in repository pool.\n", pkg);
else if (rv == ENODEV)
Expand Down
31 changes: 22 additions & 9 deletions lib/transaction_pkg_deps.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,28 @@ repo_deps(struct xbps_handle *xhp,
break;
}
}
if (ttype == XBPS_TRANS_UPDATE || ttype == XBPS_TRANS_CONFIGURE) {
/*
* If the package is already installed preserve the installation mode,
* which is not automatic if automatic-install is not set.
*/
bool pkgd_auto = false;
xbps_dictionary_get_bool(curpkgd, "automatic-install", &pkgd_auto);
autoinst = pkgd_auto;
}
if (ttype == XBPS_TRANS_CONFIGURE) {
if (!xbps_transaction_pkg_type_set(curpkgd, ttype)) {
rv = EINVAL;
xbps_dbg_printf("xbps_transaction_pkg_type_set failed for `%s': %s\n", reqpkg, strerror(rv));
break;
}
if (!xbps_transaction_store(xhp, pkgs, curpkgd, autoinst)) {
rv = EINVAL;
xbps_dbg_printf("xbps_transaction_store failed for `%s': %s\n", reqpkg, strerror(rv));
break;
}
continue;
}
/*
* Pass 4: find required dependency in repository pool.
* If dependency does not match add pkg into the missing
Expand Down Expand Up @@ -433,15 +455,6 @@ repo_deps(struct xbps_handle *xhp,
} else if (xbps_dictionary_get(curpkgd, "hold")) {
ttype = XBPS_TRANS_HOLD;
}
if (ttype == XBPS_TRANS_UPDATE || ttype == XBPS_TRANS_CONFIGURE) {
/*
* If the package is already installed preserve the installation mode,
* which is not automatic if automatic-install is not set.
*/
bool pkgd_auto = false;
xbps_dictionary_get_bool(curpkgd, "automatic-install", &pkgd_auto);
autoinst = pkgd_auto;
}
/*
* All deps were processed, store pkg in transaction.
*/
Expand Down
43 changes: 33 additions & 10 deletions tests/xbps/xbps-install/behaviour_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,40 @@ unpacked_dep_head() {

unpacked_dep_body() {
mkdir -p some_repo pkg_A pkg_B

cd some_repo
xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A
atf_check_equal $? 0
xbps-create -A noarch -n B-1.0_1 -s "B pkg" -D "A>=0" ../pkg_B
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
atf_check -o ignore -- xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A
atf_check -o ignore -- xbps-create -A noarch -n B-1.0_1 -s "B pkg" -D "A>=0" ../pkg_B
atf_check -o ignore -- xbps-rindex -a $PWD/*.xbps
cd ..
xbps-install -r root -C empty.conf --repository=$PWD/some_repo -yU A
atf_check_equal $? 0
res=$(xbps-install -r root -C empty.conf --repository=$PWD/some_repo -un B | grep -Fv -e "A-1.0_1 configure" -e "B-1.0_1 install")
atf_check_equal "$res" ""

atf_check -o ignore -- xbps-install -r root -C empty.conf --repository=$PWD/some_repo -yU A
atf_check -o inline:"unpacked\n" -- xbps-query -r root -p state A
atf_check -o match:"A-1.0_1 configure" -o match:"B-1.0_1 install" -- \
xbps-install -r root -C empty.conf --repository=$PWD/some_repo -un B
}

atf_test_case unpacked_dep_missing

unpacked_dep_missing_head() {
atf_set "descr" "xbps-install(1): unpacked dependency (missing)"
}

unpacked_dep_missing_body() {
mkdir -p some_repo other_repo pkg_A pkg_B

cd some_repo
atf_check -o ignore -- xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A
atf_check -o ignore -- xbps-rindex -a $PWD/*.xbps
cd ../other_repo
atf_check -o ignore -- xbps-create -A noarch -n B-1.0_1 -s "B pkg" -D "A>=0" ../pkg_B
atf_check -o ignore -- xbps-rindex -a $PWD/*.xbps
cd ..

atf_check -o ignore -- xbps-install -r root -C empty.conf --repository=$PWD/some_repo -yU A
atf_check -o inline:"unpacked\n" -- xbps-query -r root -p state A
atf_check -o match:"A-1.0_1 configure" -o match:"B-1.0_1 install" -- \
xbps-install -r root -C empty.conf --repository=$PWD/other_repo -un B
}

atf_test_case reinstall_unpacked_unpack_only
Expand Down Expand Up @@ -235,6 +257,7 @@ atf_init_test_cases() {
atf_add_test_case update_existent
atf_add_test_case update_unpacked
atf_add_test_case unpacked_dep
atf_add_test_case unpacked_dep_missing
atf_add_test_case reinstall_unpacked_unpack_only
atf_add_test_case reproducible
atf_add_test_case install_msg
Expand Down