libxbps: fix xbps autoupdate when its revdeps are up-to-date.

The current code was failing because while checking for updates
on its reverse dependencies, up-to-date versions were treated
as an error.

Added a new test case to verify that it works as expected.

Signed-off-by: Juan RP <xtraeme@gmail.com>
This commit is contained in:
Juan RP
2019-06-13 14:07:32 +02:00
committed by Duncan Overbruck
parent f63d1ffe27
commit c3b2d7ca53
2 changed files with 54 additions and 4 deletions

View File

@@ -89,7 +89,53 @@ update_xbps_with_revdeps_body() {
atf_check_equal $out "xbps-dbg-1.1_1"
}
atf_test_case update_xbps_with_uptodate_revdeps
update_xbps_with_uptodate_revdeps_head() {
atf_set "descr" "Tests for pkg updates: xbps autoupdates itself with already up-to-date revdeps"
}
update_xbps_with_uptodate_revdeps_body() {
mkdir -p repo xbps base-system
touch xbps/foo base-system/foo
cd repo
xbps-create -A noarch -n xbps-1.0_1 -s "xbps pkg" ../xbps
atf_check_equal $? 0
xbps-create -A noarch -n base-system-1.0_1 -s "base-system pkg" --dependencies "xbps>=0" ../base-system
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root --repository=$PWD/repo -yd base-system
atf_check_equal $? 0
out=$(xbps-query -r root -p pkgver xbps)
atf_check_equal $out "xbps-1.0_1"
out=$(xbps-query -r root -p pkgver base-system)
atf_check_equal $out "base-system-1.0_1"
cd repo
xbps-create -A noarch -n xbps-1.1_1 -s "xbps pkg" ../xbps
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
xbps-install -r root --repository=$PWD/repo -yud
atf_check_equal $? 0
out=$(xbps-query -r root -p pkgver xbps)
atf_check_equal $out "xbps-1.1_1"
out=$(xbps-query -r root -p pkgver base-system)
atf_check_equal $out "base-system-1.0_1"
}
atf_init_test_cases() {
atf_add_test_case update_xbps
atf_add_test_case update_xbps_with_revdeps
atf_add_test_case update_xbps_with_uptodate_revdeps
}