commit:     83b44fc48c07a4d8f0b6cb361f61b1493965fcb2
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 16 14:20:48 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Aug 26 21:16:19 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=83b44fc4

Update caches after reporting missing cache updates

Call the appropriate updater to update caches after reporting a missing
cache update, in order to stop repeating the same issue on subsequent
packages that did not install any relevant files.

Closes: https://github.com/gentoo/portage/pull/195
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/postinst-qa-check.d/50gnome2-utils |  9 +++++++++
 bin/postinst-qa-check.d/50xdg-utils    | 18 ++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/bin/postinst-qa-check.d/50gnome2-utils 
b/bin/postinst-qa-check.d/50gnome2-utils
index 4e7c6eb85..d0cbb4037 100644
--- a/bin/postinst-qa-check.d/50gnome2-utils
+++ b/bin/postinst-qa-check.d/50gnome2-utils
@@ -16,6 +16,15 @@ gnome2_icon_cache_check() {
                while read -r -d $'\0' f; do
                        files+=( "${f}" )
                done < <(find "${d}" -mindepth 2 -type f "${find_args[@]}" 
-print0)
+
+               # if any files were found, update the db to avoid repeating
+               # the warning for subsequent packages
+               # (note: yes, it will eagerly repeat the update for next dirs
+               # but that's a minor issue)
+               if [[ ${files[@]} ]]; then
+                       addwrite "${d}"
+                       gtk-update-icon-cache -qf "${d}"
+               fi
        done
 
        if [[ ${files[@]} ]]; then

diff --git a/bin/postinst-qa-check.d/50xdg-utils 
b/bin/postinst-qa-check.d/50xdg-utils
index b0bb029bd..9f5e9a48c 100644
--- a/bin/postinst-qa-check.d/50xdg-utils
+++ b/bin/postinst-qa-check.d/50xdg-utils
@@ -17,6 +17,15 @@ xdg_desktop_database_check() {
                        files+=( "${f}" )
                done < <(find "${d}" -name '*.desktop' "${find_args[@]}" \
                        -exec grep -lZi '^MimeType=' {} +)
+
+               # if any files were found, update the db to avoid repeating
+               # the warning for subsequent packages
+               # (note: yes, it will eagerly repeat the update for next dirs
+               # but it's a minor issue and we have only one dir anyway)
+               if [[ ${files[@]} ]]; then
+                       addwrite "${d}"
+                       update-desktop-database "${d}"
+               fi
        done
 
        if [[ ${files[@]} ]]; then
@@ -42,6 +51,15 @@ xdg_mimeinfo_database_check() {
                while read -r -d $'\0' f; do
                        files+=( "${f}" )
                done < <(find "${d}" -name '*.xml' "${find_args[@]}" -print0)
+
+               # if any files were found, update the db to avoid repeating
+               # the warning for subsequent packages
+               # (note: yes, it will eagerly repeat the update for next dirs
+               # but it's a minor issue and we have only one dir anyway)
+               if [[ ${files[@]} ]]; then
+                       addwrite "${d}"
+                       update-mime-database "${d}"
+               fi
        done
 
        if [[ ${files[@]} ]]; then

Reply via email to