From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id DD796158F59 for ; Mon, 16 Aug 2021 20:48:22 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 262FFE0B14; Mon, 16 Aug 2021 02:12:23 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0A6DAE0A03 for ; Mon, 16 Aug 2021 02:12:22 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B40403458BE for ; Mon, 16 Aug 2021 02:12:21 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1A2FB7DE for ; Mon, 16 Aug 2021 02:12:20 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1629079926.c7fe1066a8fcd35f965de4ea16c9cd1001830642.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: metadata/install-qa-check.d/ X-VCS-Repository: repo/gentoo X-VCS-Files: metadata/install-qa-check.d/60tmpfiles-paths X-VCS-Directories: metadata/install-qa-check.d/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: c7fe1066a8fcd35f965de4ea16c9cd1001830642 X-VCS-Branch: master Date: Mon, 16 Aug 2021 02:12:20 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 90116ed7-7aa1-45db-9a5f-32b5a6c1bfe2 X-Archives-Hash: f236868a620b935a3c5cd95c51bef868 commit: c7fe1066a8fcd35f965de4ea16c9cd1001830642 Author: Sam James gentoo org> AuthorDate: Fri Aug 13 01:37:15 2021 +0000 Commit: Sam James gentoo org> CommitDate: Mon Aug 16 02:12:06 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c7fe1066 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 gentoo.org> metadata/install-qa-check.d/60tmpfiles-paths | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/metadata/install-qa-check.d/60tmpfiles-paths b/metadata/install-qa-check.d/60tmpfiles-paths new file mode 100644 index 00000000000..ed0bdbff8cd --- /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 + +# 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