sys-apps/tuned: fix rpm lookup err
authorYixun Lan <dlan@gentoo.org>
Tue, 1 Nov 2016 16:13:25 +0000 (00:13 +0800)
committerYixun Lan <dlan@gentoo.org>
Tue, 1 Nov 2016 16:15:25 +0000 (00:15 +0800)
Gentoo-Bug: 563396

Package-Manager: portage-2.3.2

sys-apps/tuned/files/tuned-2.7.1-makefile.patch [new file with mode: 0644]
sys-apps/tuned/tuned-2.7.1-r2.ebuild [new file with mode: 0644]

diff --git a/sys-apps/tuned/files/tuned-2.7.1-makefile.patch b/sys-apps/tuned/files/tuned-2.7.1-makefile.patch
new file mode 100644 (file)
index 0000000..54e89a1
--- /dev/null
@@ -0,0 +1,15 @@
+diff --git a/Makefile b/Makefile
+index 9e2d8fe..6de30d0 100644
+--- a/Makefile
++++ b/Makefile
+@@ -19,8 +19,8 @@ else
+       GIT_PSUFFIX = .$(GIT_SUFFIX)
+       RPM_VERSION = $(NAME)-$(VERSION)-1$(GIT_PSUFFIX)
+ endif
+-UNITDIR = $(shell rpm --eval '%{_unitdir}' 2>/dev/null || echo /usr/lib/systemd/system)
+-TMPFILESDIR = $(shell rpm --eval '%{_tmpfilesdir}' 2>/dev/null || echo /usr/lib/tmpfiles.d)
++UNITDIR = $(shell if which rpm > /dev/null 2>&1; then rpm --eval '%{_unitdir}' 2>/dev/null; else echo /usr/lib/systemd/system; fi)
++TMPFILESDIR = $(shell if which rpm > /dev/null 2>&1; then rpm --eval '%{_tmpfilesdir}' 2>/dev/null; else echo /usr/lib/tmpfiles.d; fi)
+ VERSIONED_NAME = $(NAME)-$(VERSION)$(GIT_PSUFFIX)
+ 
+ DATADIR = /usr/share
diff --git a/sys-apps/tuned/tuned-2.7.1-r2.ebuild b/sys-apps/tuned/tuned-2.7.1-r2.ebuild
new file mode 100644 (file)
index 0000000..6c58913
--- /dev/null
@@ -0,0 +1,52 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit python-single-r1 systemd
+
+DESCRIPTION="Daemon for monitoring and adaptive tuning of system devices"
+HOMEPAGE="https://fedorahosted.org/tuned/"
+SRC_URI="https://fedorahosted.org/releases/t/u/tuned/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+COMMON_DEPEND="${PYTHON_DEPS}
+       dev-python/configobj[${PYTHON_USEDEP}]
+       dev-python/decorator[${PYTHON_USEDEP}]
+       dev-python/pyudev[${PYTHON_USEDEP}]
+       dev-python/dbus-python[${PYTHON_USEDEP}]
+       dev-python/pygobject:3[${PYTHON_USEDEP}]
+"
+DEPEND="${COMMON_DEPEND}"
+RDEPEND="${COMMON_DEPEND}
+       sys-apps/dbus
+       sys-apps/ethtool
+       sys-power/powertop
+       sys-process/procps
+       dev-util/systemtap
+"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+src_prepare() {
+       epatch "${FILESDIR}"/${P}-sysctl.patch
+       epatch "${FILESDIR}"/${P}-makefile.patch
+
+       sed -i \
+               -e "/\$(DESTDIR)\/run\/tuned/d" \
+               Makefile ||die
+}
+
+src_install() {
+       default
+       newinitd "${FILESDIR}"/tuned.initd  tuned
+
+       python_fix_shebang "${ED}"
+}