Skip to content

Commit

Permalink
scripts/bootstrap-prefix: unbreak bootstraps due to silly meson dep
Browse files Browse the repository at this point in the history
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@gentoo.org>
  • Loading branch information
grobian committed May 27, 2024
1 parent b736fab commit 3e9c4bb
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions scripts/bootstrap-prefix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 3e9c4bb

Please sign in to comment.