Add the ability to ignore packages

The previous idea was to use virtual packages in the users configuration
to satisfy dependencies by mapping them to existing installed packages.
Using virtual packages for it doesn't work as expected and trying to make
it work would break other functionalities of virtual packages, like the
version satisfaction checks for `provides` and the ability to replace
virtual packages with real packages. The virtual package functionality
should be used exclusively for virtual packages.

This allows users to specify packages packages that should be ignored.
Ignored packages in dependencies are always satisfied without installing
the package, while updating or installing a package that depends on an
ignored package.

This does NOT ignore the shlib checks, ignoring a package that provides
required shared libraries will abort the transaction as if there was no
package that provides the required shared library.
This commit is contained in:
Duncaen
2019-03-05 16:45:29 +01:00
parent 9f52a7837f
commit d1667fd931
9 changed files with 134 additions and 1 deletions

View File

@@ -24,3 +24,4 @@ atf_test_program{name="update_itself"}
atf_test_program{name="cyclic_deps"}
atf_test_program{name="conflicts"}
atf_test_program{name="downgrade_hold"}
atf_test_program{name="ignore"}

View File

@@ -7,7 +7,7 @@ TESTSHELL+= replace_test installmode_test obsoletefiles_test
TESTSHELL+= issue31_test scripts_test incorrect_deps_test
TESTSHELL+= vpkg_test install_test preserve_files_test configure_test
TESTSHELL+= update_shlibs update_hold update_repolock cyclic_deps conflicts
TESTSHELL+= update_itself downgrade_hold
TESTSHELL+= update_itself downgrade_hold ignore
EXTRA_FILES = Kyuafile
include $(TOPDIR)/mk/test.mk

View File

@@ -0,0 +1,70 @@
#!/usr/bin/env atf-sh
atf_test_case install_with_ignored_dep
install_with_ignored_dep_head() {
atf_set "descr" "Tests for pkg install: with ignored dependency"
}
install_with_ignored_dep_body() {
mkdir -p repo pkg_A pkg_B
cd 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" ../pkg_B
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
echo "ignorepkg=B" > ignore.conf
out=$(xbps-install -r root -C ignore.conf --repository=$PWD/repo -n A)
set -- $out
exp="$1 $2 $3 $4"
atf_check_equal "$exp" "A-1.0_1 install noarch $PWD/repo"
xbps-install -r root -C ignore.conf --repository=$PWD/repo -yd A
atf_check_equal $? 0
xbps-query -r root A
atf_check_equal $? 0
xbps-query -r root B
atf_check_equal $? 2
}
atf_test_case update_with_ignored_dep
update_with_ignored_dep_head() {
atf_set "descr" "Tests for pkg update: with ignored dependency"
}
update_with_ignored_dep_body() {
mkdir -p repo pkg_A pkg_B
cd 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" ../pkg_B
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
echo "ignorepkg=B" > ignore.conf
xbps-install -r root -C ignore.conf --repository=$PWD/repo -yd A
atf_check_equal $? 0
cd repo
xbps-create -A noarch -n A-1.1_1 -s "A pkg" ../pkg_A
atf_check_equal $? 0
xbps-rindex -d -a $PWD/*.xbps
atf_check_equal $? 0
cd ..
out=$(xbps-install -r root -C ignore.conf --repository=$PWD/repo -un)
set -- $out
exp="$1 $2 $3 $4"
atf_check_equal "$exp" "A-1.1_1 update noarch $PWD/repo"
xbps-install -r root --repository=$PWD/repo -yuvd
atf_check_equal $? 0
out=$(xbps-query -r root -p pkgver A)
atf_check_equal $out A-1.1_1
}
atf_init_test_cases() {
atf_add_test_case install_with_ignored_dep
atf_add_test_case update_with_ignored_dep
}