diff --git a/NEWS b/NEWS index cff8aab9..244e123f 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,10 @@ xbps-0.38 (???): + * libxbps: fixed a new issue with packages that provide/replace the + same virtual package that is going to be replaced. The issue could be + reproduced easily by installing any awk package (gawk, mawk, or nawk), + which are providing/replacing the "awk" virtual package. + * libfetch: synchronized with NetBSD pkgsrc/libfetch. * libfetch: add support for TLS SNI (Server Name Identification) from NetBSD, with diff --git a/lib/transaction_sortdeps.c b/lib/transaction_sortdeps.c index c7114ddf..05652afa 100644 --- a/lib/transaction_sortdeps.c +++ b/lib/transaction_sortdeps.c @@ -316,7 +316,8 @@ xbps_transaction_sort(struct xbps_handle *xhp) } } } - if (!vpkg_found && (pd = pkgdep_find(pkgver)) == NULL) { + pd = pkgdep_find(pkgver); + if ((!strcmp(tract, "remove") || (!pd && !vpkg_found))) { /* * If package not in list, just add to the tail. */ diff --git a/tests/xbps/libxbps/shell/vpkg_test.sh b/tests/xbps/libxbps/shell/vpkg_test.sh index 2b3ba957..ba311bc1 100644 --- a/tests/xbps/libxbps/shell/vpkg_test.sh +++ b/tests/xbps/libxbps/shell/vpkg_test.sh @@ -13,13 +13,13 @@ # D should replace A only if it has "replaces" property on A. The result should be # that D must be installed and A being as is. -atf_test_case vpkg_noupdate +atf_test_case vpkg00 -vpkg_noupdate_head() { +vpkg00_head() { atf_set "descr" "Tests for virtual pkgs: don't update vpkg" } -vpkg_noupdate_body() { +vpkg00_body() { mkdir some_repo mkdir -p pkg_{A,B,C,D}/usr/bin cd some_repo @@ -42,6 +42,44 @@ vpkg_noupdate_body() { atf_check_equal $? 0 } -atf_init_test_cases() { - atf_add_test_case vpkg_noupdate +atf_test_case vpkg01 + +vpkg01_head() { + atf_set "descr" "Tests for virtual pkgs: commit ebc0f27ae1c" +} + +vpkg01_body() { + mkdir some_repo + mkdir -p pkg_{A,B,C,D}/usr/bin + mkdir -p pkg_C/usr/share/xbps/virtualpkg.d + echo "virtualpkg=A-1.0_1:C" > pkg_C/usr/share/xbps/virtualpkg.d/C.conf + 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" --dependencies "A>=0" ../pkg_B + atf_check_equal $? 0 + xbps-create -A noarch -n C-1.0_1 -s "C pkg" --provides "A-1.0_1" --replaces="A>=0" ../pkg_C + atf_check_equal $? 0 + xbps-create -A noarch -n D-1.0_1 -s "D pkg" --dependencies "C>=0" ../pkg_D + atf_check_equal $? 0 + + xbps-rindex -a *.xbps + atf_check_equal $? 0 + cd .. + + xbps-install -C empty.conf -r root --repository=$PWD/some_repo -dy B + atf_check_equal $? 0 + xbps-install -C empty.conf -r root --repository=$PWD/some_repo -dy D + atf_check_equal $? 0 + + out=$(xbps-query -C empty.conf -r root -l|awk '{print $2}'|tr -d '\n') + exp="B-1.0_1C-1.0_1D-1.0_1" + echo "out: $out" + echo "exp: $exp" + atf_check_equal $out $exp +} + +atf_init_test_cases() { + atf_add_test_case vpkg00 + atf_add_test_case vpkg01 }