Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o, Andrew Savchenko <bircoph@g.o>
Subject: Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies"
Date: Sun, 26 Aug 2018 07:39:27
Message-Id: 1535269158.1066.1.camel@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH] Add section about defining "Test Dependencies" by Zac Medico
1 On Sun, 2018-08-26 at 00:28 -0700, Zac Medico wrote:
2 > On 08/25/2018 07:11 PM, Andrew Savchenko wrote:
3 > > On Sat, 25 Aug 2018 14:24:02 -0400 Mike Gilbert wrote:
4 > > > On Sat, Aug 25, 2018 at 1:41 AM Andrew Savchenko <bircoph@g.o> wrote:
5 > > > >
6 > > > > On Fri, 24 Aug 2018 14:24:06 -0400 Mike Gilbert wrote:
7 > > > > > ---
8 > > > > > general-concepts/dependencies/text.xml | 38 ++++++++++++++++++++++++++
9 > > > > > 1 file changed, 38 insertions(+)
10 > > > > >
11 > > > > > diff --git a/general-concepts/dependencies/text.xml b/general-concepts/dependencies/text.xml
12 > > > > > index 2f10380..64be9dc 100644
13 > > > > > --- a/general-concepts/dependencies/text.xml
14 > > > > > +++ b/general-concepts/dependencies/text.xml
15 > > > > > @@ -578,6 +578,44 @@ valid.
16 > > > > > </body>
17 > > > > > </section>
18 > > > > >
19 > > > > > +<section>
20 > > > > > +<title>Test Dependencies</title>
21 > > > > > +<body>
22 > > > > > +
23 > > > > > +<p>
24 > > > > > +Packages often have optional dependencies that are needed only when running
25 > > > > > +tests. These should be specified in DEPEND behind a USE flag. Often, the
26 > > > > > +'test' USE flag is used for this purpose.
27 > > > > > +</p>
28 > > > > > +
29 > > > > > +<p>
30 > > > > > +Since testing will likely fail when test dependencies are not installed, the
31 > > > > > +test phase should be disabled in this case. This may be accomplished via USE
32 > > > > > +conditionals in the RESTRICT variable.
33 > > > > > +</p>
34 > > > > > +
35 > > > > > +<p>
36 > > > > > +If other optional features must be enabled/disabled when testing, REQUIRED_USE
37 > > > > > +may be set to express this.
38 > > > > > +</p>
39 > > > > > +
40 > > > > > +<codesample lang="ebuild">
41 > > > > > +# Define some USE flags
42 > > > > > +IUSE="debug test"
43 > > > > > +
44 > > > > > +# Disable test phase when test USE flag is disabled
45 > > > > > +RESTRICT="!test? ( test )"
46 > > > >
47 > > > > I do not understand why we need this useless code. If test USE flag
48 > > > > is disabled, tests must be disabled as well. It is PM's job and
49 > > > > there is no need to put this obvious stuff into each ebuild with
50 > > > > tests and extra deps. I see no reason to support running src_test()
51 > > > > with USE="-test".
52 > > >
53 > > > PMS does not specify that behavior (skipping src_test with USE=-test).
54 > > > It is better to define the requrement explicitly rather than relying
55 > > > on a Portage-specific behavior.
56 > >
57 > > Then PMS should be fixed. Putting useless code in thousands
58 > > of ebuilds due to bureaucratic reasons is ridiculous. Having strict
59 > > conformance to the PMS is good, but common sense should still be
60 > > considered.
61 >
62 > Since PMS doesn't specify the behavior of FEATURES, I suppose we could
63 > make FEATURES=test imply RESTRICT="!test? ( test )". Would there be any
64 > drawbacks to that?
65
66 Except for Portage once again silently letting developers pass with non-
67 PMS behavior, and making other PMs fail with the ebuilds?
68
69 --
70 Best regards,
71 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies