1 |
commit: 2f01a9fdc68740642cca25c0fcc7f1d1fc14c0ee |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Oct 26 06:06:51 2017 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Oct 27 18:52:08 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=2f01a9fd |
7 |
|
8 |
postinst_qa_check: initialize preinst state (bug 635474) |
9 |
|
10 |
In order to prevent false-positives during postinst_qa_check, |
11 |
use a preinst_qa_check function to initialize a baseline state |
12 |
for the postinst checks. |
13 |
|
14 |
Bug: https://bugs.gentoo.org/635474 |
15 |
|
16 |
bin/misc-functions.sh | 18 +++++++++++------- |
17 |
bin/postinst-qa-check.d/50gnome2-utils | 3 +++ |
18 |
bin/postinst-qa-check.d/50xdg-utils | 6 ++++++ |
19 |
bin/preinst-qa-check.d/50gnome2-utils | 1 + |
20 |
bin/preinst-qa-check.d/50xdg-utils | 1 + |
21 |
pym/portage/package/ebuild/doebuild.py | 1 + |
22 |
6 files changed, 23 insertions(+), 7 deletions(-) |
23 |
|
24 |
diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh |
25 |
index b0506bde7..a02aa3bfd 100755 |
26 |
--- a/bin/misc-functions.sh |
27 |
+++ b/bin/misc-functions.sh |
28 |
@@ -256,8 +256,12 @@ install_qa_check() { |
29 |
rm -f "${ED}"/usr/share/info/dir{,.gz,.bz2} || die "rm failed!" |
30 |
} |
31 |
|
32 |
+preinst_qa_check() { |
33 |
+ postinst_qa_check preinst |
34 |
+} |
35 |
+ |
36 |
postinst_qa_check() { |
37 |
- local d f paths qa_checks=() |
38 |
+ local d f paths qa_checks=() PORTAGE_QA_PHASE=${1:-postinst} |
39 |
if ! ___eapi_has_prefix_variables; then |
40 |
local EPREFIX= EROOT=${ROOT} |
41 |
fi |
42 |
@@ -267,23 +271,23 @@ postinst_qa_check() { |
43 |
# Collect the paths for QA checks, highest prio first. |
44 |
paths=( |
45 |
# sysadmin overrides |
46 |
- "${PORTAGE_OVERRIDE_EPREFIX}"/usr/local/lib/postinst-qa-check.d |
47 |
+ "${PORTAGE_OVERRIDE_EPREFIX}"/usr/local/lib/${PORTAGE_QA_PHASE}-qa-check.d |
48 |
# system-wide package installs |
49 |
- "${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/postinst-qa-check.d |
50 |
+ "${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/${PORTAGE_QA_PHASE}-qa-check.d |
51 |
) |
52 |
|
53 |
# Now repo-specific checks. |
54 |
# (yes, PORTAGE_ECLASS_LOCATIONS contains repo paths...) |
55 |
for d in "${PORTAGE_ECLASS_LOCATIONS[@]}"; do |
56 |
paths+=( |
57 |
- "${d}"/metadata/postinst-qa-check.d |
58 |
+ "${d}"/metadata/${PORTAGE_QA_PHASE}-qa-check.d |
59 |
) |
60 |
done |
61 |
|
62 |
paths+=( |
63 |
# Portage built-in checks |
64 |
- "${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/portage/postinst-qa-check.d |
65 |
- "${PORTAGE_BIN_PATH}"/postinst-qa-check.d |
66 |
+ "${PORTAGE_OVERRIDE_EPREFIX}"/usr/lib/portage/${PORTAGE_QA_PHASE}-qa-check.d |
67 |
+ "${PORTAGE_BIN_PATH}"/${PORTAGE_QA_PHASE}-qa-check.d |
68 |
) |
69 |
|
70 |
# Collect file names of QA checks. We need them early to support |
71 |
@@ -308,7 +312,7 @@ postinst_qa_check() { |
72 |
# Allow inheriting eclasses. |
73 |
# XXX: we want this only in repository-wide checks. |
74 |
_IN_INSTALL_QA_CHECK=1 |
75 |
- source "${d}/${f}" || eerror "Post-postinst QA check ${f} failed to run" |
76 |
+ source "${d}/${f}" || eerror "Post-${PORTAGE_QA_PHASE} QA check ${f} failed to run" |
77 |
) |
78 |
done < <(printf "%s\0" "${qa_checks[@]}" | LC_ALL=C sort -u -z) |
79 |
} |
80 |
|
81 |
diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils |
82 |
index 7f1b0b847..80360cf64 100644 |
83 |
--- a/bin/postinst-qa-check.d/50gnome2-utils |
84 |
+++ b/bin/postinst-qa-check.d/50gnome2-utils |
85 |
@@ -33,6 +33,9 @@ gnome2_icon_cache_check() { |
86 |
fi |
87 |
done |
88 |
|
89 |
+ # preinst initializes the baseline state for the posinst check |
90 |
+ [[ ${PORTAGE_QA_PHASE} == preinst ]] && return |
91 |
+ |
92 |
# The eqatag call is prohibitively expensive if the cache is |
93 |
# missing and there are a large number of files. |
94 |
if [[ -z ${missing} && ${all_files[@]} ]]; then |
95 |
|
96 |
diff --git a/bin/postinst-qa-check.d/50xdg-utils b/bin/postinst-qa-check.d/50xdg-utils |
97 |
index d1285caf4..84f938abd 100644 |
98 |
--- a/bin/postinst-qa-check.d/50xdg-utils |
99 |
+++ b/bin/postinst-qa-check.d/50xdg-utils |
100 |
@@ -29,6 +29,9 @@ xdg_desktop_database_check() { |
101 |
fi |
102 |
done |
103 |
|
104 |
+ # preinst initializes the baseline state for the posinst check |
105 |
+ [[ ${PORTAGE_QA_PHASE} == preinst ]] && return |
106 |
+ |
107 |
# The eqatag call is prohibitively expensive if the cache is |
108 |
# missing and there are a large number of files. |
109 |
if [[ -z ${missing} && ${all_files[@]} ]]; then |
110 |
@@ -66,6 +69,9 @@ xdg_mimeinfo_database_check() { |
111 |
fi |
112 |
done |
113 |
|
114 |
+ # preinst initializes the baseline state for the posinst check |
115 |
+ [[ ${PORTAGE_QA_PHASE} == preinst ]] && return |
116 |
+ |
117 |
# The eqatag call is prohibitively expensive if the cache is |
118 |
# missing and there are a large number of files. |
119 |
if [[ -z ${missing} && ${all_files[@]} ]]; then |
120 |
|
121 |
diff --git a/bin/preinst-qa-check.d/50gnome2-utils b/bin/preinst-qa-check.d/50gnome2-utils |
122 |
new file mode 120000 |
123 |
index 000000000..ee57f814d |
124 |
--- /dev/null |
125 |
+++ b/bin/preinst-qa-check.d/50gnome2-utils |
126 |
@@ -0,0 +1 @@ |
127 |
+../postinst-qa-check.d/50gnome2-utils |
128 |
\ No newline at end of file |
129 |
|
130 |
diff --git a/bin/preinst-qa-check.d/50xdg-utils b/bin/preinst-qa-check.d/50xdg-utils |
131 |
new file mode 120000 |
132 |
index 000000000..16f68a471 |
133 |
--- /dev/null |
134 |
+++ b/bin/preinst-qa-check.d/50xdg-utils |
135 |
@@ -0,0 +1 @@ |
136 |
+../postinst-qa-check.d/50xdg-utils |
137 |
\ No newline at end of file |
138 |
|
139 |
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py |
140 |
index ac697a763..66e63b919 100644 |
141 |
--- a/pym/portage/package/ebuild/doebuild.py |
142 |
+++ b/pym/portage/package/ebuild/doebuild.py |
143 |
@@ -1738,6 +1738,7 @@ _post_phase_cmds = { |
144 |
"preinst_sfperms", |
145 |
"preinst_selinux_labels", |
146 |
"preinst_suid_scan", |
147 |
+ "preinst_qa_check", |
148 |
], |
149 |
|
150 |
"postinst" : [ |