Gentoo Archives: gentoo-portage-dev

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

Replies