xbps now also updates revdeps of itself if there's an update.
Close https://github.com/void-linux/xbps/issues/77 Closes: #78 [via git-merge-pr]
This commit is contained in:
parent
08aa44602f
commit
291faddf8c
@ -247,11 +247,36 @@ xbps_transaction_update_packages(struct xbps_handle *xhp)
|
|||||||
xbps_dictionary_get_cstring_nocopy(pkgd, "pkgver", &pkgver);
|
xbps_dictionary_get_cstring_nocopy(pkgd, "pkgver", &pkgver);
|
||||||
pkgname = xbps_pkg_name(pkgver);
|
pkgname = xbps_pkg_name(pkgver);
|
||||||
assert(pkgname);
|
assert(pkgname);
|
||||||
if (trans_find_pkg(xhp, pkgname, false, false) == 0) {
|
|
||||||
|
rv = trans_find_pkg(xhp, pkgname, false, false);
|
||||||
free(pkgname);
|
free(pkgname);
|
||||||
|
|
||||||
|
if (rv == 0) {
|
||||||
|
/* new version found, take into account its revdeps */
|
||||||
|
xbps_array_t rdeps;
|
||||||
|
|
||||||
|
rdeps = xbps_pkgdb_get_pkg_revdeps(xhp, "xbps");
|
||||||
|
for (unsigned int i = 0; i < xbps_array_count(rdeps); i++) {
|
||||||
|
const char *curpkgver;
|
||||||
|
char *curpkgn;
|
||||||
|
|
||||||
|
xbps_array_get_cstring_nocopy(rdeps, i, &curpkgver);
|
||||||
|
curpkgn = xbps_pkg_name(curpkgver);
|
||||||
|
assert(curpkgn);
|
||||||
|
rv = trans_find_pkg(xhp, curpkgn, false, false);
|
||||||
|
free(curpkgn);
|
||||||
|
if (rv != 0 && rv != EEXIST)
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
} else if (rv == EEXIST || rv == ENOENT) {
|
||||||
|
/* no update */
|
||||||
|
;
|
||||||
|
} else {
|
||||||
|
/* error */
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
free(pkgname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
iter = xbps_dictionary_iterator(xhp->pkgdb);
|
iter = xbps_dictionary_iterator(xhp->pkgdb);
|
||||||
|
@ -20,6 +20,7 @@ atf_test_program{name="preserve_files_test"}
|
|||||||
atf_test_program{name="update_shlibs"}
|
atf_test_program{name="update_shlibs"}
|
||||||
atf_test_program{name="update_hold"}
|
atf_test_program{name="update_hold"}
|
||||||
atf_test_program{name="update_repolock"}
|
atf_test_program{name="update_repolock"}
|
||||||
|
atf_test_program{name="update_itself"}
|
||||||
atf_test_program{name="cyclic_deps"}
|
atf_test_program{name="cyclic_deps"}
|
||||||
atf_test_program{name="conflicts"}
|
atf_test_program{name="conflicts"}
|
||||||
atf_test_program{name="downgrade_hold"}
|
atf_test_program{name="downgrade_hold"}
|
||||||
|
@ -7,7 +7,7 @@ TESTSHELL+= replace_test installmode_test obsoletefiles_test
|
|||||||
TESTSHELL+= issue31_test scripts_test incorrect_deps_test
|
TESTSHELL+= issue31_test scripts_test incorrect_deps_test
|
||||||
TESTSHELL+= vpkg_test install_test preserve_files_test configure_test
|
TESTSHELL+= vpkg_test install_test preserve_files_test configure_test
|
||||||
TESTSHELL+= update_shlibs update_hold update_repolock cyclic_deps conflicts
|
TESTSHELL+= update_shlibs update_hold update_repolock cyclic_deps conflicts
|
||||||
TESTSHELL+= downgrade_hold
|
TESTSHELL+= update_itself downgrade_hold
|
||||||
EXTRA_FILES = Kyuafile
|
EXTRA_FILES = Kyuafile
|
||||||
|
|
||||||
include $(TOPDIR)/mk/test.mk
|
include $(TOPDIR)/mk/test.mk
|
||||||
|
95
tests/xbps/libxbps/shell/update_itself.sh
Normal file
95
tests/xbps/libxbps/shell/update_itself.sh
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
#!/usr/bin/env atf-sh
|
||||||
|
|
||||||
|
atf_test_case update_xbps
|
||||||
|
|
||||||
|
update_xbps_head() {
|
||||||
|
atf_set "descr" "Tests for pkg updates: xbps autoupdates itself"
|
||||||
|
}
|
||||||
|
|
||||||
|
update_xbps_body() {
|
||||||
|
mkdir -p repo xbps
|
||||||
|
touch xbps/foo
|
||||||
|
|
||||||
|
cd repo
|
||||||
|
xbps-create -A noarch -n xbps-1.0_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 -yd xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
|
||||||
|
out=$(xbps-query -r root -p pkgver xbps)
|
||||||
|
atf_check_equal "$out" "xbps-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-1.1_1.noarch.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"
|
||||||
|
}
|
||||||
|
|
||||||
|
atf_test_case update_xbps_with_revdeps
|
||||||
|
|
||||||
|
update_xbps_with_revdeps_head() {
|
||||||
|
atf_set "descr" "Tests for pkg updates: xbps autoupdates itself with revdeps"
|
||||||
|
}
|
||||||
|
|
||||||
|
update_xbps_with_revdeps_body() {
|
||||||
|
mkdir -p repo xbps xbps-dbg
|
||||||
|
touch xbps/foo xbps-dbg/foo
|
||||||
|
|
||||||
|
cd repo
|
||||||
|
xbps-create -A noarch -n xbps-1.0_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 -yd xbps-1.0_1
|
||||||
|
atf_check_equal $? 0
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
xbps-create -A noarch -n xbps-dbg-1.0_1 -s "xbps-dbg pkg" --dependencies "xbps-1.0_1" ../xbps-dbg
|
||||||
|
atf_check_equal $? 0
|
||||||
|
xbps-rindex -d -a $PWD/*.xbps
|
||||||
|
atf_check_equal $? 0
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
xbps-install -r root --repository=$PWD/repo -yd xbps-dbg-1.0_1
|
||||||
|
atf_check_equal $? 0
|
||||||
|
|
||||||
|
cd repo
|
||||||
|
xbps-create -A noarch -n xbps-dbg-1.1_1 -s "xbps-dbg pkg" --dependencies "xbps-1.1_1" ../xbps-dbg
|
||||||
|
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 xbps-dbg)
|
||||||
|
atf_check_equal $out "xbps-dbg-1.1_1"
|
||||||
|
}
|
||||||
|
|
||||||
|
atf_init_test_cases() {
|
||||||
|
atf_add_test_case update_xbps
|
||||||
|
atf_add_test_case update_xbps_with_revdeps
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user