diff options
author | Zac Medico <zmedico@gentoo.org> | 2017-09-19 16:10:04 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2017-09-19 16:26:32 -0700 |
commit | 361f820b88deda2840396d11c8c8a462dfb435a7 (patch) | |
tree | 3c778008d171db850897ff9f79f8c34e3c2c3153 | |
parent | postinst-qa-check.d: fix [[ ${files[@]} ]] logic in for loops (diff) | |
download | portage-361f820b88deda2840396d11c8c8a462dfb435a7.tar.gz portage-361f820b88deda2840396d11c8c8a462dfb435a7.tar.bz2 portage-361f820b88deda2840396d11c8c8a462dfb435a7.zip |
postinst-qa-check.d: fix false positive and expensive eqatag on first run
When caches were missing, calls to eqatag could be prohibitively
expensive when a large number of files where found. Those files
did not necessaryily belong to the current package, so it was
also a false positive.
Bug: https://bugs.gentoo.org/631454
-rw-r--r-- | bin/postinst-qa-check.d/50gnome2-utils | 8 | ||||
-rw-r--r-- | bin/postinst-qa-check.d/50xdg-utils | 16 |
2 files changed, 15 insertions, 9 deletions
diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils index 077a04918..eb045ea78 100644 --- a/bin/postinst-qa-check.d/50gnome2-utils +++ b/bin/postinst-qa-check.d/50gnome2-utils @@ -1,7 +1,7 @@ # check for missing calls to gnome2-utils regen functions gnome2_icon_cache_check() { - local d f all_files=() find_args + local d f all_files=() find_args missing for d in usr/share/icons/*/; do # gnome2_icon_cache_update updates only themes with an index [[ -f ${d}/index.theme ]] || continue @@ -15,7 +15,7 @@ gnome2_icon_cache_check() { # if the cache does not exist at all, we complain for any file # otherwise, we look for files newer than the cache [[ -f ${d}/icon-theme.cache ]] && - find_args+=( -newercm "${d}"/icon-theme.cache ) + find_args+=( -newercm "${d}"/icon-theme.cache ) || missing=1 # (use -mindepth 2 to easily skip the cache files) while read -r -d $'\0' f; do @@ -33,7 +33,9 @@ gnome2_icon_cache_check() { fi done - if [[ ${all_files[@]} ]]; then + # The eqatag call is prohibitively expensive if the cache is + # missing and there are a large number of files. + if [[ -z missing && ${all_files[@]} ]]; then eqawarn "QA Notice: new icons were found installed but GTK+ icon cache" eqawarn "has not been updated:" eqatag -v gnome2-utils.icon-cache "${all_files[@]/#//}" diff --git a/bin/postinst-qa-check.d/50xdg-utils b/bin/postinst-qa-check.d/50xdg-utils index 410aceb88..ca4b49fe4 100644 --- a/bin/postinst-qa-check.d/50xdg-utils +++ b/bin/postinst-qa-check.d/50xdg-utils @@ -1,7 +1,7 @@ # check for missing calls to xdg-utils regen functions xdg_desktop_database_check() { - local d f files=() + local d f files=() missing for d in usr/share/applications; do [[ -d ${d} ]] || continue @@ -9,7 +9,7 @@ xdg_desktop_database_check() { # if the cache does not exist at all, we complain for any file # otherwise, we look for files newer than the cache [[ -f ${d}/mimeinfo.cache ]] && - find_args+=( -newercm "${d}"/mimeinfo.cache ) + find_args+=( -newercm "${d}"/mimeinfo.cache ) || missing=1 # look for any .desktop files that are newer than the cache # and that have any mime types defined @@ -29,7 +29,9 @@ xdg_desktop_database_check() { fi done - if [[ ${all_files[@]} ]]; then + # The eqatag call is prohibitively expensive if the cache is + # missing and there are a large number of files. + if [[ -z ${missing} && ${all_files[@]} ]]; then eqawarn "QA Notice: .desktop files with MimeType= were found installed" eqawarn "but desktop mimeinfo cache has not been updated:" eqatag -v xdg-utils.desktop "${all_files[@]/#//}" @@ -39,7 +41,7 @@ xdg_desktop_database_check() { } xdg_mimeinfo_database_check() { - local d f files=() + local d f files=() missing for d in usr/share/mime; do [[ -d ${d} ]] || continue @@ -47,7 +49,7 @@ xdg_mimeinfo_database_check() { # if the cache does not exist at all, we complain for any file # otherwise, we look for files newer than the cache [[ -f ${d}/mime.cache ]] && - find_args+=( -newercm "${d}"/mime.cache ) + find_args+=( -newercm "${d}"/mime.cache ) || missing=1 while read -r -d $'\0' f; do files+=( "${f}" ) @@ -64,7 +66,9 @@ xdg_mimeinfo_database_check() { fi done - if [[ ${all_files[@]} ]]; then + # The eqatag call is prohibitively expensive if the cache is + # missing and there are a large number of files. + if [[ -z ${missing} && ${all_files[@]} ]]; then eqawarn "QA Notice: mime-info files were found installed but mime-info" eqawarn "cache has not been updated:" eqatag -v xdg-utils.mime-info "${all_files[@]/#//}" |