Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/
Date: Sat, 29 Nov 2014 22:48:56
Message-Id: 1417301310.eff62fff0599e09f0dce5f3ef4527416044e4910.mgorny@gentoo
1 commit: eff62fff0599e09f0dce5f3ef4527416044e4910
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Nov 22 23:05:13 2014 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sat Nov 29 22:48:30 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=eff62fff
7
8 Support all install-qa-check.d locations and overrides
9
10 Update the install-qa-check.d handling code to conform to GLEP 65.
11 Collect files from all defined locations, order them lexically by name
12 and run each uniquely named script once. Make scripts in higher priority
13 locations override lower priority locations properly.
14
15 ---
16 bin/misc-functions.sh | 65 ++++++++++++++++++++++++++++++++++-----------------
17 1 file changed, 43 insertions(+), 22 deletions(-)
18
19 diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
20 index 8d5df78..e08c228 100755
21 --- a/bin/misc-functions.sh
22 +++ b/bin/misc-functions.sh
23 @@ -163,40 +163,61 @@ prepcompress() {
24 }
25
26 install_qa_check() {
27 - local f i qa_var x
28 + local d f i qa_var x paths qa_checks=() checks_run=()
29 if ! ___eapi_has_prefix_variables; then
30 local EPREFIX= ED=${D}
31 fi
32
33 cd "${ED}" || die "cd failed"
34
35 - # Run QA checks from install-qa-check.d.
36 - # Note: checks need to be run *before* stripping.
37 - local f
38 - # TODO: handle nullglob-like
39 - for f in "${PORTAGE_BIN_PATH}"/install-qa-check.d/*; do
40 - # Run in a subshell to treat it like external script,
41 - # but use 'source' to pass all variables through.
42 - (
43 - source "${f}" || eerror "Post-install QA check ${f##*/} failed to run"
44 + # Collect the paths for QA checks, highest prio first.
45 + paths=(
46 + # sysadmin overrides
47 + "${PORTAGE_OVERRIDE_EPREFIX}"/usr/local/lib/install-qa-check.d
48 + # system-wide package installs
49 + "${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/install-qa-check.d
50 + )
51 +
52 + # Now repo-specific checks.
53 + # (yes, PORTAGE_ECLASS_LOCATIONS contains repo paths...)
54 + for d in "${PORTAGE_ECLASS_LOCATIONS[@]}"; do
55 + paths+=(
56 + "${d}"/metadata/install-qa-check.d
57 )
58 done
59
60 - # Run QA checks from repositories
61 - # (yes, PORTAGE_ECLASS_LOCATIONS contains repo paths...)
62 - local repo_location
63 - for repo_location in "${PORTAGE_ECLASS_LOCATIONS[@]}"; do
64 - for f in "${repo_location}"/metadata/install-qa-check.d/*; do
65 - if [[ -f ${f} ]]; then
66 - (
67 - # allow inheriting eclasses
68 - _IN_INSTALL_QA_CHECK=1
69 - source "${f}" || eerror "Post-install QA check ${f##*/} failed to run"
70 - )
71 - fi
72 + paths+=(
73 + # Portage built-in checks
74 + "${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/portage/install-qa-check.d
75 + "${PORTAGE_BIN_PATH}"/install-qa-check.d
76 + )
77 +
78 + # Collect file names of QA checks. We need them early to support
79 + # overrides properly.
80 + for d in "${paths[@]}"; do
81 + for f in "${d}"/*; do
82 + [[ -f ${f} ]] && qa_checks+=( "${f##*/}" )
83 done
84 done
85
86 + # Now we need to sort the filenames lexically, and process
87 + # them in order.
88 + while read -r -d '' f; do
89 + # Find highest priority file matching the basename.
90 + for d in "${paths[@]}"; do
91 + [[ -f ${d}/${f} ]] && break
92 + done
93 +
94 + # Run in a subshell to treat it like external script,
95 + # but use 'source' to pass all variables through.
96 + (
97 + # Allow inheriting eclasses.
98 + # XXX: we want this only in repository-wide checks.
99 + _IN_INSTALL_QA_CHECK=1
100 + source "${d}/${f}" || eerror "Post-install QA check ${f} failed to run"
101 + )
102 + done < <(printf "%s\0" "${qa_checks[@]}" | LC_ALL=C sort -u -z)
103 +
104 export STRIP_MASK
105 prepall
106 ___eapi_has_docompress && prepcompress