[PATCH 3/2] Update caches after reporting missing cache updates

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 3/2] Update caches after reporting missing cache updates

Michał Górny-5
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 |  8 ++++++++
 bin/postinst-qa-check.d/50xdg-utils    | 16 ++++++++++++++++
 2 files changed, 24 insertions(+)

// (a followup to postinst patches)

diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils
index 68e21cb74..97495f07b 100644
--- a/bin/postinst-qa-check.d/50gnome2-utils
+++ b/bin/postinst-qa-check.d/50gnome2-utils
@@ -16,6 +16,14 @@ 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
+ 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 4bc7bee9a..8c33b2dfe 100644
--- a/bin/postinst-qa-check.d/50xdg-utils
+++ b/bin/postinst-qa-check.d/50xdg-utils
@@ -17,6 +17,14 @@ 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
+ update-desktop-database "${d}"
+ fi
  done
 
  if [[ ${files[@]} ]]; then
@@ -42,6 +50,14 @@ 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
+ update-mime-database "${d}"
+ fi
  done
 
  if [[ ${files[@]} ]]; then
--
2.14.1


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 3/2] Update caches after reporting missing cache updates

Michał Górny-5
W dniu śro, 16.08.2017 o godzinie 16∶22 +0200, użytkownik Michał Górny
napisał:

> 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 |  8 ++++++++
>  bin/postinst-qa-check.d/50xdg-utils    | 16 ++++++++++++++++
>  2 files changed, 24 insertions(+)
>
> // (a followup to postinst patches)
>
> diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils
> index 68e21cb74..97495f07b 100644
> --- a/bin/postinst-qa-check.d/50gnome2-utils
> +++ b/bin/postinst-qa-check.d/50gnome2-utils
> @@ -16,6 +16,14 @@ 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
> + 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 4bc7bee9a..8c33b2dfe 100644
> --- a/bin/postinst-qa-check.d/50xdg-utils
> +++ b/bin/postinst-qa-check.d/50xdg-utils
> @@ -17,6 +17,14 @@ 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
> + update-desktop-database "${d}"
> + fi
>   done
>  
>   if [[ ${files[@]} ]]; then
> @@ -42,6 +50,14 @@ 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
> + update-mime-database "${d}"
> + fi
>   done
>  
>   if [[ ${files[@]} ]]; then

Please disregard this one for now, it needs more work.

--
Best regards,
Michał Górny