Gentoo Archives: gentoo-dev

From: Mike Gilbert <floppym@g.o>
To: Gentoo Dev <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] Dealing with XDG directories in ebuild environment
Date: Tue, 28 Jan 2014 17:03:15
Message-Id: CAJ0EP42saDZCDY3T3zDDx6UVmOsH7rZx1md9jAX1SbzzX-eh3w@mail.gmail.com
In Reply to: Re: [gentoo-dev] Dealing with XDG directories in ebuild environment by Gilles Dartiguelongue
1 On Mon, Jan 27, 2014 at 6:02 PM, Gilles Dartiguelongue <eva@g.o> wrote:
2 > People are encouraged to provide a prototype implementation of such
3 > eclass in the previously mentioned bug report.
4 >
5
6 Ok, lets discuss the eclass approach here. The 4 variables we want to
7 deal with are:
8
9 XDG_DATA_HOME
10 XDG_CONFIG_HOME
11 XDG_CACHE_HOME
12 XDG_RUNTIME_DIR
13
14 I see basically 3 options:
15
16 Option 1: Create directories in ${T} and set the XDG variables to
17 these directories.
18
19 This is the approach used by gnome2-utils.eclass
20 (gnome2_environment_reset). This would need to be done in a "src"
21 phase so that the directories can be created with the right
22 permissions and owner. The src_prepare or src_configure phase would
23 work best here.
24
25 The new eclass would simply define a function that creates the
26 directories and exports the XDG variables, much like
27 gnome2_environment_reset.
28
29 Option 2: Set the variables to ${T}
30
31 This makes the timing a bit less important since we are not creating
32 new directories and do not need to worry about permissions so much. I
33 think this still needs to be done in a phase function to ensure that
34 ${T} is defined. However, this does not really work for
35 XDG_RUNTIME_DIR.
36
37 This would be implemented the same way as option 1, but without the mkdir call.
38
39 Option 3: Unset the variables
40
41 This should cause applications to default to locations under ${HOME}.
42 This could be done in global scope (unless I am overlooking something
43 in PMS), and so it would not require consumers to invoke anything
44 explicitly.
45
46 The eclass would basically be one unset statement.
47
48
49 Thoughts? I am leaning toward option 3, but if someone knows a reason
50 that will not work please speak up.

Replies