From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1636355-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 CD75F1581D3
	for <garchives@archives.gentoo.org>; Tue, 28 May 2024 14:15:05 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 00256E2A00;
	Tue, 28 May 2024 14:15:04 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id D157CE2A00
	for <gentoo-commits@lists.gentoo.org>; Tue, 28 May 2024 14:15:04 +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))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id E3A0C335D2B
	for <gentoo-commits@lists.gentoo.org>; Tue, 28 May 2024 14:15:03 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 84F50158
	for <gentoo-commits@lists.gentoo.org>; Tue, 28 May 2024 14:15:02 +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: <1716849368.3e9c4bbd27b03b81c8aafcf9ccabd1c6d0e7078f.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: 3e9c4bbd27b03b81c8aafcf9ccabd1c6d0e7078f
X-VCS-Branch: master
Date: Tue, 28 May 2024 14:15:02 +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: 71ccd548-b81f-4bbc-898c-1608adb8d08c
X-Archives-Hash: fe6e556ffdab6d77617602c503462f74

commit:     3e9c4bbd27b03b81c8aafcf9ccabd1c6d0e7078f
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon May 27 22:34:31 2024 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon May 27 22:36:08 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=3e9c4bbd

scripts/bootstrap-prefix: unbreak bootstraps due to silly meson dep

gentoo-functions requires meson nowadays, which cannot be bootstrapped
this early because it requires a Python that the python eclass finds
so work around this by providing a dummy gentoo/functions.sh

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 scripts/bootstrap-prefix.sh | 36 ++++++++++++++++++++++++++++++++----
 1 file changed, 32 insertions(+), 4 deletions(-)

diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
index 92c3ad1869..4d4202945a 100755
--- a/scripts/bootstrap-prefix.sh
+++ b/scripts/bootstrap-prefix.sh
@@ -1876,10 +1876,29 @@ bootstrap_stage2() {
 	# see profiles/features/prefix/standalone/profile.bashrc
 	export BOOTSTRAP_RAP_STAGE2=yes
 
+	# elt-patches needs gentoo-functions, but gentoo-functions these
+	# days needs meson to install, which requires a properly installed
+	# Python -- at this stage we don't have that
+	# so fake gentoo-functions with some dummies to make elt-patches
+	# and others install
+	if [[ ! -e "${ROOT}"/tmp/lib/gentoo/functions.sh ]] ; then
+		mkdir -p "${ROOT}"/tmp/lib/gentoo
+		cat > "${ROOT}"/tmp/lib/gentoo/functions.sh <<-EOF
+			#!${BASH}
+
+			ewarn() {
+			  echo $*
+			}
+
+			eerror() {
+			  echo "!!! $*"
+			}
+		EOF
+	fi
+
 	# Build a basic compiler and portage dependencies in $ROOT/tmp.
 	pkgs=(
 		sys-devel/gnuconfig
-		sys-apps/gentoo-functions
 		app-portage/elt-patches
 		sys-libs/ncurses
 		sys-libs/readline
@@ -2130,6 +2149,16 @@ bootstrap_stage3() {
 	read -r -a linker_pkgs <<< "${linker}"
 	read -r -a compiler_pkgs <<< "${compiler}"
 
+	# We need gentoo-functions but it meson is still a no-go, because we
+	# don't have a Python.  Why would such simple package with a silly
+	# script file need meson is beyond me.  So, we have no other way
+	# than to fake it here for the time being like in stage2.
+	if [[ ! -e "${ROOT}"/lib/gentoo/functions.sh ]] ; then
+		mkdir -p "${ROOT}"/lib/gentoo
+		cp "${ROOT}"/tmp/lib/gentoo/functions.sh \
+			"${ROOT}"/lib/gentoo/functions.sh
+	fi
+
 	if is-rap ; then
 		# We need ${ROOT}/usr/bin/perl to merge glibc.
 		if [[ ! -x "${ROOT}"/usr/bin/perl ]]; then
@@ -2166,7 +2195,6 @@ bootstrap_stage3() {
 		pkgs=(
 			sys-devel/gnuconfig
 			sys-apps/baselayout
-			sys-apps/gentoo-functions
 			app-portage/elt-patches
 			sys-kernel/linux-headers
 			sys-libs/glibc
@@ -2218,7 +2246,6 @@ bootstrap_stage3() {
 	else
 		pkgs=(
 			sys-devel/gnuconfig
-			sys-apps/gentoo-functions
 			app-portage/elt-patches
 			app-arch/xz-utils
 			sys-apps/sed
@@ -2283,7 +2310,7 @@ bootstrap_stage3() {
 	# now we have a shell right there
 	unset CONFIG_SHELL
 
-	# Build portage and dependencies.
+	# Build portage dependencies.
 	pkgs=(
 		sys-apps/coreutils
 		sys-apps/findutils
@@ -2306,6 +2333,7 @@ bootstrap_stage3() {
 		virtual/os-headers
 		sys-devel/gettext
 		sys-apps/portage
+		sys-apps/gentoo-functions
 	)
 
 	pre_emerge_pkgs "" "${pkgs[@]}" || return 1