Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: William Hubbs <williamh@g.o>
Cc: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] new eclass: tmpfiles.eclass round 3
Date: Fri, 25 Nov 2016 08:46:15
Message-Id: 20161125094456.761480d5.mgorny@gentoo.org
In Reply to: [gentoo-dev] new eclass: tmpfiles.eclass round 3 by William Hubbs
1 On Wed, 16 Nov 2016 16:37:15 -0600
2 William Hubbs <williamh@g.o> wrote:
3
4 > # @FUNCTION: tmpfiles_process
5 > # @USAGE: tmpfiles_process <filename> <filename> ...
6 > # @DESCRIPTION:
7 > # Call a tmpfiles.d implementation to create new volatile and temporary
8 > # files and directories.
9 > # Specific files and directories can be listed, but if they are not, all
10 > # tmpfiles.d files will be processed.
11
12 This contradicts the code. And I'd prefer the code, since allowing
13 empty list will only encourage developers to be lazy, and I'm not
14 really convinced that unconditionally running every tmpfiles.d file
15 (esp. that user may be overriding some of them) at runtime is a good
16 idea.
17
18 > tmpfiles_process() {
19 > debug-print-function "${FUNCNAME}" "$@"
20 >
21 > [[ ${EBUILD_PHASE} == postinst ]] || die "${FUNCNAME}: Only valid in pkg_postinst"
22 > [[ ${#} -gt 0 ]] || die "${FUNCNAME}: Must specify at least one filename"
23 > [[ ${ROOT} == / ]] || return 0
24 >
25 > if type systemd-tmpfiles &> /dev/null; then
26 > systemd-tmpfiles --create "$@"
27 > elif type opentmptmpfiles &> /dev/null; then
28
29 You have double 'tmp' here.
30
31 > opentmpfiles --create "$@"
32 > fi
33 > }
34
35 Also, I'm wondering if we should have any specific error handling here.
36 Maybe we should ewarn if something fails? Mike?
37
38 Also, possibly 'else' branch with big fat warning if for some reason
39 dependencies are missing?
40
41 --
42 Best regards,
43 Michał Górny
44 <http://dev.gentoo.org/~mgorny/>