public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: bin/postinst-qa-check.d/
@ 2017-08-26 21:16 Michał Górny
  0 siblings, 0 replies; 14+ messages in thread
From: Michał Górny @ 2017-08-26 21:16 UTC (permalink / raw
  To: gentoo-commits

commit:     5e153472ee6c2f9514e20a6a6434804e46292e68
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 15 09:10:06 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Aug 26 21:16:12 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=5e153472

Add post-postinst checks for a few missed cache updates

Add postinst-qa-check.d checks for missed desktop, mime-info and GTK+
icon cache updates. In all of the cases the checks simply look for any
installed files that are newer than the cache.

This check has some limitations: it assumes that mtime is not preserved
when copying files to D, it can't distinguish whether the files
were installed by the current package (it reports all new files since
the last cache update) and it can't distinguish between the update
on postinst and postrm. However, it's certainly a step forward and will
help find a few bugs.

Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/postinst-qa-check.d/50gnome2-utils | 38 ++++++++++++++++++++
 bin/postinst-qa-check.d/50xdg-utils    | 65 ++++++++++++++++++++++++++++++++++
 2 files changed, 103 insertions(+)

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


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/postinst-qa-check.d/
@ 2017-08-26 21:16 Michał Górny
  0 siblings, 0 replies; 14+ messages in thread
From: Michał Górny @ 2017-08-26 21:16 UTC (permalink / raw
  To: gentoo-commits

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


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/postinst-qa-check.d/
@ 2017-08-26 21:16 Michał Górny
  0 siblings, 0 replies; 14+ messages in thread
From: Michał Górny @ 2017-08-26 21:16 UTC (permalink / raw
  To: gentoo-commits

commit:     028e76a38749c38e3661a204a5aaa5962fd55410
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 16 16:05:31 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Aug 26 21:16:15 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=028e76a3

Use ctime in cache post-postinst checks

Use ctime rather than mtime in cache post-postinst checks since mtime
may be preserved from the original tarball, and therefore be 'long time
ago'. ctime is more reliable in this regard.

Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/postinst-qa-check.d/50gnome2-utils | 2 +-
 bin/postinst-qa-check.d/50xdg-utils    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils
index 68e21cb74..4e7c6eb85 100644
--- a/bin/postinst-qa-check.d/50gnome2-utils
+++ b/bin/postinst-qa-check.d/50gnome2-utils
@@ -10,7 +10,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+=( -newer "${d}"/icon-theme.cache )
+			find_args+=( -newercm "${d}"/icon-theme.cache )
 
 		# (use -mindepth 2 to easily skip the cache files)
 		while read -r -d $'\0' f; do

diff --git a/bin/postinst-qa-check.d/50xdg-utils b/bin/postinst-qa-check.d/50xdg-utils
index 4bc7bee9a..b0bb029bd 100644
--- a/bin/postinst-qa-check.d/50xdg-utils
+++ b/bin/postinst-qa-check.d/50xdg-utils
@@ -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+=( -newer "${d}"/mimeinfo.cache )
+			find_args+=( -newercm "${d}"/mimeinfo.cache )
 
 		# look for any .desktop files that are newer than the cache
 		# and that have any mime types defined
@@ -37,7 +37,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+=( -newer "${d}"/mime.cache )
+			find_args+=( -newercm "${d}"/mime.cache )
 
 		while read -r -d $'\0' f; do
 			files+=( "${f}" )


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/postinst-qa-check.d/
@ 2017-08-29 16:38 Michał Górny
  0 siblings, 0 replies; 14+ messages in thread
From: Michał Górny @ 2017-08-29 16:38 UTC (permalink / raw
  To: gentoo-commits

commit:     8758194e529edd6103cf740935cb67d5bd514773
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 29 07:59:14 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Aug 29 16:37:06 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=8758194e

gnome2-utils postinst: Restrict file types to fix false positives

Restrict the file types checked by the gtk-icon-cache-update check
to match the one used inside the tool. This ensures that we do not
report any false positives for files that are intentionally skipped.

Bug: https://bugs.gentoo.org/629148
Closes: https://github.com/gentoo/portage/pull/196
Reviewed-by: Gilles Dartiguelongue <eva <AT> gentoo.org>
Reviewed-by: Brian Dolbec <dolsen <AT> gentoo.org>

 bin/postinst-qa-check.d/50gnome2-utils | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils
index d0cbb4037..84025ab83 100644
--- a/bin/postinst-qa-check.d/50gnome2-utils
+++ b/bin/postinst-qa-check.d/50gnome2-utils
@@ -6,7 +6,12 @@ gnome2_icon_cache_check() {
 		# gnome2_icon_cache_update updates only themes with an index
 		[[ -f ${d}/index.theme ]] || continue
 
-		find_args=()
+		find_args=(
+			# gtk-update-icon-cache supports only specific file
+			# suffixes; match that to avoid false positives
+			'(' -name '*.png' -o -name '*.svg'
+				-o -name '*.xpm' -o -name '*.icon' ')'
+		)
 		# 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 ]] &&


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/postinst-qa-check.d/
@ 2017-09-19 23:38 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2017-09-19 23:38 UTC (permalink / raw
  To: gentoo-commits

commit:     361f820b88deda2840396d11c8c8a462dfb435a7
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 19 23:10:04 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Sep 19 23:26:32 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=361f820b

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

 bin/postinst-qa-check.d/50gnome2-utils |  8 +++++---
 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[@]/#//}"


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/postinst-qa-check.d/
@ 2017-09-19 23:38 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2017-09-19 23:38 UTC (permalink / raw
  To: gentoo-commits

commit:     c4edb9ca3a6c1b23a748c057094ab5089523aada
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 19 22:40:32 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Sep 19 23:15:43 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c4edb9ca

postinst-qa-check.d: fix [[ ${files[@]} ]] logic in for loops

Use a separate all_files array to accumulate the results
from all loops, so that [[ ${files[@]} ]] only checks for
files found during the current loop.

 bin/postinst-qa-check.d/50gnome2-utils |  9 +++++----
 bin/postinst-qa-check.d/50xdg-utils    | 14 ++++++++------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils
index 84025ab83..077a04918 100644
--- a/bin/postinst-qa-check.d/50gnome2-utils
+++ b/bin/postinst-qa-check.d/50gnome2-utils
@@ -1,12 +1,12 @@
 # check for missing calls to gnome2-utils regen functions
 
 gnome2_icon_cache_check() {
-	local d f files=() find_args
+	local d f all_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=(
+		local files=() find_args=(
 			# gtk-update-icon-cache supports only specific file
 			# suffixes; match that to avoid false positives
 			'(' -name '*.png' -o -name '*.svg'
@@ -27,15 +27,16 @@ gnome2_icon_cache_check() {
 		# (note: yes, it will eagerly repeat the update for next dirs
 		# but that's a minor issue)
 		if [[ ${files[@]} ]]; then
+			all_files+=("${files[@]}")
 			addwrite "${d}"
 			gtk-update-icon-cache -qf "${d}"
 		fi
 	done
 
-	if [[ ${files[@]} ]]; then
+	if [[ ${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 "${files[@]/#//}"
+		eqatag -v gnome2-utils.icon-cache "${all_files[@]/#//}"
 		eqawarn "Please make sure to call gnome2_icon_cache_update()"
 		eqawarn "in pkg_postinst() and pkg_postrm() phases of appropriate pkgs."
 	fi

diff --git a/bin/postinst-qa-check.d/50xdg-utils b/bin/postinst-qa-check.d/50xdg-utils
index 9f5e9a48c..410aceb88 100644
--- a/bin/postinst-qa-check.d/50xdg-utils
+++ b/bin/postinst-qa-check.d/50xdg-utils
@@ -5,7 +5,7 @@ xdg_desktop_database_check() {
 	for d in usr/share/applications; do
 		[[ -d ${d} ]] || continue
 
-		find_args=()
+		local files=() 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 ]] &&
@@ -23,15 +23,16 @@ xdg_desktop_database_check() {
 		# (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
+			all_files+=("${files[@]}")
 			addwrite "${d}"
 			update-desktop-database "${d}"
 		fi
 	done
 
-	if [[ ${files[@]} ]]; then
+	if [[ ${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 "${files[@]/#//}"
+		eqatag -v xdg-utils.desktop "${all_files[@]/#//}"
 		eqawarn "Please make sure to call xdg_desktop_database_update()"
 		eqawarn "in pkg_postinst() and pkg_postrm() phases of appropriate pkgs."
 	fi
@@ -42,7 +43,7 @@ xdg_mimeinfo_database_check() {
 	for d in usr/share/mime; do
 		[[ -d ${d} ]] || continue
 
-		find_args=()
+		local files=() 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 ]] &&
@@ -57,15 +58,16 @@ xdg_mimeinfo_database_check() {
 		# (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
+			all_files+=("${files[@]}")
 			addwrite "${d}"
 			update-mime-database "${d}"
 		fi
 	done
 
-	if [[ ${files[@]} ]]; then
+	if [[ ${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 "${files[@]/#//}"
+		eqatag -v xdg-utils.mime-info "${all_files[@]/#//}"
 		eqawarn "Please make sure to call xdg_mimeinfo_database_update()"
 		eqawarn "in pkg_postinst() and pkg_postrm() phases of appropriate pkgs."
 	fi


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/postinst-qa-check.d/
@ 2017-09-20  4:28 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2017-09-20  4:28 UTC (permalink / raw
  To: gentoo-commits

commit:     743bedc636671e1307735e82e49b0488f1433809
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 20 04:24:56 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Sep 20 04:26:33 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=743bedc6

gnome2-utils postinst: fix ${missing} variable reference

Fixes: 361f820b88de ("postinst-qa-check.d: fix false positive and expensive eqatag on first run")

 bin/postinst-qa-check.d/50gnome2-utils | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils
index eb045ea78..7ee8f2528 100644
--- a/bin/postinst-qa-check.d/50gnome2-utils
+++ b/bin/postinst-qa-check.d/50gnome2-utils
@@ -35,7 +35,7 @@ gnome2_icon_cache_check() {
 
 	# 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
+	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[@]/#//}"


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/postinst-qa-check.d/
@ 2017-09-20 18:14 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2017-09-20 18:14 UTC (permalink / raw
  To: gentoo-commits

commit:     5fc7281657e2a5a4b22e969853364b142a37d05f
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 20 18:11:53 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Sep 20 18:13:44 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=5fc72816

postinst-qa-check.d: remove redundant local vars and obsolete comments

Fixes: c4edb9ca3a6c ("postinst-qa-check.d: fix [[ ${files[@]} ]] logic in for loops")
Reported-by: Michał Górny <mgorny <AT> gentoo.org>

 bin/postinst-qa-check.d/50gnome2-utils | 4 +---
 bin/postinst-qa-check.d/50xdg-utils    | 8 ++------
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils
index 7ee8f2528..569633fe3 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 missing
+	local d f all_files=() missing
 	for d in usr/share/icons/*/; do
 		# gnome2_icon_cache_update updates only themes with an index
 		[[ -f ${d}/index.theme ]] || continue
@@ -24,8 +24,6 @@ gnome2_icon_cache_check() {
 
 		# 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
 			all_files+=("${files[@]}")
 			addwrite "${d}"

diff --git a/bin/postinst-qa-check.d/50xdg-utils b/bin/postinst-qa-check.d/50xdg-utils
index ca4b49fe4..9164f8dc1 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=() missing
+	local d f missing
 	for d in usr/share/applications; do
 		[[ -d ${d} ]] || continue
 
@@ -20,8 +20,6 @@ xdg_desktop_database_check() {
 
 		# 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
 			all_files+=("${files[@]}")
 			addwrite "${d}"
@@ -41,7 +39,7 @@ xdg_desktop_database_check() {
 }
 
 xdg_mimeinfo_database_check() {
-	local d f files=() missing
+	local d f missing
 	for d in usr/share/mime; do
 		[[ -d ${d} ]] || continue
 
@@ -57,8 +55,6 @@ xdg_mimeinfo_database_check() {
 
 		# 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
 			all_files+=("${files[@]}")
 			addwrite "${d}"


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/postinst-qa-check.d/
@ 2017-10-02 16:56 Michał Górny
  0 siblings, 0 replies; 14+ messages in thread
From: Michał Górny @ 2017-10-02 16:56 UTC (permalink / raw
  To: gentoo-commits

commit:     38deed53c51aa9e75bd8c933f84121af993af7a2
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Oct  2 15:34:21 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Oct  2 16:56:21 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=38deed53

postinst-qa-check.d: Skip checks if required tools are missing

Closes: https://bugs.gentoo.org/631820
Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>

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

diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils
index 569633fe3..7f1b0b847 100644
--- a/bin/postinst-qa-check.d/50gnome2-utils
+++ b/bin/postinst-qa-check.d/50gnome2-utils
@@ -1,6 +1,8 @@
 # check for missing calls to gnome2-utils regen functions
 
 gnome2_icon_cache_check() {
+	type -P gtk-update-icon-cache &>/dev/null || return
+
 	local d f all_files=() missing
 	for d in usr/share/icons/*/; do
 		# gnome2_icon_cache_update updates only themes with an index

diff --git a/bin/postinst-qa-check.d/50xdg-utils b/bin/postinst-qa-check.d/50xdg-utils
index 9164f8dc1..9f5ae7cb9 100644
--- a/bin/postinst-qa-check.d/50xdg-utils
+++ b/bin/postinst-qa-check.d/50xdg-utils
@@ -1,6 +1,8 @@
 # check for missing calls to xdg-utils regen functions
 
 xdg_desktop_database_check() {
+	type -P update-desktop-database &>/dev/null || return
+
 	local d f missing
 	for d in usr/share/applications; do
 		[[ -d ${d} ]] || continue
@@ -39,6 +41,8 @@ xdg_desktop_database_check() {
 }
 
 xdg_mimeinfo_database_check() {
+	type -P update-mime-database &>/dev/null || return
+
 	local d f missing
 	for d in usr/share/mime; do
 		[[ -d ${d} ]] || continue


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/postinst-qa-check.d/
@ 2017-10-02 17:28 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2017-10-02 17:28 UTC (permalink / raw
  To: gentoo-commits

commit:     c2636e6802fb4eb173b2da54d278322cb8edb5e5
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Oct  2 17:25:25 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Oct  2 17:26:01 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c2636e68

postinst-qa-check.d/50xdg-utils: local all_files (bug 632696)

Fixes: c4edb9ca3a6c ("postinst-qa-check.d: fix [[ ${files[@]} ]] logic in for loops")
X-Gentoo-bug: 632696
X-Gentoo-bug-url: https://bugs.gentoo.org/632696

 bin/postinst-qa-check.d/50xdg-utils | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/postinst-qa-check.d/50xdg-utils b/bin/postinst-qa-check.d/50xdg-utils
index 9f5ae7cb9..d1285caf4 100644
--- a/bin/postinst-qa-check.d/50xdg-utils
+++ b/bin/postinst-qa-check.d/50xdg-utils
@@ -3,7 +3,7 @@
 xdg_desktop_database_check() {
 	type -P update-desktop-database &>/dev/null || return
 
-	local d f missing
+	local d f all_files=() missing
 	for d in usr/share/applications; do
 		[[ -d ${d} ]] || continue
 
@@ -43,7 +43,7 @@ xdg_desktop_database_check() {
 xdg_mimeinfo_database_check() {
 	type -P update-mime-database &>/dev/null || return
 
-	local d f missing
+	local d f all_files=() missing
 	for d in usr/share/mime; do
 		[[ -d ${d} ]] || continue
 


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/postinst-qa-check.d/
@ 2017-10-27 19:11 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2017-10-27 19:11 UTC (permalink / raw
  To: gentoo-commits

commit:     85c8d2c5c65b70ddc4888a7f1b57e6e9e29ae22d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 26 17:06:47 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Oct 27 18:52:08 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=85c8d2c5

postinst-qa-check.d: fix parallel-install to skip QA Notice

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

diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils
index 80360cf64..dacc19a43 100644
--- a/bin/postinst-qa-check.d/50gnome2-utils
+++ b/bin/postinst-qa-check.d/50gnome2-utils
@@ -36,6 +36,9 @@ gnome2_icon_cache_check() {
 	# preinst initializes the baseline state for the posinst check
 	[[ ${PORTAGE_QA_PHASE} == preinst ]] && return
 
+	# parallel-install makes it impossible to blame a specific package
+	has parallel-install ${FEATURES} && return
+
 	# 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

diff --git a/bin/postinst-qa-check.d/50xdg-utils b/bin/postinst-qa-check.d/50xdg-utils
index 84f938abd..7094e75a1 100644
--- a/bin/postinst-qa-check.d/50xdg-utils
+++ b/bin/postinst-qa-check.d/50xdg-utils
@@ -32,6 +32,9 @@ xdg_desktop_database_check() {
 	# preinst initializes the baseline state for the posinst check
 	[[ ${PORTAGE_QA_PHASE} == preinst ]] && return
 
+	# parallel-install makes it impossible to blame a specific package
+	has parallel-install ${FEATURES} && return
+
 	# 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
@@ -72,6 +75,9 @@ xdg_mimeinfo_database_check() {
 	# preinst initializes the baseline state for the posinst check
 	[[ ${PORTAGE_QA_PHASE} == preinst ]] && return
 
+	# parallel-install makes it impossible to blame a specific package
+	has parallel-install ${FEATURES} && return
+
 	# 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


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/postinst-qa-check.d/
@ 2018-03-16  9:27 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2018-03-16  9:27 UTC (permalink / raw
  To: gentoo-commits

commit:     0d75a363355ad7b19e4f7ddbfa62e600c75f42ce
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  4 19:02:52 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Mar 16 09:26:23 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=0d75a363

gnome2-utils postinst: fix false positive for gtk-update-icon-cache (bug 649464)

For the first install of gtk-update-icon-cache, there's no
way to initialize state during preinst, so we have to ignore
this package in order to avoid false positives.

Bug: https://bugs.gentoo.org/649464

 bin/postinst-qa-check.d/50gnome2-utils | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils
index dacc19a43..a50df009a 100644
--- a/bin/postinst-qa-check.d/50gnome2-utils
+++ b/bin/postinst-qa-check.d/50gnome2-utils
@@ -39,6 +39,9 @@ gnome2_icon_cache_check() {
 	# parallel-install makes it impossible to blame a specific package
 	has parallel-install ${FEATURES} && return
 
+	# avoid false-positives on first install (bug 649464)
+	[[ ${PN} == gtk-update-icon-cache ]] && return
+
 	# 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


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/postinst-qa-check.d/
@ 2019-02-12 23:38 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2019-02-12 23:38 UTC (permalink / raw
  To: gentoo-commits

commit:     76a9695a24d9337758b93d489d0b1a5bae2dedad
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Tue Feb 12 05:56:50 2019 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Feb 12 23:35:52 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=76a9695a

{pre,post}inst-qa-check.d/50xdg-utils: gnome2_icon_cache_update -> xdg_icon_cache_update

Bug: https://bugs.gentoo.org/677776
Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org>
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 bin/postinst-qa-check.d/50xdg-utils | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/bin/postinst-qa-check.d/50xdg-utils b/bin/postinst-qa-check.d/50xdg-utils
index 9945cc336..9a7c036e6 100644
--- a/bin/postinst-qa-check.d/50xdg-utils
+++ b/bin/postinst-qa-check.d/50xdg-utils
@@ -46,12 +46,12 @@ xdg_desktop_database_check() {
 	fi
 }
 
-gnome2_icon_cache_check() {
+xdg_icon_cache_check() {
 	type -P gtk-update-icon-cache &>/dev/null || return
 
 	local d f all_files=() missing
 	for d in usr/share/icons/*/; do
-		# gnome2_icon_cache_update updates only themes with an index
+		# xdg_icon_cache_update updates only themes with an index
 		[[ -f ${d}/index.theme ]] || continue
 
 		local files=() find_args=(
@@ -91,10 +91,10 @@ gnome2_icon_cache_check() {
 	# 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 "QA Notice: new icons were found installed but icon cache"
 		eqawarn "has not been updated:"
-		eqatag -v gnome2-utils.icon-cache "${all_files[@]/#//}"
-		eqawarn "Please make sure to call gnome2_icon_cache_update()"
+		eqatag -v xdg-utils.icon-cache "${all_files[@]/#//}"
+		eqawarn "Please make sure to call xdg_icon_cache_update()"
 		eqawarn "in pkg_postinst() and pkg_postrm() phases of appropriate pkgs."
 	fi
 }
@@ -145,7 +145,7 @@ xdg_mimeinfo_database_check() {
 xdg_utils_postinst_check() {
 	cd "${EROOT:-/}" || die
 	xdg_desktop_database_check
-	gnome2_icon_cache_check
+	xdg_icon_cache_check
 	xdg_mimeinfo_database_check
 }
 


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-commits] proj/portage:master commit in: bin/postinst-qa-check.d/
@ 2019-02-12 23:38 Zac Medico
  0 siblings, 0 replies; 14+ messages in thread
From: Zac Medico @ 2019-02-12 23:38 UTC (permalink / raw
  To: gentoo-commits

commit:     571947cbec7f1f79f8cfff5a4b1ecac129f8e635
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Tue Feb 12 05:47:45 2019 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Feb 12 23:35:37 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=571947cb

{pre,post}inst-qa-check.d: Move gnome2_icon_cache_check() from 50gnome2-utils to 50xdg-utils.

No changes inside source code of this function.

Bug: https://bugs.gentoo.org/677776
Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org>
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

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

diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils
index 29ea7c844..9a5565ee2 100644
--- a/bin/postinst-qa-check.d/50gnome2-utils
+++ b/bin/postinst-qa-check.d/50gnome2-utils
@@ -1,61 +1,7 @@
 # check for missing calls to gnome2-utils regen functions
 
-gnome2_icon_cache_check() {
-	type -P gtk-update-icon-cache &>/dev/null || return
-
-	local d f all_files=() missing
-	for d in usr/share/icons/*/; do
-		# gnome2_icon_cache_update updates only themes with an index
-		[[ -f ${d}/index.theme ]] || continue
-
-		local files=() find_args=(
-			# gtk-update-icon-cache supports only specific file
-			# suffixes; match that to avoid false positives
-			'(' -name '*.png' -o -name '*.svg'
-				-o -name '*.xpm' -o -name '*.icon' ')'
-		)
-		# 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 ) || missing=1
-
-		# (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)
-
-		# if any files were found, update the db to avoid repeating
-		# the warning for subsequent packages
-		if [[ ${files[@]} ]]; then
-			all_files+=("${files[@]}")
-			addwrite "${d}"
-			gtk-update-icon-cache -qf "${d}"
-		fi
-	done
-
-	# preinst initializes the baseline state for the posinst check
-	[[ ${PORTAGE_QA_PHASE} == preinst ]] && return
-
-	# parallel-install makes it impossible to blame a specific package
-	has parallel-install ${FEATURES} && return
-
-	# avoid false-positives on first install (bug 649464)
-	[[ ${PN} == gtk-update-icon-cache ]] && return
-
-	# 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[@]/#//}"
-		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

diff --git a/bin/postinst-qa-check.d/50xdg-utils b/bin/postinst-qa-check.d/50xdg-utils
index b33df4743..9945cc336 100644
--- a/bin/postinst-qa-check.d/50xdg-utils
+++ b/bin/postinst-qa-check.d/50xdg-utils
@@ -46,6 +46,59 @@ xdg_desktop_database_check() {
 	fi
 }
 
+gnome2_icon_cache_check() {
+	type -P gtk-update-icon-cache &>/dev/null || return
+
+	local d f all_files=() missing
+	for d in usr/share/icons/*/; do
+		# gnome2_icon_cache_update updates only themes with an index
+		[[ -f ${d}/index.theme ]] || continue
+
+		local files=() find_args=(
+			# gtk-update-icon-cache supports only specific file
+			# suffixes; match that to avoid false positives
+			'(' -name '*.png' -o -name '*.svg'
+				-o -name '*.xpm' -o -name '*.icon' ')'
+		)
+		# 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 ) || missing=1
+
+		# (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)
+
+		# if any files were found, update the db to avoid repeating
+		# the warning for subsequent packages
+		if [[ ${files[@]} ]]; then
+			all_files+=("${files[@]}")
+			addwrite "${d}"
+			gtk-update-icon-cache -qf "${d}"
+		fi
+	done
+
+	# preinst initializes the baseline state for the posinst check
+	[[ ${PORTAGE_QA_PHASE} == preinst ]] && return
+
+	# parallel-install makes it impossible to blame a specific package
+	has parallel-install ${FEATURES} && return
+
+	# avoid false-positives on first install (bug 649464)
+	[[ ${PN} == gtk-update-icon-cache ]] && return
+
+	# 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[@]/#//}"
+		eqawarn "Please make sure to call gnome2_icon_cache_update()"
+		eqawarn "in pkg_postinst() and pkg_postrm() phases of appropriate pkgs."
+	fi
+}
+
 xdg_mimeinfo_database_check() {
 	type -P update-mime-database &>/dev/null || return
 
@@ -92,6 +145,7 @@ xdg_mimeinfo_database_check() {
 xdg_utils_postinst_check() {
 	cd "${EROOT:-/}" || die
 	xdg_desktop_database_check
+	gnome2_icon_cache_check
 	xdg_mimeinfo_database_check
 }
 


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-02-12 23:38 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-20 18:14 [gentoo-commits] proj/portage:master commit in: bin/postinst-qa-check.d/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2019-02-12 23:38 Zac Medico
2019-02-12 23:38 Zac Medico
2018-03-16  9:27 Zac Medico
2017-10-27 19:11 Zac Medico
2017-10-02 17:28 Zac Medico
2017-10-02 16:56 Michał Górny
2017-09-20  4:28 Zac Medico
2017-09-19 23:38 Zac Medico
2017-09-19 23:38 Zac Medico
2017-08-29 16:38 Michał Górny
2017-08-26 21:16 Michał Górny
2017-08-26 21:16 Michał Górny
2017-08-26 21:16 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox