1 |
This adds two tmpfiles related QA checks: |
2 |
1) Verify packages don't install tmpfiles to /etc/tmpfiles.d, which |
3 |
is a forbidden (user-configuration) location; |
4 |
|
5 |
2) Check whether packages inherit tmpfiles.eclass if they're |
6 |
installing files to /usr/lib/tmpfiles.d. |
7 |
|
8 |
(This helps to catch packages not calling tmpfiles_process |
9 |
in pkg_postinst). |
10 |
|
11 |
Signed-off-by: Sam James <sam@g.o> |
12 |
--- |
13 |
metadata/install-qa-check.d/60tmpfiles-paths | 37 ++++++++++++++++++++ |
14 |
1 file changed, 37 insertions(+) |
15 |
create mode 100644 metadata/install-qa-check.d/60tmpfiles-paths |
16 |
|
17 |
diff --git a/metadata/install-qa-check.d/60tmpfiles-paths b/metadata/install-qa-check.d/60tmpfiles-paths |
18 |
new file mode 100644 |
19 |
index 000000000000..ed0bdbff8cd5 |
20 |
--- /dev/null |
21 |
+++ b/metadata/install-qa-check.d/60tmpfiles-paths |
22 |
@@ -0,0 +1,37 @@ |
23 |
+# Copyright 2021 Gentoo Authors |
24 |
+# Distributed under the terms of the GNU General Public License v2 |
25 |
+ |
26 |
+# QA check: ensure that packages installing tmpfiles configuration inherit the eclass |
27 |
+# Maintainer: Sam James <sam@g.o> |
28 |
+ |
29 |
+# Implements two checks: |
30 |
+# 1) Installation to /etc/tmpfiles.d (which is a user-customization location); |
31 |
+# 2) Installation of any tmpfiles to /usr/lib/tmpfiles.d without inheriting the eclass |
32 |
+# (needed for tmpfiles_process in pkg_postinst) |
33 |
+tmpfiles_check() { |
34 |
+ # Check 1 |
35 |
+ # Scan image for files in /etc/tmpfiles.d which is a forbidden location |
36 |
+ if [[ -d "${ED}"/etc/tmpfiles.d/ ]] ; then |
37 |
+ eqawarn "QA Notice: files installed to /etc/tmpfiles.d" |
38 |
+ eqawarn "tmpfiles configuration files must be installed by ebuilds /usr/lib/tmpfiles.d!" |
39 |
+ fi |
40 |
+ |
41 |
+ # Check 2 |
42 |
+ # We're now going to check for whether we install files to /usr/lib/tmpfiles.d without |
43 |
+ # inheriting the eclass (weak catch for ebuilds not calling tmpfiles_process in pkg_postinst) |
44 |
+ |
45 |
+ # No need to carry on if we're inheriting the eclass |
46 |
+ if has tmpfiles ${INHERITED} ; then |
47 |
+ return |
48 |
+ fi |
49 |
+ |
50 |
+ if [[ -d "${ED}"/usr/lib/tmpfiles.d/ ]] ; then |
51 |
+ eqawarn "QA Notice: package is installing tmpfiles without inheriting tmpfiles.eclass!" |
52 |
+ eqawarn "Packages must inherit tmpfiles.eclass then call tmpfiles_process in pkg_postinst." |
53 |
+ fi |
54 |
+} |
55 |
+ |
56 |
+tmpfiles_check |
57 |
+: # guarantee successful exit |
58 |
+ |
59 |
+# vim:ft=sh |
60 |
-- |
61 |
2.32.0 |