public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/3] tmpfiles.eclass: Support using on non-Linux systems
@ 2017-04-30 19:06 Michał Górny
  2017-04-30 19:06 ` [gentoo-dev] [PATCH 2/3] tmpfiles.eclass: Explicit warn on ROOT != / to avoid breakage Michał Górny
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Michał Górny @ 2017-04-30 19:06 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Fix the eclass code to remove the misguided Linux conditionals.
The whole purpose of the eclass was to avoid having to implement
fallback logic for systems not having service manager tmpfiles.d
support. Making it conditional to Linux implied that for non-Linux
systems (Prefix, FreeBSD) we would have to implement explicit fallback
to create the necessary directories.

While systemd (and therefore systemd-tmpfilesd) is indeed
Linux-specific, the opentmpfiles implementation should be pretty
portable and there is no reason to restrict it to Linux only, or to
prevent using it on non-Linux OpenRC (and non-OpenRC) systems.
---
 eclass/tmpfiles.eclass | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/eclass/tmpfiles.eclass b/eclass/tmpfiles.eclass
index 2a158c482a58..9cf040de987f 100644
--- a/eclass/tmpfiles.eclass
+++ b/eclass/tmpfiles.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: tmpfiles.eclass
@@ -17,10 +17,16 @@
 # https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html
 #
 # The dotmpfiles and newtmpfiles functions are used to install
-# configuration files into /usr/lib/tmpfiles.d, then in pkg_postinst, the
-# tmpfiles_process function can be called to process the newly
+# configuration files into /usr/lib/tmpfiles.d, then in pkg_postinst,
+# the tmpfiles_process function must be called to process the newly
 # installed tmpfiles.d entries.
 #
+# The tmpfiles.d files can be used by service managers to recreate/clean
+# up temporary directories on boot or periodically. Additionally,
+# the pkg_postinst() call ensures that the directories are created
+# on systems that do not support tmpfiles.d natively, without a need
+# for explicit fallback.
+#
 # @EXAMPLE:
 # Typical usage of this eclass:
 #
@@ -53,7 +59,7 @@ case "${EAPI}" in
 *) die "API is undefined for EAPI ${EAPI}" ;;
 esac
 
-RDEPEND="kernel_linux? ( virtual/tmpfiles )"
+RDEPEND="virtual/tmpfiles"
 
 # @FUNCTION: dotmpfiles
 # @USAGE: dotmpfiles <tmpfiles.d_file> ...
@@ -62,7 +68,6 @@ RDEPEND="kernel_linux? ( virtual/tmpfiles )"
 dotmpfiles() {
 	debug-print-function "${FUNCNAME}" "$@"
 
-	use kernel_linux || return 0
 	local f
 	for f; do
 		if [[ ${f} != *.conf ]]; then
@@ -83,7 +88,6 @@ dotmpfiles() {
 newtmpfiles() {
 	debug-print-function "${FUNCNAME}" "$@"
 
-	use kernel_linux || return 0
 	if [[ $2 != *.conf ]]; then
 		die "tmpfiles.d files must end with .conf"
 	fi
@@ -102,7 +106,6 @@ newtmpfiles() {
 tmpfiles_process() {
 	debug-print-function "${FUNCNAME}" "$@"
 
-	use kernel_linux || return 0
 	[[ ${EBUILD_PHASE} == postinst ]] || die "${FUNCNAME}: Only valid in pkg_postinst"
 	[[ ${#} -gt 0 ]] || die "${FUNCNAME}: Must specify at least one filename"
 
-- 
2.13.0.rc1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-05-02 16:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-30 19:06 [gentoo-dev] [PATCH 1/3] tmpfiles.eclass: Support using on non-Linux systems Michał Górny
2017-04-30 19:06 ` [gentoo-dev] [PATCH 2/3] tmpfiles.eclass: Explicit warn on ROOT != / to avoid breakage Michał Górny
2017-04-30 19:06 ` [gentoo-dev] [PATCH 3/3] app-portage/eix: Convert to tmpfiles.eclass (example) Michał Górny
2017-05-02 14:38 ` [gentoo-dev] [PATCH 1/3] tmpfiles.eclass: Support using on non-Linux systems William Hubbs
2017-05-02 14:56   ` Michał Górny
2017-05-02 16:21   ` Mike Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox