public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: bin/postinst-qa-check.d/
Date: Tue, 19 Sep 2017 23:38:58 +0000 (UTC)	[thread overview]
Message-ID: <1505862943.c4edb9ca3a6c1b23a748c057094ab5089523aada.zmedico@gentoo> (raw)

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


             reply	other threads:[~2017-09-19 23:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19 23:38 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-02-12 23:38 [gentoo-commits] proj/portage:master commit in: bin/postinst-qa-check.d/ 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 18:14 Zac Medico
2017-09-20  4:28 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1505862943.c4edb9ca3a6c1b23a748c057094ab5089523aada.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox