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