blob: 5ef56885ebe7ab4294b557d56b4c6c354eb3fdce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# 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
# (We use this glob to avoid triggering on keepdir)
shopt -s nullglob
local files=( "${ED}"/etc/tmpfiles.d/*.conf )
shopt -u nullglob
if [[ ${#files[@]} -gt 0 ]]; 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
|