From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-1050517-garchives=archives.gentoo.org@lists.gentoo.org> 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 BD11E138334 for <garchives@archives.gentoo.org>; Sat, 6 Oct 2018 08:35:48 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9CB38E08C4; Sat, 6 Oct 2018 08:35:47 +0000 (UTC) Received: from smtp.gentoo.org (dev.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 557A0E08C4 for <gentoo-commits@lists.gentoo.org>; Sat, 6 Oct 2018 08:35:46 +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 57A0D335CE4 for <gentoo-commits@lists.gentoo.org>; Sat, 6 Oct 2018 08:35:45 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C44DD3D7 for <gentoo-commits@lists.gentoo.org>; Sat, 6 Oct 2018 08:35:42 +0000 (UTC) From: "Michał Górny" <mgorny@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" <mgorny@gentoo.org> Message-ID: <1538814933.67ffc42815419f5b33698f5739de321f6a6edd4a.mgorny@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/08gentoo-paths X-VCS-Directories: metadata/install-qa-check.d/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 67ffc42815419f5b33698f5739de321f6a6edd4a X-VCS-Branch: master Date: Sat, 6 Oct 2018 08:35:42 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 775df526-fc89-4d22-971e-c6c02e979727 X-Archives-Hash: fbf231dcde3c753819572fe22ab1e52a commit: 67ffc42815419f5b33698f5739de321f6a6edd4a Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Sat Oct 6 08:30:50 2018 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Sat Oct 6 08:35:33 2018 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=67ffc428 install-qa-check.d: Move 08gentoo-paths check outta Portage Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> Bug: https://bugs.gentoo.org/show_bug.cgi?id=667604 metadata/install-qa-check.d/08gentoo-paths | 77 ++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/metadata/install-qa-check.d/08gentoo-paths b/metadata/install-qa-check.d/08gentoo-paths new file mode 100644 index 00000000000..3ee887df08f --- /dev/null +++ b/metadata/install-qa-check.d/08gentoo-paths @@ -0,0 +1,77 @@ +# Check whether ebuilds are not installing new, non-Gentoo-ey paths. + +gentoo_path_check() { + # allowed path definitions + # ------------------------ + + # directories common to / and /usr + local allowed_common_dirs=( + bin lib lib32 lib64 libx32 sbin + ) + + # toplevel directories which can be installed to by ebuilds + # /home is not included as no ebuilds should install files there + local allowed_paths_toplevel=( + "${allowed_common_dirs[@]}" + boot dev etc opt srv usr var + ) + + # directories in /usr which can be installed to by ebuilds + # /usr/games is not included as it is banned nowadays + local allowed_paths_usr=( + "${allowed_common_dirs[@]}" + include libexec share src + # toolchain stuff + "${CHOST}" "${CTARGET}" + ) + + + # the logic + # --------- + local bad_paths=() + local x + + local shopt_save=$(shopt -p nullglob) + shopt -s nullglob + + # 1. check for unexpected top-level directories + local toplevel_dirs=( "${ED%/}"/* ) + for x in "${toplevel_dirs[@]##*/}"; do + if ! has "${x}" "${allowed_paths_toplevel[@]}"; then + bad_paths+=( "/${x}" ) + fi + done + + # 2. check for unexpected /usr subdirectories + local usr_dirs=( "${ED%/}"/usr/* ) + for x in "${usr_dirs[@]##*/}"; do + if ! has "${x}" "${allowed_paths_usr[@]}"; then + bad_paths+=( "/usr/${x}" ) + fi + done + + # 3. check for unexpected /usr/share/doc subdirectories + local doc_dirs=( "${ED%/}"/usr/share/doc/* ) + for x in "${doc_dirs[@]##*/}"; do + if [[ ${x} != ${PF} ]]; then + bad_paths+=( "/usr/share/doc/${x}" ) + fi + done + + ${shopt_save} + + # report + # ------ + if [[ -n ${bad_paths[@]} ]]; then + eqawarn "The ebuild is installing to one or more unexpected paths:" + eqawarn + eqatag -v non-gentoo-paths "${bad_paths[@]}" + eqawarn + eqawarn "Please fix the ebuild to use correct FHS/Gentoo policy paths." + fi +} + +gentoo_path_check +: # guarantee successful exit + +# vim:ft=sh