From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH 1/2] Support post-postinst QA checks
Date: Tue, 15 Aug 2017 12:31:59 +0200 [thread overview]
Message-ID: <20170815103200.15680-1-mgorny@gentoo.org> (raw)
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):
--
2.14.1
next reply other threads:[~2017-08-15 10:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-15 10:31 Michał Górny [this message]
2017-08-15 10:32 ` [gentoo-portage-dev] [PATCH 2/2] Add post-postinst checks for a few missed cache updates Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170815103200.15680-1-mgorny@gentoo.org \
--to=mgorny@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox