Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH v2 4/4] Update caches after reporting missing cache updates
Date: Wed, 16 Aug 2017 18:09:45
Message-Id: 20170816180914.11073-4-mgorny@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH v2 1/4] Support post-postinst QA checks by "Michał Górny"
1 Call the appropriate updater to update caches after reporting a missing
2 cache update, in order to stop repeating the same issue on subsequent
3 packages that did not install any relevant files.
4 ---
5 bin/postinst-qa-check.d/50gnome2-utils | 9 +++++++++
6 bin/postinst-qa-check.d/50xdg-utils | 18 ++++++++++++++++++
7 2 files changed, 27 insertions(+)
8
9 diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils
10 index 4e7c6eb85..d0cbb4037 100644
11 --- a/bin/postinst-qa-check.d/50gnome2-utils
12 +++ b/bin/postinst-qa-check.d/50gnome2-utils
13 @@ -16,6 +16,15 @@ gnome2_icon_cache_check() {
14 while read -r -d $'\0' f; do
15 files+=( "${f}" )
16 done < <(find "${d}" -mindepth 2 -type f "${find_args[@]}" -print0)
17 +
18 + # if any files were found, update the db to avoid repeating
19 + # the warning for subsequent packages
20 + # (note: yes, it will eagerly repeat the update for next dirs
21 + # but that's a minor issue)
22 + if [[ ${files[@]} ]]; then
23 + addwrite "${d}"
24 + gtk-update-icon-cache -qf "${d}"
25 + fi
26 done
27
28 if [[ ${files[@]} ]]; then
29 diff --git a/bin/postinst-qa-check.d/50xdg-utils b/bin/postinst-qa-check.d/50xdg-utils
30 index b0bb029bd..9f5e9a48c 100644
31 --- a/bin/postinst-qa-check.d/50xdg-utils
32 +++ b/bin/postinst-qa-check.d/50xdg-utils
33 @@ -17,6 +17,15 @@ xdg_desktop_database_check() {
34 files+=( "${f}" )
35 done < <(find "${d}" -name '*.desktop' "${find_args[@]}" \
36 -exec grep -lZi '^MimeType=' {} +)
37 +
38 + # if any files were found, update the db to avoid repeating
39 + # the warning for subsequent packages
40 + # (note: yes, it will eagerly repeat the update for next dirs
41 + # but it's a minor issue and we have only one dir anyway)
42 + if [[ ${files[@]} ]]; then
43 + addwrite "${d}"
44 + update-desktop-database "${d}"
45 + fi
46 done
47
48 if [[ ${files[@]} ]]; then
49 @@ -42,6 +51,15 @@ xdg_mimeinfo_database_check() {
50 while read -r -d $'\0' f; do
51 files+=( "${f}" )
52 done < <(find "${d}" -name '*.xml' "${find_args[@]}" -print0)
53 +
54 + # if any files were found, update the db to avoid repeating
55 + # the warning for subsequent packages
56 + # (note: yes, it will eagerly repeat the update for next dirs
57 + # but it's a minor issue and we have only one dir anyway)
58 + if [[ ${files[@]} ]]; then
59 + addwrite "${d}"
60 + update-mime-database "${d}"
61 + fi
62 done
63
64 if [[ ${files[@]} ]]; then
65 --
66 2.14.1