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 F36271396D0 for ; Sat, 26 Aug 2017 21:18:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0B94F1FC00D; Sat, 26 Aug 2017 21:18:41 +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 C7DDE1FC006 for ; Sat, 26 Aug 2017 21:18:40 +0000 (UTC) Received: from pomiot (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 39BFC34180F; Sat, 26 Aug 2017 21:18:39 +0000 (UTC) Message-ID: <1503782315.919.0.camel@gentoo.org> Subject: Re: [gentoo-portage-dev] [PATCH v2 1/4] Support post-postinst QA checks From: =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?= To: gentoo-portage-dev@lists.gentoo.org Date: Sat, 26 Aug 2017 23:18:35 +0200 In-Reply-To: <20170816180914.11073-1-mgorny@gentoo.org> References: <20170816180914.11073-1-mgorny@gentoo.org> Organization: Gentoo Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.24.5 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: 6b27814c-78df-4aab-8136-c395f30717f8 X-Archives-Hash: 51afdf79182167cbf2255e62e40d5a71 W dniu śro, 16.08.2017 o godzinie 20∶09 +0200, użytkownik Michał Górny napisał: > Extend the QA check mechanics in Portage to support post-postinst QA > checks. They are like post-install QA checks, except they are run after > pkg_postinst(), and so they can be used to verify that necessary > postinst actions were performed (e.g. regenerating caches). > --- > bin/misc-functions.sh | 57 ++++++++++++++++++++++++++++++++++ > pym/portage/package/ebuild/doebuild.py | 5 ++- > 2 files changed, 61 insertions(+), 1 deletion(-) > > diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh > index 079369313..18cddea21 100755 > --- a/bin/misc-functions.sh > +++ b/bin/misc-functions.sh > @@ -256,6 +256,63 @@ install_qa_check() { > rm -f "${ED}"/usr/share/info/dir{,.gz,.bz2} || die "rm failed!" > } > > +postinst_qa_check() { > + local d f paths qa_checks=() > + if ! ___eapi_has_prefix_variables; then > + local EPREFIX= EROOT=${ROOT} > + fi > + > + cd "${EROOT}" || die "cd failed" > + > + # Collect the paths for QA checks, highest prio first. > + paths=( > + # sysadmin overrides > + "${PORTAGE_OVERRIDE_EPREFIX}"/usr/local/lib/postinst-qa-check.d > + # system-wide package installs > + "${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/postinst-qa-check.d > + ) > + > + # Now repo-specific checks. > + # (yes, PORTAGE_ECLASS_LOCATIONS contains repo paths...) > + for d in "${PORTAGE_ECLASS_LOCATIONS[@]}"; do > + paths+=( > + "${d}"/metadata/postinst-qa-check.d > + ) > + done > + > + paths+=( > + # Portage built-in checks > + "${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/portage/postinst-qa-check.d > + "${PORTAGE_BIN_PATH}"/postinst-qa-check.d > + ) > + > + # Collect file names of QA checks. We need them early to support > + # overrides properly. > + for d in "${paths[@]}"; do > + for f in "${d}"/*; do > + [[ -f ${f} ]] && qa_checks+=( "${f##*/}" ) > + done > + done > + > + # Now we need to sort the filenames lexically, and process > + # them in order. > + while read -r -d '' f; do > + # Find highest priority file matching the basename. > + for d in "${paths[@]}"; do > + [[ -f ${d}/${f} ]] && break > + done > + > + # Run in a subshell to treat it like external script, > + # but use 'source' to pass all variables through. > + ( > + # Allow inheriting eclasses. > + # XXX: we want this only in repository-wide checks. > + _IN_INSTALL_QA_CHECK=1 > + source "${d}/${f}" || eerror "Post-postinst QA check ${f} failed to run" > + ) > + done < <(printf "%s\0" "${qa_checks[@]}" | LC_ALL=C sort -u -z) > +} > + > install_mask() { > local root="$1" > shift > diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py > index 14d96f57c..ac697a763 100644 > --- a/pym/portage/package/ebuild/doebuild.py > +++ b/pym/portage/package/ebuild/doebuild.py > @@ -1738,7 +1738,10 @@ _post_phase_cmds = { > "preinst_sfperms", > "preinst_selinux_labels", > "preinst_suid_scan", > - ] > + ], > + > + "postinst" : [ > + "postinst_qa_check"], > } > > def _post_phase_userpriv_perms(mysettings): Merged now. -- Best regards, Michał Górny