1 |
commit: c674d07888a8b95b2f39a8bcdc7755e0b1560451 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jan 19 21:14:07 2020 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jan 22 03:05:44 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/policy-guide.git/commit/?id=c674d078 |
7 |
|
8 |
other-metadata: RESTRICT="!test? ( test )" |
9 |
|
10 |
Closes: https://bugs.gentoo.org/705892 |
11 |
Closes: https://github.com/gentoo/policy-guide/pull/9 |
12 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
13 |
|
14 |
other-metadata.rst | 31 +++++++++++++++++++++++++++++++ |
15 |
1 file changed, 31 insertions(+) |
16 |
|
17 |
diff --git a/other-metadata.rst b/other-metadata.rst |
18 |
index 61749cb..f05014b 100644 |
19 |
--- a/other-metadata.rst |
20 |
+++ b/other-metadata.rst |
21 |
@@ -63,4 +63,35 @@ those cases, using the explicit No_homepage marker at least makes it |
22 |
easy to identify such packages. |
23 |
|
24 |
|
25 |
+.. index:: |
26 |
+ single: restrict; test; USE=-test |
27 |
+ single: USE flags; test; restrict |
28 |
+ |
29 |
+RESTRICT=test for USE=-test |
30 |
+--------------------------- |
31 |
+:Source: QA |
32 |
+:Reported: by pkgcheck |
33 |
+ |
34 |
+Whenever the package uses ``test`` flag to control test prerequisites |
35 |
+(or another flag with a similar purpose), it must explicitly restrict |
36 |
+tests when the flag is unset. |
37 |
+ |
38 |
+*Example*:: |
39 |
+ |
40 |
+ IUSE="test" |
41 |
+ RESTRICT="!test? ( test )" |
42 |
+ |
43 |
+*Rationale*: contrary to common assumption, ``test`` flag is not special |
44 |
+and the package manager can execute tests when the flag is disabled. |
45 |
+The explicit restriction guarantees that tests will be skipped under |
46 |
+this circumstance, and they will not fail for users. |
47 |
+ |
48 |
+.. Note:: |
49 |
+ Technically there are packages that do not strictly require this |
50 |
+ restriction since they handle missing test prerequisites gracefully |
51 |
+ (e.g. by skipping the tests). However, we enforce the rule for all |
52 |
+ packages since omitting the restriction by mistake is much more |
53 |
+ common, and there is little harm in overspecifying it. |
54 |
+ |
55 |
+ |
56 |
.. _metadata invariance: https://projects.gentoo.org/pms/7/pms.html#x1-600007.1 |