From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1493582-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 5FF6D15802F
	for <garchives@archives.gentoo.org>; Sun,  5 Mar 2023 10:11:57 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 7A519E0843;
	Sun,  5 Mar 2023 10:11:56 +0000 (UTC)
Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 518DFE0843
	for <gentoo-commits@lists.gentoo.org>; Sun,  5 Mar 2023 10:11:56 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 51B71341175
	for <gentoo-commits@lists.gentoo.org>; Sun,  5 Mar 2023 10:11:55 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 0C2EE88E
	for <gentoo-commits@lists.gentoo.org>; Sun,  5 Mar 2023 10:11:52 +0000 (UTC)
From: "Ulrich Müller" <ulm@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, "Ulrich Müller" <ulm@gentoo.org>
Message-ID: <1678011081.004d9a56c6b7cc0867735791e54f07a2981c7d93.ulm@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: app-editors/emacs/
X-VCS-Repository: repo/gentoo
X-VCS-Files: app-editors/emacs/emacs-18.59-r15.ebuild app-editors/emacs/emacs-25.3-r16.ebuild app-editors/emacs/emacs-26.3-r13.ebuild app-editors/emacs/emacs-27.2-r11.ebuild app-editors/emacs/emacs-28.2-r6.ebuild app-editors/emacs/emacs-28.3_rc1.ebuild app-editors/emacs/emacs-29.0.9999-r1.ebuild app-editors/emacs/emacs-30.0.9999.ebuild
X-VCS-Directories: app-editors/emacs/
X-VCS-Committer: ulm
X-VCS-Committer-Name: Ulrich Müller
X-VCS-Revision: 004d9a56c6b7cc0867735791e54f07a2981c7d93
X-VCS-Branch: master
Date: Sun,  5 Mar 2023 10:11:52 +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: 9632df22-22cc-4260-a646-8e84c259ee50
X-Archives-Hash: e68433aebeeabdebf3d40edfba48a50a

commit:     004d9a56c6b7cc0867735791e54f07a2981c7d93
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  5 10:08:34 2023 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sun Mar  5 10:11:21 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=004d9a56

app-editors/emacs: Workaround for non-idempotent pkg_preinst

Closes: https://bugs.gentoo.org/899648
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 app-editors/emacs/emacs-18.59-r15.ebuild    | 12 +++++++++---
 app-editors/emacs/emacs-25.3-r16.ebuild     | 10 ++++++++--
 app-editors/emacs/emacs-26.3-r13.ebuild     | 10 ++++++++--
 app-editors/emacs/emacs-27.2-r11.ebuild     | 10 ++++++++--
 app-editors/emacs/emacs-28.2-r6.ebuild      | 10 ++++++++--
 app-editors/emacs/emacs-28.3_rc1.ebuild     | 10 ++++++++--
 app-editors/emacs/emacs-29.0.9999-r1.ebuild | 10 ++++++++--
 app-editors/emacs/emacs-30.0.9999.ebuild    | 10 ++++++++--
 8 files changed, 65 insertions(+), 17 deletions(-)

diff --git a/app-editors/emacs/emacs-18.59-r15.ebuild b/app-editors/emacs/emacs-18.59-r15.ebuild
index 6822620a67f8..2c48395d4314 100644
--- a/app-editors/emacs/emacs-18.59-r15.ebuild
+++ b/app-editors/emacs/emacs-18.59-r15.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -147,8 +147,14 @@ src_install() {
 
 pkg_preinst() {
 	# move Info dir file to correct name
-	if [[ -d "${D}"/usr/share/info ]]; then
-		mv "${D}"/usr/share/info/emacs-${SLOT}/dir{.orig,} || die
+	local infodir="${ED}/usr/share/info/emacs-${SLOT}"
+	if [[ -f ${infodir}/dir.orig ]]; then
+		mv "${infodir}"/dir{.orig,} || die
+	elif [[ -d ${infodir} ]]; then
+		# this can happen when preinst is run twice, e.g. when
+		# installing a binpkg that was created with quickpkg #899648
+		ewarn "Unexpected \"dir\" file in ${infodir} - preinst run twice?"
+		[[ ${MERGE_TYPE} == binary && -f ${infodir}/dir ]] || die
 	fi
 }
 

diff --git a/app-editors/emacs/emacs-25.3-r16.ebuild b/app-editors/emacs/emacs-25.3-r16.ebuild
index 1e7a6cd64d8b..723f51cc2df7 100644
--- a/app-editors/emacs/emacs-25.3-r16.ebuild
+++ b/app-editors/emacs/emacs-25.3-r16.ebuild
@@ -331,8 +331,14 @@ src_install() {
 
 pkg_preinst() {
 	# move Info dir file to correct name
-	if [[ -d ${ED}/usr/share/info ]]; then
-		mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{.orig,} || die
+	local infodir="${ED}/usr/share/info/${EMACS_SUFFIX}"
+	if [[ -f ${infodir}/dir.orig ]]; then
+		mv "${infodir}"/dir{.orig,} || die
+	elif [[ -d ${infodir} ]]; then
+		# this can happen when preinst is run twice, e.g. when
+		# installing a binpkg that was created with quickpkg #899648
+		ewarn "Unexpected \"dir\" file in ${infodir} - preinst run twice?"
+		[[ ${MERGE_TYPE} == binary && -f ${infodir}/dir ]] || die
 	fi
 }
 

diff --git a/app-editors/emacs/emacs-26.3-r13.ebuild b/app-editors/emacs/emacs-26.3-r13.ebuild
index 10482650084c..40ac01cbd10b 100644
--- a/app-editors/emacs/emacs-26.3-r13.ebuild
+++ b/app-editors/emacs/emacs-26.3-r13.ebuild
@@ -351,8 +351,14 @@ src_install() {
 
 pkg_preinst() {
 	# move Info dir file to correct name
-	if [[ -d ${ED}/usr/share/info ]]; then
-		mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{.orig,} || die
+	local infodir="${ED}/usr/share/info/${EMACS_SUFFIX}"
+	if [[ -f ${infodir}/dir.orig ]]; then
+		mv "${infodir}"/dir{.orig,} || die
+	elif [[ -d ${infodir} ]]; then
+		# this can happen when preinst is run twice, e.g. when
+		# installing a binpkg that was created with quickpkg #899648
+		ewarn "Unexpected \"dir\" file in ${infodir} - preinst run twice?"
+		[[ ${MERGE_TYPE} == binary && -f ${infodir}/dir ]] || die
 	fi
 }
 

diff --git a/app-editors/emacs/emacs-27.2-r11.ebuild b/app-editors/emacs/emacs-27.2-r11.ebuild
index bbe0dd17f23d..b11a6adb956f 100644
--- a/app-editors/emacs/emacs-27.2-r11.ebuild
+++ b/app-editors/emacs/emacs-27.2-r11.ebuild
@@ -414,8 +414,14 @@ src_install() {
 
 pkg_preinst() {
 	# move Info dir file to correct name
-	if [[ -d ${ED}/usr/share/info ]]; then
-		mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{.orig,} || die
+	local infodir="${ED}/usr/share/info/${EMACS_SUFFIX}"
+	if [[ -f ${infodir}/dir.orig ]]; then
+		mv "${infodir}"/dir{.orig,} || die
+	elif [[ -d ${infodir} ]]; then
+		# this can happen when preinst is run twice, e.g. when
+		# installing a binpkg that was created with quickpkg #899648
+		ewarn "Unexpected \"dir\" file in ${infodir} - preinst run twice?"
+		[[ ${MERGE_TYPE} == binary && -f ${infodir}/dir ]] || die
 	fi
 }
 

diff --git a/app-editors/emacs/emacs-28.2-r6.ebuild b/app-editors/emacs/emacs-28.2-r6.ebuild
index 31ef2328e4a8..8d359a6ae141 100644
--- a/app-editors/emacs/emacs-28.2-r6.ebuild
+++ b/app-editors/emacs/emacs-28.2-r6.ebuild
@@ -493,8 +493,14 @@ src_install() {
 
 pkg_preinst() {
 	# move Info dir file to correct name
-	if [[ -d ${ED}/usr/share/info ]]; then
-		mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{.orig,} || die
+	local infodir="${ED}/usr/share/info/${EMACS_SUFFIX}"
+	if [[ -f ${infodir}/dir.orig ]]; then
+		mv "${infodir}"/dir{.orig,} || die
+	elif [[ -d ${infodir} ]]; then
+		# this can happen when preinst is run twice, e.g. when
+		# installing a binpkg that was created with quickpkg #899648
+		ewarn "Unexpected \"dir\" file in ${infodir} - preinst run twice?"
+		[[ ${MERGE_TYPE} == binary && -f ${infodir}/dir ]] || die
 	fi
 }
 

diff --git a/app-editors/emacs/emacs-28.3_rc1.ebuild b/app-editors/emacs/emacs-28.3_rc1.ebuild
index 0a3be1463dbd..d38c159725f9 100644
--- a/app-editors/emacs/emacs-28.3_rc1.ebuild
+++ b/app-editors/emacs/emacs-28.3_rc1.ebuild
@@ -510,8 +510,14 @@ src_install() {
 
 pkg_preinst() {
 	# move Info dir file to correct name
-	if [[ -d ${ED}/usr/share/info ]]; then
-		mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{.orig,} || die
+	local infodir="${ED}/usr/share/info/${EMACS_SUFFIX}"
+	if [[ -f ${infodir}/dir.orig ]]; then
+		mv "${infodir}"/dir{.orig,} || die
+	elif [[ -d ${infodir} ]]; then
+		# this can happen when preinst is run twice, e.g. when
+		# installing a binpkg that was created with quickpkg #899648
+		ewarn "Unexpected \"dir\" file in ${infodir} - preinst run twice?"
+		[[ ${MERGE_TYPE} == binary && -f ${infodir}/dir ]] || die
 	fi
 }
 

diff --git a/app-editors/emacs/emacs-29.0.9999-r1.ebuild b/app-editors/emacs/emacs-29.0.9999-r1.ebuild
index b06274d3a565..198c02ddd567 100644
--- a/app-editors/emacs/emacs-29.0.9999-r1.ebuild
+++ b/app-editors/emacs/emacs-29.0.9999-r1.ebuild
@@ -540,8 +540,14 @@ src_install() {
 
 pkg_preinst() {
 	# move Info dir file to correct name
-	if [[ -d ${ED}/usr/share/info ]]; then
-		mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{.orig,} || die
+	local infodir="${ED}/usr/share/info/${EMACS_SUFFIX}"
+	if [[ -f ${infodir}/dir.orig ]]; then
+		mv "${infodir}"/dir{.orig,} || die
+	elif [[ -d ${infodir} ]]; then
+		# this can happen when preinst is run twice, e.g. when
+		# installing a binpkg that was created with quickpkg #899648
+		ewarn "Unexpected \"dir\" file in ${infodir} - preinst run twice?"
+		[[ ${MERGE_TYPE} == binary && -f ${infodir}/dir ]] || die
 	fi
 }
 

diff --git a/app-editors/emacs/emacs-30.0.9999.ebuild b/app-editors/emacs/emacs-30.0.9999.ebuild
index 0a03ca0c6d54..a1fdc765f4c4 100644
--- a/app-editors/emacs/emacs-30.0.9999.ebuild
+++ b/app-editors/emacs/emacs-30.0.9999.ebuild
@@ -540,8 +540,14 @@ src_install() {
 
 pkg_preinst() {
 	# move Info dir file to correct name
-	if [[ -d ${ED}/usr/share/info ]]; then
-		mv "${ED}"/usr/share/info/${EMACS_SUFFIX}/dir{.orig,} || die
+	local infodir="${ED}/usr/share/info/${EMACS_SUFFIX}"
+	if [[ -f ${infodir}/dir.orig ]]; then
+		mv "${infodir}"/dir{.orig,} || die
+	elif [[ -d ${infodir} ]]; then
+		# this can happen when preinst is run twice, e.g. when
+		# installing a binpkg that was created with quickpkg #899648
+		ewarn "Unexpected \"dir\" file in ${infodir} - preinst run twice?"
+		[[ ${MERGE_TYPE} == binary && -f ${infodir}/dir ]] || die
 	fi
 }