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 A5595158F57 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 6725FE0B1E; Mon, 16 Aug 2021 02:12:23 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 4D215E0B1E for ; Mon, 16 Aug 2021 02:12:23 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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 E7AC33458C0 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 560928B2 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: <1629079929.f653e0b5ff5620e852e5fbbd23d62fa3577f2a7d.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: f653e0b5ff5620e852e5fbbd23d62fa3577f2a7d 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: ce6f7f61-966d-463a-a68c-45e85525ddd7 X-Archives-Hash: d4ea702f511ee422425866b77151fd0c commit: f653e0b5ff5620e852e5fbbd23d62fa3577f2a7d Author: Georgy Yakovlev gentoo org> AuthorDate: Fri Aug 13 01:52:38 2021 +0000 Commit: Sam James gentoo org> CommitDate: Mon Aug 16 02:12:09 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f653e0b5 metadata/install-qa-check.d: add check for missing tmpfiles_process call See: https://archives.gentoo.org/gentoo-dev/message/7bdfdc9a7560fd07436defd0253af0b8 Signed-off-by: Georgy Yakovlev gentoo.org> Signed-off-by: Sam James gentoo.org> metadata/install-qa-check.d/60tmpfiles-paths | 34 ++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/metadata/install-qa-check.d/60tmpfiles-paths b/metadata/install-qa-check.d/60tmpfiles-paths index 81286de584a..aa666dfb7ce 100644 --- a/metadata/install-qa-check.d/60tmpfiles-paths +++ b/metadata/install-qa-check.d/60tmpfiles-paths @@ -3,11 +3,14 @@ # QA check: ensure that packages installing tmpfiles configuration inherit the eclass # Maintainer: Sam James +# Maintainer: Georgy Yakovlev # 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) +# (needed for tmpfiles_process in pkg_postinst); +# 3) Check for installation of tmpfiles without calling tmpfiles_process in +# pkg_postinst. tmpfiles_check() { # Check 1 # Scan image for files in /etc/tmpfiles.d which is a forbidden location @@ -17,30 +20,41 @@ tmpfiles_check() { 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!" + eqawarn "QA Notice: files installed to /etc/tmpfiles.d found" + eqawarn "tmpfiles configuration files supplied by ebuilds must be installed to /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 - # It's okay for some packages to do this because of circular dependencies and such # See: https://archives.gentoo.org/gentoo-dev/message/0a96793036a4fdd9ac311a46950d7e7b # TODO: Standardize some way of allowing ebuilds to opt-out of checks like this local package=${CATEGORY}/${PN} + if [[ ${package} == "sys-apps/systemd" || ${package} == "sys-libs/pam" ]] ; 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." + if ! has tmpfiles ${INHERITED} ; 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." + return + fi + + # Check 3 + # Check whether we're installing tmpfiles without explicitly + # calling tmpfiles_process in pkg_postinst, but we have inherited + # the eclass. + # Small risk of false positives if called indirectly. + # See: https://archives.gentoo.org/gentoo-dev/message/7bdfdc9a7560fd07436defd0253af0b8 + local pkg_postinst_body="$(declare -fp pkg_postinst 2>&1)" + if [[ ! ${pkg_postinst_body} == *tmpfiles_process* ]] ; then + eqawarn "QA Notice: package is installing tmpfiles without calling" + eqawarn "tmpfiles_process in pkg_postinst phase" + fi fi }