Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/libcgroup/, dev-libs/libcgroup/files/
Date: Sat, 21 Sep 2019 09:15:54
Message-Id: 1569057320.4de83263b965d169ff6e1a42b3238f543633256c.mgorny@gentoo
1 commit: 4de83263b965d169ff6e1a42b3238f543633256c
2 Author: Bernardo Meurer <meurerbernardo <AT> gmail <DOT> com>
3 AuthorDate: Fri Aug 9 07:00:22 2019 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 21 09:15:20 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4de83263
7
8 dev-libs/libcgroup: add systemd unit files
9
10 Closes: https://bugs.gentoo.org/632204
11 Package-Manager: Portage-2.3.71, Repoman-2.3.17
12 Signed-off-by: Bernardo Meurer <bernardo <AT> standard.ai>
13 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
14
15 dev-libs/libcgroup/files/cgconfig.service | 17 +++++
16 dev-libs/libcgroup/files/cgrules.service | 16 +++++
17 dev-libs/libcgroup/libcgroup-0.41-r6.ebuild | 103 ++++++++++++++++++++++++++++
18 3 files changed, 136 insertions(+)
19
20 diff --git a/dev-libs/libcgroup/files/cgconfig.service b/dev-libs/libcgroup/files/cgconfig.service
21 new file mode 100644
22 index 00000000000..d2948ff825b
23 --- /dev/null
24 +++ b/dev-libs/libcgroup/files/cgconfig.service
25 @@ -0,0 +1,17 @@
26 +[Unit]
27 +Description=Control Group configuration service
28 +
29 +# The service should be able to start as soon as possible,
30 +# before any 'normal' services:
31 +DefaultDependencies=no
32 +Conflicts=shutdown.target
33 +Before=basic.target shutdown.target
34 +
35 +[Service]
36 +Type=oneshot
37 +RemainAfterExit=yes
38 +ExecStart=/usr/sbin/cgconfigparser -l /etc/cgroup/cgconfig.conf -s 1664
39 +ExecStop=/usr/sbin/cgclear -l /etc/cgroup/cgconfig.conf -e
40 +
41 +[Install]
42 +WantedBy=sysinit.target
43
44 diff --git a/dev-libs/libcgroup/files/cgrules.service b/dev-libs/libcgroup/files/cgrules.service
45 new file mode 100644
46 index 00000000000..2c6426bf952
47 --- /dev/null
48 +++ b/dev-libs/libcgroup/files/cgrules.service
49 @@ -0,0 +1,16 @@
50 +[Unit]
51 +Description=Control Group rules service
52 +
53 +# The service should be able to start as soon as possible,
54 +# before any 'normal' services:
55 +DefaultDependencies=no
56 +Conflicts=shutdown.target
57 +Before=basic.target shutdown.target
58 +After=cgconfig.service
59 +
60 +[Service]
61 +Type=simple
62 +ExecStart=/usr/sbin/cgrulesengd -n -f -
63 +
64 +[Install]
65 +WantedBy=sysinit.target
66
67 diff --git a/dev-libs/libcgroup/libcgroup-0.41-r6.ebuild b/dev-libs/libcgroup/libcgroup-0.41-r6.ebuild
68 new file mode 100644
69 index 00000000000..14021a85a76
70 --- /dev/null
71 +++ b/dev-libs/libcgroup/libcgroup-0.41-r6.ebuild
72 @@ -0,0 +1,103 @@
73 +# Copyright 1999-2019 Gentoo Authors
74 +# Distributed under the terms of the GNU General Public License v2
75 +
76 +EAPI=6
77 +
78 +inherit autotools flag-o-matic linux-info pam systemd
79 +
80 +DESCRIPTION="Tools and libraries to configure and manage kernel control groups"
81 +HOMEPAGE="http://libcg.sourceforge.net/"
82 +SRC_URI="mirror://sourceforge/project/libcg/${PN}/v${PV}/${P}.tar.bz2"
83 +
84 +LICENSE="LGPL-2.1"
85 +SLOT="0"
86 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
87 +IUSE="+daemon elibc_musl pam static-libs test +tools"
88 +
89 +RDEPEND="pam? ( virtual/pam )"
90 +
91 +DEPEND="
92 + ${RDEPEND}
93 + sys-devel/bison
94 + sys-devel/flex
95 + elibc_musl? ( sys-libs/fts-standalone )
96 + "
97 +REQUIRED_USE="daemon? ( tools )"
98 +
99 +DOCS=(README_daemon README README_systemd INSTALL)
100 +pkg_setup() {
101 + local CONFIG_CHECK="~CGROUPS"
102 + if use daemon; then
103 + CONFIG_CHECK="${CONFIG_CHECK} ~CONNECTOR ~PROC_EVENTS"
104 + fi
105 + linux-info_pkg_setup
106 +}
107 +
108 +PATCHES=(
109 + "${FILESDIR}"/${P}-replace_DECLS.patch
110 + "${FILESDIR}"/${P}-replace_INLCUDES.patch
111 + "${FILESDIR}"/${P}-reorder-headers.patch
112 + "${FILESDIR}"/${P}-remove-umask.patch
113 +)
114 +
115 +src_prepare() {
116 + default
117 + # Change rules file location
118 + sed -e 's:/etc/cgrules.conf:/etc/cgroup/cgrules.conf:' \
119 + -i src/libcgroup-internal.h || die "sed failed"
120 + sed -e 's:/etc/cgconfig.conf:/etc/cgroup/cgconfig.conf:' \
121 + -i src/libcgroup-internal.h || die "sed failed"
122 + sed -e 's:\(pam_cgroup_la_LDFLAGS.*\):\1\ -avoid-version:' \
123 + -i src/pam/Makefile.am || die "sed failed"
124 + sed -e 's#/var/run#/run#g' -i configure.in || die "sed failed"
125 +
126 + # If we're not running tests, don't bother building them.
127 + if ! use test; then
128 + sed -i '/^SUBDIRS/s:tests::' Makefile.am || die
129 + fi
130 +
131 + eautoreconf
132 +}
133 +
134 +src_configure() {
135 + local my_conf
136 +
137 + if use pam; then
138 + my_conf=" --enable-pam-module-dir=$(getpam_mod_dir) "
139 + fi
140 +
141 + use elibc_musl && append-ldflags "-lfts"
142 + econf \
143 + $(use_enable static-libs static) \
144 + $(use_enable daemon) \
145 + $(use_enable pam) \
146 + $(use_enable tools) \
147 + ${my_conf}
148 +}
149 +
150 +src_test() {
151 + # Use mount cgroup to build directory
152 + # sandbox restricted to trivial build,
153 + # possible kill Diego tanderbox ;)
154 + true
155 +}
156 +
157 +src_install() {
158 + default
159 + prune_libtool_files --all
160 +
161 + insinto /etc/cgroup
162 + doins samples/*.conf
163 +
164 + if use tools; then
165 + newconfd "${FILESDIR}"/cgconfig.confd-r1 cgconfig
166 + newinitd "${FILESDIR}"/cgconfig.initd-r1 cgconfig
167 + systemd_dounit "${FILESDIR}"/cgconfig.service
168 + systemd_dounit "${FILESDIR}"/cgrules.service
169 + fi
170 +
171 + if use daemon; then
172 + newconfd "${FILESDIR}"/cgred.confd-r2 cgred
173 + newinitd "${FILESDIR}"/cgred.initd-r1 cgred
174 + fi
175 +}