From c52b3d04113f0816c3aa3f462677d75473bb21ed Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Tue, 23 Sep 2025 18:41:57 +0200 Subject: [PATCH 1/4] bin/xbps-install: print package is up to date message to stderr --- bin/xbps-install/transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/xbps-install/transaction.c b/bin/xbps-install/transaction.c index 827286724..84222f919 100644 --- a/bin/xbps-install/transaction.c +++ b/bin/xbps-install/transaction.c @@ -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) From 966954d37437c8fb83c1324736b896a9685d18cd Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Fri, 3 Oct 2025 21:32:05 +0200 Subject: [PATCH 2/4] tests: cleanup unpacked_dep test --- tests/xbps/xbps-install/behaviour_tests.sh | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/xbps/xbps-install/behaviour_tests.sh b/tests/xbps/xbps-install/behaviour_tests.sh index b1a8a4bd5..15625d6a2 100644 --- a/tests/xbps/xbps-install/behaviour_tests.sh +++ b/tests/xbps/xbps-install/behaviour_tests.sh @@ -95,18 +95,17 @@ 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 reinstall_unpacked_unpack_only From c8b2f62e3444b3976799abb7daddbff00a7a699c Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Fri, 3 Oct 2025 21:32:49 +0200 Subject: [PATCH 3/4] tests: add unpack_dep_missing test a package that is pulled into the transaction to be configured doesn't need to be found in the repository pool. --- tests/xbps/xbps-install/behaviour_tests.sh | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/xbps/xbps-install/behaviour_tests.sh b/tests/xbps/xbps-install/behaviour_tests.sh index 15625d6a2..67859d659 100644 --- a/tests/xbps/xbps-install/behaviour_tests.sh +++ b/tests/xbps/xbps-install/behaviour_tests.sh @@ -108,6 +108,29 @@ unpacked_dep_body() { 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 reinstall_unpacked_unpack_only_head() { @@ -234,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 From 382afbe7b8a8cc37c7e437fb94c3c8731a3225a4 Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Fri, 3 Oct 2025 21:35:45 +0200 Subject: [PATCH 4/4] lib: packages to be configured don't need to be in the repos a package that is pulled into the transaction to be configured doesn't need to be found in the repository pool. --- lib/transaction_pkg_deps.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/lib/transaction_pkg_deps.c b/lib/transaction_pkg_deps.c index ae0602ece..25c3332a4 100644 --- a/lib/transaction_pkg_deps.c +++ b/lib/transaction_pkg_deps.c @@ -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 @@ -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. */