# Template file for 'bash-completion'
pkgname=bash-completion
version=2.11
revision=4
build_style=gnu-configure
make_install_args="profiledir=/etc/bash/bashrc.d"
depends="bash"
checkdepends="python3-pytest python3-pexpect"
short_desc="Programmable completion for the GNU Bash shell"
maintainer="skmpz <dem.procopiou@gmail.com>"
license="GPL-2.0-or-later"
homepage="https://github.com/scop/bash-completion"
distfiles="https://github.com/scop/bash-completion/releases/download/${version}/bash-completion-${version}.tar.xz"
checksum=73a8894bad94dee83ab468fa09f628daffd567e8bef1a24277f1e9a0daf911ac

# Summary of tests:
# = 26 failed, 1106 passed, 457 skipped, 14 xfailed, 4 xpassed in 1126.01s (0:18:46) =

# FIXME: 26 tests listed below fail, see #35201
_test_deselect="
 test_aclocal.py::TestAclocal::test_1
 test_chsh.py::TestChsh::test_2
 test_ether_wake.py::TestEtherWake::test_1
 test_gdb.py::TestGdb::test_2
 test_ifdown.py::TestIfdown::test_1
 test_ifstat.py::TestIfstat::test_2
 test_ifup.py::TestIfup::test_1
 test_iperf.py::TestIperf::test_2
 test_killall.py::TestKillall::test_1
 test_nethogs.py::TestNethogs::test_1
 test_perldoc.py::TestPerldoc::test_1
 test_perldoc.py::TestPerldoc::test_3
 test_pgrep.py::TestPgrep::test_1
 test_pidof.py::TestPidof::test_1
 test_pkill.py::TestPkill::test_1
 test_pwdx.py::TestPwdx::test_1
 test_renice.py::TestRenice::test_1
 test_renice.py::TestRenice::test_2
 test_reptyr.py::TestReptyr::test_1
 test_service.py::TestService::test_1
 test_tar.py::TestTar::test_4
 test_tar.py::TestTar::test_22
 unit/test_unit_ip_addresses.py::TestUnitIpAddresses::test_1
 unit/test_unit_ip_addresses.py::TestUnitIpAddresses::test_2
 unit/test_unit_ip_addresses.py::TestUnitIpAddresses::test_3
 unit/test_unit_ip_addresses.py::TestUnitIpAddresses::test_4
"

if [ "$XBPS_BUILD_ENVIRONMENT" = void-packages-ci ]; then
	# these fail on CI because of some confusion with the homedir
	_test_deselect+="
	 unit/test_unit_expand.py::TestUnitExpand::test_user_home
	 unit/test_unit_expand_tilde_by_ref.py::TestUnitExpandTildeByRef::test_expand
	"
fi

pre_check() {
	for t in $_test_deselect; do
		PYTEST_ADDOPTS+=" --deselect=t/$t"
	done
	export PYTEST_ADDOPTS
}

post_install() {
	# for slackware's that we don't have, conflicts with pacman's
	rm ${DESTDIR}/usr/share/bash-completion/completions/makepkg
}
