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.
---
 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
-- 
2.14.1


Reply via email to