* [gentoo-portage-dev] [PATCH 1/2] Run install-qa-check.d scripts from repositories
@ 2014-09-11 17:31 Michał Górny
2014-09-11 17:31 ` [gentoo-portage-dev] [PATCH 2/2] Allow inheriting utility eclasses in QA checks Michał Górny
0 siblings, 1 reply; 2+ messages in thread
From: Michał Górny @ 2014-09-11 17:31 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
---
(following the remaster of install_qa_check())
---
bin/misc-functions.sh | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index d701ba6..bd43360 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -182,6 +182,19 @@ install_qa_check() {
)
done
+ # Run QA checks from repositories
+ # (yes, PORTAGE_ECLASS_LOCATIONS contains repo paths...)
+ local repo_location
+ for repo_location in "${PORTAGE_ECLASS_LOCATIONS[@]}"; do
+ for f in "${repo_location}"/metadata/install-qa-check.d/*; do
+ if [[ -f ${f} ]]; then
+ (
+ source "${f}" || eerror "Post-install QA check ${f##*/} failed to run"
+ )
+ fi
+ done
+ done
+
export STRIP_MASK
prepall
___eapi_has_docompress && prepcompress
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-portage-dev] [PATCH 2/2] Allow inheriting utility eclasses in QA checks
2014-09-11 17:31 [gentoo-portage-dev] [PATCH 1/2] Run install-qa-check.d scripts from repositories Michał Górny
@ 2014-09-11 17:31 ` Michał Górny
0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2014-09-11 17:31 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
Allow inheriting utility eclasses for use in QA checks. The eclasses can
be used e.g. to obtain paths or other data needed for the check.
However, the eclasses must not export phases or set ebuild metadata.
---
bin/ebuild.sh | 131 ++++++++++++++++++++++++++------------------------
bin/misc-functions.sh | 2 +
2 files changed, 70 insertions(+), 63 deletions(-)
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index be044e0..b980caa 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -230,10 +230,10 @@ inherit() {
__export_funcs_var=__export_functions_$ECLASS_DEPTH
unset $__export_funcs_var
- if [ "${EBUILD_PHASE}" != "depend" ] && \
- [ "${EBUILD_PHASE}" != "nofetch" ] && \
- [[ ${EBUILD_PHASE} != *rm ]] && \
- [[ ${EMERGE_FROM} != "binary" ]] ; then
+ if [[ ${EBUILD_PHASE} != depend && ${EBUILD_PHASE} != nofetch && \
+ ${EBUILD_PHASE} != *rm && ${EMERGE_FROM} != "binary" && \
+ -z ${_IN_INSTALL_QA_CHECK} ]]
+ then
# This is disabled in the *rm phases because they frequently give
# false alarms due to INHERITED in /var/db/pkg being outdated
# in comparison the the eclasses from the portage tree. It's
@@ -256,70 +256,75 @@ inherit() {
debug-print "inherit: $1 -> $location"
[[ -z ${location} ]] && die "${1}.eclass could not be found by inherit()"
- #We need to back up the values of *DEPEND to B_*DEPEND
- #(if set).. and then restore them after the inherit call.
-
- #turn off glob expansion
- set -f
-
- # Retain the old data and restore it later.
- unset B_IUSE B_REQUIRED_USE B_DEPEND B_RDEPEND B_PDEPEND B_HDEPEND
- [ "${IUSE+set}" = set ] && B_IUSE="${IUSE}"
- [ "${REQUIRED_USE+set}" = set ] && B_REQUIRED_USE="${REQUIRED_USE}"
- [ "${DEPEND+set}" = set ] && B_DEPEND="${DEPEND}"
- [ "${RDEPEND+set}" = set ] && B_RDEPEND="${RDEPEND}"
- [ "${PDEPEND+set}" = set ] && B_PDEPEND="${PDEPEND}"
- [ "${HDEPEND+set}" = set ] && B_HDEPEND="${HDEPEND}"
- unset IUSE REQUIRED_USE DEPEND RDEPEND PDEPEND HDEPEND
- #turn on glob expansion
- set +f
+ # inherits in QA checks can't handle metadata assignments
+ if [[ -z ${_IN_INSTALL_QA_CHECK} ]]; then
+ #We need to back up the values of *DEPEND to B_*DEPEND
+ #(if set).. and then restore them after the inherit call.
+
+ #turn off glob expansion
+ set -f
+
+ # Retain the old data and restore it later.
+ unset B_IUSE B_REQUIRED_USE B_DEPEND B_RDEPEND B_PDEPEND B_HDEPEND
+ [ "${IUSE+set}" = set ] && B_IUSE="${IUSE}"
+ [ "${REQUIRED_USE+set}" = set ] && B_REQUIRED_USE="${REQUIRED_USE}"
+ [ "${DEPEND+set}" = set ] && B_DEPEND="${DEPEND}"
+ [ "${RDEPEND+set}" = set ] && B_RDEPEND="${RDEPEND}"
+ [ "${PDEPEND+set}" = set ] && B_PDEPEND="${PDEPEND}"
+ [ "${HDEPEND+set}" = set ] && B_HDEPEND="${HDEPEND}"
+ unset IUSE REQUIRED_USE DEPEND RDEPEND PDEPEND HDEPEND
+ #turn on glob expansion
+ set +f
+ fi
__qa_source "$location" || die "died sourcing $location in inherit()"
- #turn off glob expansion
- set -f
-
- # If each var has a value, append it to the global variable E_* to
- # be applied after everything is finished. New incremental behavior.
- [ "${IUSE+set}" = set ] && E_IUSE+="${E_IUSE:+ }${IUSE}"
- [ "${REQUIRED_USE+set}" = set ] && E_REQUIRED_USE+="${E_REQUIRED_USE:+ }${REQUIRED_USE}"
- [ "${DEPEND+set}" = set ] && E_DEPEND+="${E_DEPEND:+ }${DEPEND}"
- [ "${RDEPEND+set}" = set ] && E_RDEPEND+="${E_RDEPEND:+ }${RDEPEND}"
- [ "${PDEPEND+set}" = set ] && E_PDEPEND+="${E_PDEPEND:+ }${PDEPEND}"
- [ "${HDEPEND+set}" = set ] && E_HDEPEND+="${E_HDEPEND:+ }${HDEPEND}"
-
- [ "${B_IUSE+set}" = set ] && IUSE="${B_IUSE}"
- [ "${B_IUSE+set}" = set ] || unset IUSE
-
- [ "${B_REQUIRED_USE+set}" = set ] && REQUIRED_USE="${B_REQUIRED_USE}"
- [ "${B_REQUIRED_USE+set}" = set ] || unset REQUIRED_USE
-
- [ "${B_DEPEND+set}" = set ] && DEPEND="${B_DEPEND}"
- [ "${B_DEPEND+set}" = set ] || unset DEPEND
-
- [ "${B_RDEPEND+set}" = set ] && RDEPEND="${B_RDEPEND}"
- [ "${B_RDEPEND+set}" = set ] || unset RDEPEND
-
- [ "${B_PDEPEND+set}" = set ] && PDEPEND="${B_PDEPEND}"
- [ "${B_PDEPEND+set}" = set ] || unset PDEPEND
-
- [ "${B_HDEPEND+set}" = set ] && HDEPEND="${B_HDEPEND}"
- [ "${B_HDEPEND+set}" = set ] || unset HDEPEND
-
- #turn on glob expansion
- set +f
+ if [[ -z ${_IN_INSTALL_QA_CHECK} ]]; then
+ #turn off glob expansion
+ set -f
+
+ # If each var has a value, append it to the global variable E_* to
+ # be applied after everything is finished. New incremental behavior.
+ [ "${IUSE+set}" = set ] && E_IUSE+="${E_IUSE:+ }${IUSE}"
+ [ "${REQUIRED_USE+set}" = set ] && E_REQUIRED_USE+="${E_REQUIRED_USE:+ }${REQUIRED_USE}"
+ [ "${DEPEND+set}" = set ] && E_DEPEND+="${E_DEPEND:+ }${DEPEND}"
+ [ "${RDEPEND+set}" = set ] && E_RDEPEND+="${E_RDEPEND:+ }${RDEPEND}"
+ [ "${PDEPEND+set}" = set ] && E_PDEPEND+="${E_PDEPEND:+ }${PDEPEND}"
+ [ "${HDEPEND+set}" = set ] && E_HDEPEND+="${E_HDEPEND:+ }${HDEPEND}"
+
+ [ "${B_IUSE+set}" = set ] && IUSE="${B_IUSE}"
+ [ "${B_IUSE+set}" = set ] || unset IUSE
+
+ [ "${B_REQUIRED_USE+set}" = set ] && REQUIRED_USE="${B_REQUIRED_USE}"
+ [ "${B_REQUIRED_USE+set}" = set ] || unset REQUIRED_USE
+
+ [ "${B_DEPEND+set}" = set ] && DEPEND="${B_DEPEND}"
+ [ "${B_DEPEND+set}" = set ] || unset DEPEND
+
+ [ "${B_RDEPEND+set}" = set ] && RDEPEND="${B_RDEPEND}"
+ [ "${B_RDEPEND+set}" = set ] || unset RDEPEND
+
+ [ "${B_PDEPEND+set}" = set ] && PDEPEND="${B_PDEPEND}"
+ [ "${B_PDEPEND+set}" = set ] || unset PDEPEND
+
+ [ "${B_HDEPEND+set}" = set ] && HDEPEND="${B_HDEPEND}"
+ [ "${B_HDEPEND+set}" = set ] || unset HDEPEND
+
+ #turn on glob expansion
+ set +f
+
+ if [[ -n ${!__export_funcs_var} ]] ; then
+ for x in ${!__export_funcs_var} ; do
+ debug-print "EXPORT_FUNCTIONS: $x -> ${ECLASS}_$x"
+ declare -F "${ECLASS}_$x" >/dev/null || \
+ die "EXPORT_FUNCTIONS: ${ECLASS}_$x is not defined"
+ eval "$x() { ${ECLASS}_$x \"\$@\" ; }" > /dev/null
+ done
+ fi
+ unset $__export_funcs_var
- if [[ -n ${!__export_funcs_var} ]] ; then
- for x in ${!__export_funcs_var} ; do
- debug-print "EXPORT_FUNCTIONS: $x -> ${ECLASS}_$x"
- declare -F "${ECLASS}_$x" >/dev/null || \
- die "EXPORT_FUNCTIONS: ${ECLASS}_$x is not defined"
- eval "$x() { ${ECLASS}_$x \"\$@\" ; }" > /dev/null
- done
+ has $1 $INHERITED || export INHERITED="$INHERITED $1"
fi
- unset $__export_funcs_var
-
- has $1 $INHERITED || export INHERITED="$INHERITED $1"
shift
done
diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
index bd43360..cc652a9 100755
--- a/bin/misc-functions.sh
+++ b/bin/misc-functions.sh
@@ -189,6 +189,8 @@ install_qa_check() {
for f in "${repo_location}"/metadata/install-qa-check.d/*; do
if [[ -f ${f} ]]; then
(
+ # allow inheriting eclasses
+ _IN_INSTALL_QA_CHECK=1
source "${f}" || eerror "Post-install QA check ${f##*/} failed to run"
)
fi
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-11 17:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-11 17:31 [gentoo-portage-dev] [PATCH 1/2] Run install-qa-check.d scripts from repositories Michał Górny
2014-09-11 17:31 ` [gentoo-portage-dev] [PATCH 2/2] Allow inheriting utility eclasses in QA checks Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox