From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1217386-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 8FC9A138359
	for <garchives@archives.gentoo.org>; Sun, 25 Oct 2020 08:15:22 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 7BC93E07DB;
	Sun, 25 Oct 2020 08:15:21 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 5EC67E07DB
	for <gentoo-commits@lists.gentoo.org>; Sun, 25 Oct 2020 08:15:21 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 64BD0340A8E
	for <gentoo-commits@lists.gentoo.org>; Sun, 25 Oct 2020 08:15:20 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 03E9A332
	for <gentoo-commits@lists.gentoo.org>; Sun, 25 Oct 2020 08:15:18 +0000 (UTC)
From: "Fabian Groffen" <grobian@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" <grobian@gentoo.org>
Message-ID: <1603613662.6b522acbb352eaae250d54b48456350ded50d7ce.grobian@gentoo>
Subject: [gentoo-commits] repo/proj/prefix:master commit in: scripts/
X-VCS-Repository: repo/proj/prefix
X-VCS-Files: scripts/bootstrap-prefix.sh
X-VCS-Directories: scripts/
X-VCS-Committer: grobian
X-VCS-Committer-Name: Fabian Groffen
X-VCS-Revision: 6b522acbb352eaae250d54b48456350ded50d7ce
X-VCS-Branch: master
Date: Sun, 25 Oct 2020 08:15:18 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: bbd2143f-89b4-4db4-b7c2-fa1681ef2881
X-Archives-Hash: 1fa10527327f2bce35cc211d959664de

commit:     6b522acbb352eaae250d54b48456350ded50d7ce
Author:     Alexander Bezrukov <phmagic <AT> mail <DOT> ru>
AuthorDate: Sun Oct 25 08:14:22 2020 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Oct 25 08:14:22 2020 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=6b522acb

scripts/bootstrap-prefix: fix stat invocation for Darwin/*BSD

Closes: https://bugs.gentoo.org/751037
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 scripts/bootstrap-prefix.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
index 3a9dd3cb87..313139c0e8 100755
--- a/scripts/bootstrap-prefix.sh
+++ b/scripts/bootstrap-prefix.sh
@@ -2687,8 +2687,15 @@ EOF
 			EPREFIX=
 			continue
 		fi
-		if [[ $(stat -c '%U/%G' "${EPREFIX}"/.canihaswrite) != \
-			$(stat -c '%U/%G' "${EPREFIX}") ]] ;
+		# GNU and BSD variants of stat take different arguments (and
+		# format specifiers are not equivalent)
+		case "${CHOST}" in
+			*-darwin* | *-freebsd*) STAT='stat -f %u/%g' ;;
+			*)                      STAT='stat -c %U/%G' ;;
+		esac
+
+		if [[ $(${STAT} "${EPREFIX}"/.canihaswrite) != \
+			$(${STAT} "${EPREFIX}") ]] ;
 		then
 			echo
 			echo "The $EPREFIX directory has different ownership than expected."