Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/dbus/, sys-apps/dbus/files/
Date: Thu, 04 Apr 2019 01:59:05
Message-Id: 1554342846.c0dca773e47d3532401cea9be36da5f4c563159c.floppym@gentoo
1 commit: c0dca773e47d3532401cea9be36da5f4c563159c
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Thu Apr 4 01:54:06 2019 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 4 01:54:06 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c0dca773
7
8 sys-apps/dbus: move stuff under /run on linux
9
10 systemd-242 complains about sockets under /var/run. Let's avoid that.
11
12 Package-Manager: Portage-2.3.62_p4, Repoman-2.3.12_p87
13 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
14
15 sys-apps/dbus/dbus-1.12.12-r2.ebuild | 287 +++++++++++++++++++++++++++++++++++
16 sys-apps/dbus/files/dbus.initd.in | 36 +++++
17 2 files changed, 323 insertions(+)
18
19 diff --git a/sys-apps/dbus/dbus-1.12.12-r2.ebuild b/sys-apps/dbus/dbus-1.12.12-r2.ebuild
20 new file mode 100644
21 index 00000000000..44d36d8040b
22 --- /dev/null
23 +++ b/sys-apps/dbus/dbus-1.12.12-r2.ebuild
24 @@ -0,0 +1,287 @@
25 +# Copyright 1999-2019 Gentoo Authors
26 +# Distributed under the terms of the GNU General Public License v2
27 +
28 +EAPI=7
29 +
30 +PYTHON_COMPAT=( python{2_7,3_{4,5,6,7}} )
31 +inherit autotools flag-o-matic linux-info python-any-r1 readme.gentoo-r1 systemd virtualx user multilib-minimal
32 +
33 +DESCRIPTION="A message bus system, a simple way for applications to talk to each other"
34 +HOMEPAGE="https://dbus.freedesktop.org/"
35 +SRC_URI="https://dbus.freedesktop.org/releases/dbus/${P}.tar.gz"
36 +
37 +LICENSE="|| ( AFL-2.1 GPL-2 )"
38 +SLOT="0"
39 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
40 +IUSE="debug doc elogind kernel_linux selinux static-libs systemd test user-session X"
41 +
42 +REQUIRED_USE="?? ( elogind systemd )"
43 +
44 +# autoconf-archive-2019.01.06 blocker added for bug #674830
45 +# Please check on bumps if the blocker is still necessary.
46 +BDEPEND="
47 + app-text/xmlto
48 + app-text/docbook-xml-dtd:4.4
49 + <sys-devel/autoconf-archive-2019.01.06
50 + virtual/pkgconfig
51 + doc? ( app-doc/doxygen )
52 +"
53 +COMMON_DEPEND="
54 + >=dev-libs/expat-2.1.0
55 + elogind? ( sys-auth/elogind )
56 + selinux? ( sys-libs/libselinux )
57 + systemd? ( sys-apps/systemd:0= )
58 + X? (
59 + x11-libs/libX11
60 + x11-libs/libXt
61 + )
62 +"
63 +DEPEND="${COMMON_DEPEND}
64 + dev-libs/expat
65 + test? (
66 + ${PYTHON_DEPS}
67 + >=dev-libs/glib-2.40:2
68 + )
69 +"
70 +RDEPEND="${COMMON_DEPEND}
71 + selinux? ( sec-policy/selinux-dbus )
72 +"
73 +
74 +DOC_CONTENTS="
75 + Some applications require a session bus in addition to the system
76 + bus. Please see \`man dbus-launch\` for more information.
77 +"
78 +
79 +# out of sources build dir for make check
80 +TBD="${WORKDIR}/${P}-tests-build"
81 +
82 +PATCHES=(
83 + "${FILESDIR}/${PN}-enable-elogind.patch"
84 + "${FILESDIR}/${PN}-daemon-optional.patch" # bug #653136
85 +)
86 +
87 +pkg_setup() {
88 + enewgroup messagebus
89 + enewuser messagebus -1 -1 -1 messagebus
90 +
91 + use test && python-any-r1_pkg_setup
92 +
93 + if use kernel_linux; then
94 + CONFIG_CHECK="~EPOLL"
95 + linux-info_pkg_setup
96 + fi
97 +}
98 +
99 +src_prepare() {
100 + # Tests were restricted because of this
101 + sed -i \
102 + -e 's/.*bus_dispatch_test.*/printf ("Disabled due to excess noise\\n");/' \
103 + -e '/"dispatch"/d' \
104 + bus/test-main.c || die
105 +
106 + default
107 +
108 + if [[ ${CHOST} == *-solaris* ]]; then
109 + # fix standards conflict, due to gcc being c99 by default nowadays
110 + sed -i \
111 + -e 's/_XOPEN_SOURCE=500/_XOPEN_SOURCE=600/' \
112 + configure.ac || die
113 + fi
114 +
115 + # required for bug 263909, cross-compile so don't remove eautoreconf
116 + eautoreconf
117 +}
118 +
119 +src_configure() {
120 + local rundir=$(usex kernel_linux /run /var/run)
121 + sed -e "s;@rundir@;${EPREFIX}${rundir};g" "${FILESDIR}"/dbus.initd.in > "${WORKDIR}"/dbus.initd || die
122 + multilib-minimal_src_configure
123 +}
124 +
125 +multilib_src_configure() {
126 + local docconf myconf testconf
127 +
128 + # so we can get backtraces from apps
129 + case ${CHOST} in
130 + *-mingw*)
131 + # error: unrecognized command line option '-rdynamic' wrt #488036
132 + ;;
133 + *)
134 + append-flags -rdynamic
135 + ;;
136 + esac
137 +
138 + # libaudit is *only* used in DBus wrt SELinux support, so disable it, if
139 + # not on an SELinux profile.
140 + myconf=(
141 + --localstatedir="${EPREFIX}/var"
142 + --docdir="${EPREFIX}/usr/share/doc/${PF}"
143 + --htmldir="${EPREFIX}/usr/share/doc/${PF}/html"
144 + $(use_enable static-libs static)
145 + $(use_enable debug verbose-mode)
146 + --disable-asserts
147 + --disable-checks
148 + $(use_enable selinux)
149 + $(use_enable selinux libaudit)
150 + --disable-apparmor
151 + $(use_enable kernel_linux inotify)
152 + $(use_enable kernel_FreeBSD kqueue)
153 + $(use_enable elogind)
154 + $(use_enable systemd)
155 + $(use_enable user-session)
156 + --disable-embedded-tests
157 + --disable-modular-tests
158 + $(use_enable debug stats)
159 + --with-session-socket-dir="${EPREFIX}"/tmp
160 + --with-system-pid-file="${EPREFIX}${rundir}"/dbus.pid
161 + --with-system-socket="${EPREFIX}${rundir}"/dbus/system_bus_socket
162 + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
163 + --with-dbus-user=messagebus
164 + $(use_with X x)
165 + )
166 +
167 + if [[ ${CHOST} == *-darwin* ]]; then
168 + myconf+=(
169 + --enable-launchd
170 + --with-launchd-agent-dir="${EPREFIX}"/Library/LaunchAgents
171 + )
172 + fi
173 +
174 + if multilib_is_native_abi; then
175 + docconf=(
176 + --enable-xml-docs
177 + $(use_enable doc doxygen-docs)
178 + )
179 + else
180 + docconf=(
181 + --disable-xml-docs
182 + --disable-doxygen-docs
183 + )
184 + myconf+=(
185 + --disable-daemon
186 + --disable-selinux
187 + --disable-libaudit
188 + --disable-elogind
189 + --disable-systemd
190 + --without-x
191 + )
192 + fi
193 +
194 + einfo "Running configure in ${BUILD_DIR}"
195 + ECONF_SOURCE="${S}" econf "${myconf[@]}" "${docconf[@]}"
196 +
197 + if multilib_is_native_abi && use test; then
198 + mkdir "${TBD}" || die
199 + cd "${TBD}" || die
200 + testconf=(
201 + $(use_enable test asserts)
202 + $(use_enable test checks)
203 + $(use_enable test embedded-tests)
204 + $(use_enable test stats)
205 + $(has_version dev-libs/dbus-glib && echo --enable-modular-tests)
206 + )
207 + einfo "Running configure in ${TBD}"
208 + ECONF_SOURCE="${S}" econf "${myconf[@]}" "${testconf[@]}"
209 + fi
210 +}
211 +
212 +multilib_src_compile() {
213 + if multilib_is_native_abi; then
214 + # after the compile, it uses a selinuxfs interface to
215 + # check if the SELinux policy has the right support
216 + use selinux && addwrite /selinux/access
217 +
218 + einfo "Running make in ${BUILD_DIR}"
219 + emake
220 +
221 + if use test; then
222 + einfo "Running make in ${TBD}"
223 + emake -C "${TBD}"
224 + fi
225 + else
226 + emake -C dbus libdbus-1.la
227 + fi
228 +}
229 +
230 +src_test() {
231 + DBUS_VERBOSE=1 virtx emake -j1 -C "${TBD}" check
232 +}
233 +
234 +multilib_src_install() {
235 + if multilib_is_native_abi; then
236 + emake DESTDIR="${D}" install
237 + else
238 + emake DESTDIR="${D}" install-pkgconfigDATA
239 + emake DESTDIR="${D}" -C dbus \
240 + install-libLTLIBRARIES install-dbusincludeHEADERS \
241 + install-nodist_dbusarchincludeHEADERS
242 + fi
243 +}
244 +
245 +multilib_src_install_all() {
246 + newinitd "${WORKDIR}"/dbus.initd dbus
247 +
248 + if use X; then
249 + # dbus X session script (#77504)
250 + # turns out to only work for GDM (and startx). has been merged into
251 + # other desktop (kdm and such scripts)
252 + exeinto /etc/X11/xinit/xinitrc.d
253 + doexe "${FILESDIR}"/80-dbus
254 + fi
255 +
256 + # needs to exist for dbus sessions to launch
257 + keepdir /usr/share/dbus-1/services
258 + keepdir /etc/dbus-1/{session,system}.d
259 + # machine-id symlink from pkg_postinst()
260 + keepdir /var/lib/dbus
261 + # let the init script create the /var/run/dbus directory
262 + rm -rf "${ED}"/var/run
263 +
264 + dodoc AUTHORS ChangeLog NEWS README doc/TODO
265 + readme.gentoo_create_doc
266 +
267 + find "${ED}" -name '*.la' -delete || die
268 +}
269 +
270 +pkg_postinst() {
271 + readme.gentoo_print_elog
272 +
273 + # Ensure unique id is generated and put it in /etc wrt #370451 but symlink
274 + # for DBUS_MACHINE_UUID_FILE (see tools/dbus-launch.c) and reverse
275 + # dependencies with hardcoded paths (although the known ones got fixed already)
276 + dbus-uuidgen --ensure="${EROOT}"/etc/machine-id
277 + ln -sf "${EPREFIX}"/etc/machine-id "${EROOT}"/var/lib/dbus/machine-id
278 +
279 + if [[ ${CHOST} == *-darwin* ]]; then
280 + local plist="org.freedesktop.dbus-session.plist"
281 + elog
282 + elog
283 + elog "For MacOS/Darwin we now ship launchd support for dbus."
284 + elog "This enables autolaunch of dbus at session login and makes"
285 + elog "dbus usable under MacOS/Darwin."
286 + elog
287 + elog "The launchd plist file ${plist} has been"
288 + elog "installed in ${EPREFIX}/Library/LaunchAgents."
289 + elog "For it to be used, you will have to do all of the following:"
290 + elog " + cd ~/Library/LaunchAgents"
291 + elog " + ln -s ${EPREFIX}/Library/LaunchAgents/${plist}"
292 + elog " + logout and log back in"
293 + elog
294 + elog "If your application needs a proper DBUS_SESSION_BUS_ADDRESS"
295 + elog "specified and refused to start otherwise, then export the"
296 + elog "the following to your environment:"
297 + elog " DBUS_SESSION_BUS_ADDRESS=\"launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET\""
298 + fi
299 +
300 + if use user-session; then
301 + ewarn "You have enabled user-session. Please note this can cause"
302 + ewarn "bogus behaviors in several dbus consumers that are not prepared"
303 + ewarn "for this dbus activation method yet."
304 + ewarn
305 + ewarn "See the following link for background on this change:"
306 + ewarn "https://lists.freedesktop.org/archives/systemd-devel/2015-January/027711.html"
307 + ewarn
308 + ewarn "Known issues are tracked here:"
309 + ewarn "https://bugs.gentoo.org/show_bug.cgi?id=576028"
310 + fi
311 +}
312
313 diff --git a/sys-apps/dbus/files/dbus.initd.in b/sys-apps/dbus/files/dbus.initd.in
314 new file mode 100644
315 index 00000000000..10c7201be47
316 --- /dev/null
317 +++ b/sys-apps/dbus/files/dbus.initd.in
318 @@ -0,0 +1,36 @@
319 +#!/sbin/openrc-run
320 +# Copyright 1999-2019 Gentoo Authors
321 +# Distributed under the terms of the GNU General Public License, v2 or later
322 +
323 +extra_started_commands="reload"
324 +
325 +description="An IPC message bus daemon"
326 +pidfile="@rundir@/dbus.pid"
327 +command="/usr/bin/dbus-daemon"
328 +command_args="--system"
329 +
330 +dbus_socket="@rundir@/dbus/system_bus_socket"
331 +
332 +depend() {
333 + need localmount
334 + after bootmisc
335 +}
336 +
337 +start_pre() {
338 + /usr/bin/dbus-uuidgen --ensure=/etc/machine-id
339 +
340 + # We need to test if /var/run/dbus exists, since script will fail if it does not
341 + checkpath -q -d "@rundir@/dbus"
342 +}
343 +
344 +stop_post() {
345 + [ ! -S "${dbus_socket}" ] || rm -f "${dbus_socket}"
346 +}
347 +
348 +reload() {
349 + ebegin "Reloading D-BUS messagebus config"
350 + dbus-send --print-reply --system --type=method_call \
351 + --dest=org.freedesktop.DBus \
352 + / org.freedesktop.DBus.ReloadConfig > /dev/null
353 + eend $?
354 +}