1 |
On 11/10/2017 04:36 PM, Damo Brisbane wrote: |
2 |
> |
3 |
> Re for...keepdir, I found removing it then the /var/log/fabio folders |
4 |
> were not getting created, so keeping it in there. |
5 |
|
6 |
You need to tell the ebuild to create that directory one way or another. |
7 |
The "dodir" function will create the directory, but without the ".keep" |
8 |
file inside of it. However that may be "illegal" in this case; see below. |
9 |
|
10 |
|
11 |
> http://www.calculate-linux.org/main/en/using_ebuild, says this of *keepdir*: |
12 |
> |
13 |
> *Creates (if necessary) a |.keep| file in the given directory so that it |
14 |
> isn't auto-cleaned. Never create a |.keep| file yourself. If Portage |
15 |
> changes how |keepdir| works, then creating the file yourself will break |
16 |
> the package.* |
17 |
|
18 |
To my knowledge, no package manager will remove a non-empty directory, |
19 |
nor will it remove anything that the package manager did not itself |
20 |
create. To me that raises a question: why would I ever want to keep |
21 |
around an (otherwise empty) directory that was created by the package |
22 |
manager? |
23 |
|
24 |
I found this, |
25 |
|
26 |
https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-15100013.2.2 |
27 |
|
28 |
which states |
29 |
|
30 |
Behaviour upon encountering an empty directory is undefined. Ebuilds |
31 |
must not attempt to install an empty directory. |
32 |
|
33 |
Certainly "keepdir" will make the directory non-empty, but with the |
34 |
additional (unwanted) side-effect that the directory won't be removed |
35 |
when the package is uninstalled. Thus "keepdir" doesn't seem like it was |
36 |
intended to address that technicality. So, I have two questions now... |
37 |
|
38 |
a) When would you want to use keepdir? |
39 |
|
40 |
b) What's the right way to prevent a directory from being empty? Touch |
41 |
a dummy file? |
42 |
|
43 |
and a meta-question, |
44 |
|
45 |
c) Seriously, empty directories are undefined behavior? |