blob: 8ea96034f919c6eeb1b1f32b738a7586f3a89461 [file] [log] [blame]
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
# Seems to work with 3.6...
PYTHON_COMPAT=( python3_{6,7,8,9} )
inherit python-single-r1 xdg-utils
DESCRIPTION="Daemon for monitoring and adaptive tuning of system devices"
HOMEPAGE="https://github.com/redhat-performance/tuned"
SRC_URI="https://github.com/redhat-performance/tuned/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="*"
IUSE="systemtap"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
DEPEND="
${PYTHON_DEPS}
$(python_gen_cond_dep '
dev-python/configobj[${PYTHON_MULTI_USEDEP}]
dev-python/decorator[${PYTHON_MULTI_USEDEP}]
dev-python/pyudev[${PYTHON_MULTI_USEDEP}]
dev-python/dbus-python[${PYTHON_MULTI_USEDEP}]
dev-python/pygobject:3[${PYTHON_MULTI_USEDEP}]
dev-python/python-linux-procfs[${PYTHON_MULTI_USEDEP}]
')"
# Systemtap is only used in the form a few misc utilities.
# Mark it as optional.
RDEPEND="
${DEPEND}
sys-apps/dbus
sys-apps/ethtool
sys-power/powertop
systemtap? ( dev-util/systemtap )"
RESTRICT="test"
src_prepare() {
default
eapply "${FILESDIR}"
# Tuned autodetects the Python dir with an absolute path, but then
# that absolute path is created relative to the EROOT, which means
# none of the python modules can be found. Therefore, find the
# absolute python path and strip the EROOT so we get the python site dir
# relative to the EROOT.
# ie, This will try to install to /build/${BOARD}/usr/lib64/python3.6/site-packages
# by default when we just want to install to /usr/lib64/python3.6/site-packages.
python_site_dir="$(python_get_sitedir)"
python_site_dir=${python_site_dir#${EROOT}}
sed -i \
-e "/^PYTHON/s:/usr/bin/python3:${EPREFIX}/usr/bin/${EPYTHON}:" \
-e "/^export DOCDIR/s/$/&\-\$(VERSION)/g" \
-e "/\$(DESTDIR)\/run\/tuned/d" \
-e "/\$(DESTDIR)\/var\/lib\/tuned/d" \
-e "/\$(DESTDIR)\/var\/log\/tuned/d" \
-e "s:PYTHON_SITELIB = .*:PYTHON_SITELIB = ${python_site_dir}:" \
Makefile || die
}
src_install() {
default
if ! use systemtap; then
rm ${D}/usr/sbin/{diskdevstat,netdevstat,scomes,varnetload}
fi
python_fix_shebang "${D}"
python_optimize
}
pkg_postinst() {
xdg_icon_cache_update
}