1 |
Please link to documentation on keepdir (e.g. |
2 |
https://devmanual.gentoo.org/function-reference/install-functions/index.html) |
3 |
in the helper? |
4 |
|
5 |
I'm not sure there is better keepdir document? |
6 |
|
7 |
Also looking at https://devmanual.gentoo.org/eclass-reference/ebuild/ |
8 |
|
9 |
It says "keepdir functions the same as dodir" but this has not been true |
10 |
for a while? |
11 |
|
12 |
-A |
13 |
|
14 |
|
15 |
|
16 |
On Wed, Jan 10, 2018 at 11:48 AM, Michał Górny <mgorny@g.o> wrote: |
17 |
|
18 |
> Remove empty directories in install-qa-check phase in order to prevent |
19 |
> Portage from installing them, and therefore from developers relying |
20 |
> on them being installed. |
21 |
> |
22 |
> The PMS specifies the behavior upon merging empty directories |
23 |
> as undefined, and specifically prohibits ebuilds from attempting |
24 |
> to install empty directories. However, ebuilds occasionally still fall |
25 |
> into the trap of relying on 'dodir' preserving the directory. Make |
26 |
> the Portage behavior more strict in order to prevent that. |
27 |
> |
28 |
> Use 'install-qa-check.d' machinery for this as this provides an easy way |
29 |
> for users to restore the old behavior (by overriding the check) if they |
30 |
> need it for their private ebuilds. It also makes it possible to extend |
31 |
> the check with some QA warnings, if we figure out how to do them. |
32 |
> |
33 |
> Currently no QA warnings are emitted as we do not want to pursue |
34 |
> upstream build systems that create empty directories but the packages |
35 |
> themselves do not rely on them being installed, e.g. when some files |
36 |
> are installed into the directory conditionally. |
37 |
> --- |
38 |
> bin/install-qa-check.d/95empty-dirs | 21 +++++++++++++++++++++ |
39 |
> 1 file changed, 21 insertions(+) |
40 |
> create mode 100644 bin/install-qa-check.d/95empty-dirs |
41 |
> |
42 |
> diff --git a/bin/install-qa-check.d/95empty-dirs b/bin/install-qa-check.d/ |
43 |
> 95empty-dirs |
44 |
> new file mode 100644 |
45 |
> index 000000000..6b8790f59 |
46 |
> --- /dev/null |
47 |
> +++ b/bin/install-qa-check.d/95empty-dirs |
48 |
> @@ -0,0 +1,21 @@ |
49 |
> +# Remove empty directories installed by ebuild. |
50 |
> + |
51 |
> +# Rationale: PMS prohibits ebuilds from installing empty directories. |
52 |
> +# Cleaning them up from the installation image provides an easy way |
53 |
> +# to make sure that ebuilds are not relying on it while making it easy |
54 |
> +# for users to override this if they need to. |
55 |
> +# |
56 |
> +# Technically, we could emit QA warnings here. However, we do not want |
57 |
> +# to pursue every upstream build system that creates a directory |
58 |
> +# and does not install any file into it (think of files installed |
59 |
> +# conditionally), as long as the package functions correctly without |
60 |
> +# the directory being actually installed. |
61 |
> + |
62 |
> +strip_empty_dirs() { |
63 |
> + find "${ED}" -mindepth 1 -type d -empty -delete |
64 |
> +} |
65 |
> + |
66 |
> +strip_empty_dirs |
67 |
> +: # guarantee successful exit |
68 |
> + |
69 |
> +# vim:ft=sh |
70 |
> -- |
71 |
> 2.16.0.rc1 |
72 |
> |
73 |
> |
74 |
> |