public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH 1/3] tmpfiles.eclass: Support using on non-Linux systems
Date: Sun, 30 Apr 2017 21:06:53 +0200	[thread overview]
Message-ID: <20170430190655.9946-1-mgorny@gentoo.org> (raw)

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



             reply	other threads:[~2017-04-30 19:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-30 19:06 Michał Górny [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170430190655.9946-1-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox