Please link to documentation on keepdir (e.g.
https://devmanual.gentoo.org/function-reference/install-functions/index.html)
in the helper?

I'm not sure there is better keepdir document?

Also looking at https://devmanual.gentoo.org/eclass-reference/ebuild/

It says "keepdir functions the same as dodir" but this has not been true
for a while?

-A



On Wed, Jan 10, 2018 at 11:48 AM, Michał Górny <mgo...@gentoo.org> wrote:

> Remove empty directories in install-qa-check phase in order to prevent
> Portage from installing them, and therefore from developers relying
> on them being installed.
>
> The PMS specifies the behavior upon merging empty directories
> as undefined, and specifically prohibits ebuilds from attempting
> to install empty directories. However, ebuilds occasionally still fall
> into the trap of relying on 'dodir' preserving the directory. Make
> the Portage behavior more strict in order to prevent that.
>
> Use 'install-qa-check.d' machinery for this as this provides an easy way
> for users to restore the old behavior (by overriding the check) if they
> need it for their private ebuilds. It also makes it possible to extend
> the check with some QA warnings, if we figure out how to do them.
>
> Currently no QA warnings are emitted as we do not want to pursue
> upstream build systems that create empty directories but the packages
> themselves do not rely on them being installed, e.g. when some files
> are installed into the directory conditionally.
> ---
>  bin/install-qa-check.d/95empty-dirs | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>  create mode 100644 bin/install-qa-check.d/95empty-dirs
>
> diff --git a/bin/install-qa-check.d/95empty-dirs b/bin/install-qa-check.d/
> 95empty-dirs
> new file mode 100644
> index 000000000..6b8790f59
> --- /dev/null
> +++ b/bin/install-qa-check.d/95empty-dirs
> @@ -0,0 +1,21 @@
> +# Remove empty directories installed by ebuild.
> +
> +# Rationale: PMS prohibits ebuilds from installing empty directories.
> +# Cleaning them up from the installation image provides an easy way
> +# to make sure that ebuilds are not relying on it while making it easy
> +# for users to override this if they need to.
> +#
> +# Technically, we could emit QA warnings here. However, we do not want
> +# to pursue every upstream build system that creates a directory
> +# and does not install any file into it (think of files installed
> +# conditionally), as long as the package functions correctly without
> +# the directory being actually installed.
> +
> +strip_empty_dirs() {
> +       find "${ED}" -mindepth 1 -type d -empty -delete
> +}
> +
> +strip_empty_dirs
> +: # guarantee successful exit
> +
> +# vim:ft=sh
> --
> 2.16.0.rc1
>
>
>

Reply via email to