public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* [gentoo-dev] new tmpfiles-d.eclass (v2)
@ 2012-08-16 19:41 99% Sergei Trofimovich
  0 siblings, 0 replies; 1+ results
From: Sergei Trofimovich @ 2012-08-16 19:41 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny


[-- Attachment #1.1: Type: text/plain, Size: 971 bytes --]

Second attempt to bring basic tmpfiles.d support to the tree.

The first one:
http://www.mail-archive.com/gentoo-dev@lists.gentoo.org/msg52059.html

Changed since:

- eclass tmpfilesd.eclass renamed to tmpfiles-d.eclass
- {do,new}tmpfilesd renamed to {do,new}tmpfiles_d
- systemd.eclass now uses tmpfiles-d.eclass as it was
  the donor of one of functions:
 systemd_dotmpfilesd() {
        debug-print-function ${FUNCNAME} "${@}"
 
-       (
-               insinto /usr/lib/tmpfiles.d/
-               doins "${@}"
-       )
+       dotmpfiles_d "${@}"
 }

I've found only one user of systemd_dotmpfilesd:
media-sound/teamspeak-server-bin which can be just
converted to use shorter wrapper if needed.

And systemd ebuild does the same by hands (i guess
can be converted):
        # Create /run/lock as required by new baselay/OpenRC compat.
        insinto /usr/lib/tmpfiles.d
        doins "${FILESDIR}"/gentoo-run.conf

-- 

  Sergei

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: tmpfiles-d.eclass.patch --]
[-- Type: text/x-patch, Size: 2903 bytes --]

Index: eclass/systemd.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/systemd.eclass,v
retrieving revision 1.11
diff -u -u -r1.11 systemd.eclass
--- eclass/systemd.eclass	7 Jan 2012 17:53:47 -0000	1.11
+++ eclass/systemd.eclass	16 Aug 2012 19:06:21 -0000
@@ -25,6 +25,8 @@
 # }
 # @CODE
 
+inherit tmpfiles-d
+
 case ${EAPI:-0} in
 	0|1|2|3|4) ;;
 	*) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
@@ -89,10 +91,7 @@
 systemd_dotmpfilesd() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	(
-		insinto /usr/lib/tmpfiles.d/
-		doins "${@}"
-	)
+	dotmpfiles_d "${@}"
 }
 
 # @FUNCTION: systemd_enable_service
Index: eclass/tmpfiles-d.eclass
===================================================================
RCS file: eclass/tmpfiles-d.eclass
diff -N eclass/tmpfiles-d.eclass
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ eclass/tmpfiles-d.eclass	16 Aug 2012 19:06:21 -0000
@@ -0,0 +1,57 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header:  $
+
+# @ECLASS: tmpfilesd.eclass
+# @MAINTAINER:
+# slyfox@gentoo.org
+# @AUTHOR:
+# Based on bash-completion-r1.eclass by Michał Górny <mgorny@gentoo.org>.
+# @BLURB: Helpers to install tmpfiles.d files.
+# @DESCRIPTION:
+# As described in http://0pointer.de/public/systemd-man/tmpfiles.d.html
+# helpers allow installing package's tmpfiles.d into /usr/lib/tmpfiles.d
+# @EXAMPLE:
+#
+# @CODE
+# EAPI=4
+#
+# src_install() {
+# 	default
+#
+# 	newtmpfiles_d ${FILESDIR}/tmpfilesd.conf ${PN}.conf
+# }
+# @CODE
+
+case ${EAPI:-0} in
+	0|1|2|3|4) ;;
+	*) die "EAPI ${EAPI} is unknown."
+esac
+
+# @FUNCTION: dotmpfiles_d
+# @USAGE: file [...]
+# @DESCRIPTION:
+# Install tmpfiles.d files passed as args. Has EAPI-dependant failure
+# behavior (like doins).
+dotmpfiles_d() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	(
+		insinto /usr/lib/tmpfiles.d
+		doins "${@}"
+	)
+}
+
+# @FUNCTION: newtmpfilesd
+# @USAGE: file newname
+# @DESCRIPTION:
+# Install tmpfiles.d file under a new name. Has EAPI-dependant failure
+# behavior (like newins).
+newtmpfiles_d() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	(
+		insinto /usr/lib/tmpfiles.d
+		newins "${@}"
+	)
+}
--- net-ftp/proftpd/proftpd-1.3.4a-r1.ebuild	2012-05-29 20:16:51.806921163 +0300
+++ net-ftp/proftpd/proftpd-1.3.4a-r2.ebuild	2012-08-16 22:02:41.146331472 +0300
@@ -3,7 +3,7 @@
 # $Header: /var/cvsroot/gentoo-x86/net-ftp/proftpd/proftpd-1.3.4a-r1.ebuild,v 1.2 2012/05/13 10:49:47 swift Exp $
 
 EAPI=4
-inherit eutils
+inherit eutils tmpfiles-d
 
 MOD_CASE="0.7"
 MOD_CLAMAV="0.11rc"
@@ -216,6 +216,8 @@
 		docinto rfc
 		dodoc doc/rfc/*.txt
 	fi
+
+	newtmpfiles_d ${FILESDIR}/tmpfilesd.conf ${PN}.conf
 }
 
 pkg_postinst() {

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2012-08-16 19:41 99% [gentoo-dev] new tmpfiles-d.eclass (v2) Sergei Trofimovich

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