summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/postinst-qa-check.d/50gnome2-utils38
-rw-r--r--bin/postinst-qa-check.d/50xdg-utils65
2 files changed, 103 insertions, 0 deletions
diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils
new file mode 100644
index 000000000..68e21cb74
--- /dev/null
+++ b/bin/postinst-qa-check.d/50gnome2-utils
@@ -0,0 +1,38 @@
+# check for missing calls to gnome2-utils regen functions
+
+gnome2_icon_cache_check() {
+ local d f files=() find_args
+ for d in usr/share/icons/*/; do
+ # gnome2_icon_cache_update updates only themes with an index
+ [[ -f ${d}/index.theme ]] || continue
+
+ find_args=()
+ # 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+=( -newer "${d}"/icon-theme.cache )
+
+ # (use -mindepth 2 to easily skip the cache files)
+ while read -r -d $'\0' f; do
+ files+=( "${f}" )
+ done < <(find "${d}" -mindepth 2 -type f "${find_args[@]}" -print0)
+ done
+
+ if [[ ${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 "${files[@]/#//}"
+ eqawarn "Please make sure to call gnome2_icon_cache_update()"
+ eqawarn "in pkg_postinst() and pkg_postrm() phases of appropriate pkgs."
+ fi
+}
+
+gnome2_utils_postinst_check() {
+ cd "${EROOT}" || die
+ gnome2_icon_cache_check
+}
+
+gnome2_utils_postinst_check
+: # guarantee successful exit
+
+# vim:ft=sh
diff --git a/bin/postinst-qa-check.d/50xdg-utils b/bin/postinst-qa-check.d/50xdg-utils
new file mode 100644
index 000000000..4bc7bee9a
--- /dev/null
+++ b/bin/postinst-qa-check.d/50xdg-utils
@@ -0,0 +1,65 @@
+# check for missing calls to xdg-utils regen functions
+
+xdg_desktop_database_check() {
+ local d f files=()
+ for d in usr/share/applications; do
+ [[ -d ${d} ]] || continue
+
+ find_args=()
+ # 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+=( -newer "${d}"/mimeinfo.cache )
+
+ # look for any .desktop files that are newer than the cache
+ # and that have any mime types defined
+ while read -r -d $'\0' f; do
+ files+=( "${f}" )
+ done < <(find "${d}" -name '*.desktop' "${find_args[@]}" \
+ -exec grep -lZi '^MimeType=' {} +)
+ done
+
+ if [[ ${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 "${files[@]/#//}"
+ eqawarn "Please make sure to call xdg_desktop_database_update()"
+ eqawarn "in pkg_postinst() and pkg_postrm() phases of appropriate pkgs."
+ fi
+}
+
+xdg_mimeinfo_database_check() {
+ local d f files=()
+ for d in usr/share/mime; do
+ [[ -d ${d} ]] || continue
+
+ find_args=()
+ # 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+=( -newer "${d}"/mime.cache )
+
+ while read -r -d $'\0' f; do
+ files+=( "${f}" )
+ done < <(find "${d}" -name '*.xml' "${find_args[@]}" -print0)
+ done
+
+ if [[ ${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 "${files[@]/#//}"
+ eqawarn "Please make sure to call xdg_mimeinfo_database_update()"
+ eqawarn "in pkg_postinst() and pkg_postrm() phases of appropriate pkgs."
+ fi
+}
+
+xdg_utils_postinst_check() {
+ cd "${EROOT}" || die
+ xdg_desktop_database_check
+ xdg_mimeinfo_database_check
+}
+
+xdg_utils_postinst_check
+: # guarantee successful exit
+
+# vim:ft=sh