summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2021-08-13 02:37:15 +0100
committerSam James <sam@gentoo.org>2021-08-16 03:12:06 +0100
commitc7fe1066a8fcd35f965de4ea16c9cd1001830642 (patch)
treed07c8c2a3a1c1041397f972dddf7466e3f0b812b /metadata/install-qa-check.d
parentdev-python/numpy: add 1.21.2 (diff)
downloadgentoo-c7fe1066a8fcd35f965de4ea16c9cd1001830642.tar.gz
gentoo-c7fe1066a8fcd35f965de4ea16c9cd1001830642.tar.bz2
gentoo-c7fe1066a8fcd35f965de4ea16c9cd1001830642.zip
metadata/install-qa-check.d: add 60tmpfiles-path QA check
This adds two tmpfiles related QA checks: 1) Verify packages don't install tmpfiles to /etc/tmpfiles.d, which is a forbidden (user-configuration) location; 2) Check whether packages inherit tmpfiles.eclass if they're installing files to /usr/lib/tmpfiles.d. (This helps to catch packages not calling tmpfiles_process in pkg_postinst). Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'metadata/install-qa-check.d')
-rw-r--r--metadata/install-qa-check.d/60tmpfiles-paths37
1 files changed, 37 insertions, 0 deletions
diff --git a/metadata/install-qa-check.d/60tmpfiles-paths b/metadata/install-qa-check.d/60tmpfiles-paths
new file mode 100644
index 000000000000..ed0bdbff8cd5
--- /dev/null
+++ b/metadata/install-qa-check.d/60tmpfiles-paths
@@ -0,0 +1,37 @@
+# Copyright 2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# QA check: ensure that packages installing tmpfiles configuration inherit the eclass
+# Maintainer: Sam James <sam@gentoo.org>
+
+# Implements two checks:
+# 1) Installation to /etc/tmpfiles.d (which is a user-customization location);
+# 2) Installation of any tmpfiles to /usr/lib/tmpfiles.d without inheriting the eclass
+# (needed for tmpfiles_process in pkg_postinst)
+tmpfiles_check() {
+ # Check 1
+ # Scan image for files in /etc/tmpfiles.d which is a forbidden location
+ if [[ -d "${ED}"/etc/tmpfiles.d/ ]] ; then
+ eqawarn "QA Notice: files installed to /etc/tmpfiles.d"
+ eqawarn "tmpfiles configuration files must be installed by ebuilds /usr/lib/tmpfiles.d!"
+ fi
+
+ # Check 2
+ # We're now going to check for whether we install files to /usr/lib/tmpfiles.d without
+ # inheriting the eclass (weak catch for ebuilds not calling tmpfiles_process in pkg_postinst)
+
+ # No need to carry on if we're inheriting the eclass
+ if has tmpfiles ${INHERITED} ; then
+ return
+ fi
+
+ if [[ -d "${ED}"/usr/lib/tmpfiles.d/ ]] ; then
+ eqawarn "QA Notice: package is installing tmpfiles without inheriting tmpfiles.eclass!"
+ eqawarn "Packages must inherit tmpfiles.eclass then call tmpfiles_process in pkg_postinst."
+ fi
+}
+
+tmpfiles_check
+: # guarantee successful exit
+
+# vim:ft=sh