From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 finch.gentoo.org (Postfix) with ESMTPS id 2C1AF1581EE for ; Sat, 05 Apr 2025 14:45:20 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (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) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 157063430A6 for ; Sat, 05 Apr 2025 14:45:20 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 097FB1102CE; Sat, 05 Apr 2025 14:45:19 +0000 (UTC) Received: from smtp.gentoo.org (smtp.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 bobolink.gentoo.org (Postfix) with ESMTPS id 011B11102CE for ; Sat, 05 Apr 2025 14:45:18 +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 A99FA343078 for ; Sat, 05 Apr 2025 14:45:18 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 359281436 for ; Sat, 05 Apr 2025 14:45:17 +0000 (UTC) From: "Fabian Groffen" 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" Message-ID: <1743864285.6a732cac2e28137d6970b7af454f8b21e7a4b46e.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: 6a732cac2e28137d6970b7af454f8b21e7a4b46e X-VCS-Branch: master Date: Sat, 05 Apr 2025 14:45:17 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: b8c1cf4c-0cf6-495b-ad33-1645070ed312 X-Archives-Hash: dba9e6674644dd5b2e5c0d54232ab29f commit: 6a732cac2e28137d6970b7af454f8b21e7a4b46e Author: Fabian Groffen gentoo org> AuthorDate: Sat Apr 5 14:44:45 2025 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Sat Apr 5 14:44:45 2025 +0000 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=6a732cac scripts/bootstrap-prefix: restructure stage1 somewhat no actual changes, just some reorderings and comment updates Signed-off-by: Fabian Groffen gentoo.org> scripts/bootstrap-prefix.sh | 141 ++++++++++++++++++++++---------------------- 1 file changed, 69 insertions(+), 72 deletions(-) diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh index aaecea9227..525a8aec6a 100755 --- a/scripts/bootstrap-prefix.sh +++ b/scripts/bootstrap-prefix.sh @@ -511,7 +511,6 @@ do_tree() { done fi - mkdir -p "${PORTDIR}" if [[ ! -e ${PORTDIR}/.unpacked ]]; then # latest tree cannot be fetched from mirrors, always have to # respect the source to get the latest @@ -525,8 +524,9 @@ do_tree() { fi einfo "Unpacking, this may take a while" estatus "stage1: unpacking Portage tree" + mkdir -p "${PORTDIR}" bzip2 -dc "${DISTDIR}/$2" \ - | tar -xf - -C "${PORTDIR}" --strip-components=1 + | tar --strip-components=1 -xf - -C "${PORTDIR}" [[ ${PIPESTATUS[*]} == '0 0' ]] || return 1 touch "${PORTDIR}"/.unpacked fi @@ -1607,66 +1607,6 @@ bootstrap_stage1() { export CXX=g++ fi - # Run all bootstrap_* commands in a subshell since the targets - # frequently pollute the environment using exports which affect - # packages following (e.g. zlib builds 64-bits) - - local CP - - # don't rely on $MAKE, if make == gmake packages that call 'make' fail - [[ -x ${ROOT}/tmp/usr/bin/make ]] \ - || [[ $(make --version 2>&1) == *GNU" Make "4* ]] \ - || (bootstrap_make) || return 1 - [[ ${OFFLINE_MODE} ]] || [[ -x ${ROOT}/tmp/usr/bin/openssl ]] \ - || (bootstrap_libressl) # do not fail if this fails, we'll try without - [[ ${OFFLINE_MODE} ]] || type -P wget > /dev/null \ - || (bootstrap_wget) || return 1 - [[ -x ${ROOT}/tmp/usr/bin/sed ]] \ - || [[ $(sed --version 2>&1) == *GNU* ]] \ - || (bootstrap_sed) || return 1 - type -P xz > /dev/null || (bootstrap_xz) || return 1 - type -P bzip2 > /dev/null || (bootstrap_bzip2) || return 1 - [[ -x ${ROOT}/tmp/usr/bin/patch ]] \ - || [[ $(patch --version 2>&1) == *"patch 2."[6-9]*GNU* ]] \ - || (bootstrap_patch) || return 1 - [[ -x ${ROOT}/tmp/usr/bin/m4 ]] \ - || [[ $(m4 --version 2>&1) == *GNU*1.4.1?* ]] \ - || (bootstrap_m4) || return 1 - [[ -x ${ROOT}/tmp/usr/bin/bison ]] \ - || [[ $(bison --version 2>&1) == *"GNU Bison) "2.[3-7]* ]] \ - || [[ $(bison --version 2>&1) == *"GNU Bison) "[3-9]* ]] \ - || (bootstrap_bison) || return 1 - if [[ ! -x ${ROOT}/tmp/usr/bin/uniq ]]; then - # If the system has a uniq, let's use it to test whether - # coreutils is new enough (and GNU). - if [[ $(uniq --version 2>&1) == *"(GNU coreutils) "[6789]* ]]; then - CP="cp" - else - (bootstrap_coreutils) || return 1 - fi - fi - - # But for e.g. BSD, it isn't going to be, so if our test failed, - # use bootstrapped coreutils. - [[ -z ${CP} ]] && CP="${ROOT}/tmp/bin/cp" - - [[ -x ${ROOT}/tmp/usr/bin/find ]] \ - || [[ $(find --version 2>&1) == *GNU* ]] \ - || (bootstrap_findutils) || return 1 - [[ -x ${ROOT}/tmp/usr/bin/tar ]] \ - || [[ $(tar --version 2>&1) == *GNU* ]] \ - || (bootstrap_tar) || return 1 - [[ -x ${ROOT}/tmp/usr/bin/grep ]] \ - || [[ $(grep --version 2>&1) == *GNU* ]] \ - || (bootstrap_grep) || return 1 - [[ -x ${ROOT}/tmp/usr/bin/gawk ]] \ - || [[ $(awk --version < /dev/null 2>&1) == *GNU" Awk "[456789]* ]] \ - || (bootstrap_gawk) || return 1 - # always build our own bash, for we don't know what devilish thing - # we're working with now, bug #650284 - [[ -x ${ROOT}/tmp/usr/bin/bash ]] \ - || (bootstrap_bash) || return 1 - # Some host tools need to be wrapped to be useful for us. # We put them in tmp/usr/local/bin, to not accidentally # be identified as stage1-installed like in bug #615410. @@ -1726,7 +1666,7 @@ bootstrap_stage1() { # speed up bootstrapping, it should be good, and we shouldn't be # touching the host either. Bug #927957 if is-rap && [[ ! -L "${ROOT}"/tmp ]] ; then - [[ -d ${ROOT}/tmp/usr/lib ]] || mkdir -p "${ROOT}"/tmp/usr/lib + mkdir -p "${ROOT}"/tmp/usr/lib local libdir for libdir in lib64 lib32 libx32; do if [[ ! -L ${ROOT}/tmp/usr/${libdir} ]] ; then @@ -1739,10 +1679,68 @@ bootstrap_stage1() { done fi - # important to have our own (non-flawed one) since Python (from - # Portage) and binutils use it - # note that this actually breaks the concept of stage1, this will be - # compiled for the target prefix + # In order to run Portage, it requires GNU variants of the utilities + # ebuilds expect to use. While it is tempting to use the host tools + # here (as they seem pretty usable in most cases) it often is the + # cause of subtle issues that are make simply installing the tools + # we need worth it in terms of debugging issues. + + # Run all bootstrap_* commands in a subshell since the targets + # frequently pollute the environment using exports which affect + # packages following (e.g. zlib builds 64-bits) + + # don't rely on $MAKE, if make == gmake packages that call 'make' fail + [[ -x ${ROOT}/tmp/usr/bin/make ]] \ + || [[ $(make --version 2>&1) == *GNU" Make "4* ]] \ + || (bootstrap_make) || return 1 + [[ ${OFFLINE_MODE} ]] || [[ -x ${ROOT}/tmp/usr/bin/openssl ]] \ + || (bootstrap_libressl) # try without on failure + [[ ${OFFLINE_MODE} ]] || type -P wget > /dev/null \ + || (bootstrap_wget) || return 1 + [[ -x ${ROOT}/tmp/usr/bin/sed ]] \ + || [[ $(sed --version 2>&1) == *GNU* ]] \ + || (bootstrap_sed) || return 1 + type -P xz > /dev/null || (bootstrap_xz) || return 1 + type -P bzip2 > /dev/null || (bootstrap_bzip2) || return 1 + [[ -x ${ROOT}/tmp/usr/bin/patch ]] \ + || [[ $(patch --version 2>&1) == *"patch 2."[6-9]*GNU* ]] \ + || (bootstrap_patch) || return 1 + [[ -x ${ROOT}/tmp/usr/bin/m4 ]] \ + || [[ $(m4 --version 2>&1) == *GNU*1.4.1?* ]] \ + || (bootstrap_m4) || return 1 + [[ -x ${ROOT}/tmp/usr/bin/bison ]] \ + || [[ $(bison --version 2>&1) == *"GNU Bison) "2.[3-7]* ]] \ + || [[ $(bison --version 2>&1) == *"GNU Bison) "[3-9]* ]] \ + || (bootstrap_bison) || return 1 + if [[ ! -x ${ROOT}/tmp/usr/bin/uniq ]]; then + # If the system has a uniq, let's use it to test whether + # coreutils is new enough (and GNU). + [[ $(uniq --version 2>&1) == *"(GNU coreutils) "[6789]* ]] \ + || (bootstrap_coreutils) || return 1 + fi + + [[ -x ${ROOT}/tmp/usr/bin/find ]] \ + || [[ $(find --version 2>&1) == *GNU* ]] \ + || (bootstrap_findutils) || return 1 + [[ -x ${ROOT}/tmp/usr/bin/tar ]] \ + || [[ $(tar --version 2>&1) == *GNU* ]] \ + || (bootstrap_tar) || return 1 + [[ -x ${ROOT}/tmp/usr/bin/grep ]] \ + || [[ $(grep --version 2>&1) == *GNU* ]] \ + || (bootstrap_grep) || return 1 + [[ -x ${ROOT}/tmp/usr/bin/gawk ]] \ + || [[ $(awk --version < /dev/null 2>&1) == *GNU" Awk "[456789]* ]] \ + || (bootstrap_gawk) || return 1 + # always build our own bash, for we don't know what devilish thing + # we're working with now, bug #650284 + [[ -x ${ROOT}/tmp/usr/bin/bash ]] \ + || (bootstrap_bash) || return 1 + + # It is important to have our own (non-flawed) Python that also + # knows where to look for Portage's modules, so we need to build one + # ourselves. Note that this requires libraries and as such actually + # breaks the concept of stage1, as these will be compiled for the + # target prefix. for zlib in "${ROOT}"/tmp/usr/lib*/libz.* ; do [[ -e ${zlib} ]] && break zlib= @@ -1753,16 +1751,15 @@ bootstrap_stage1() { libffi= done [[ -n ${libffi} ]] || (bootstrap_libffi) || return 1 - # too vital to rely on a host-provided one [[ -x ${ROOT}/tmp/usr/bin/python ]] || (bootstrap_python) || return 1 - # cmake for llvm/clang toolchain on macOS + # cmake for llvm/clang toolchain on macOS (needs Python) [[ -e ${ROOT}/tmp/usr/bin/cmake ]] \ || [[ ${CHOST} != *-darwin* ]] \ || [[ ${DARWIN_USE_GCC} == 1 ]] \ || (bootstrap_cmake) || return 1 - # checks itself if things need to be done still + # get ebuilds and support files in place (bootstrap_tree) || return 1 # setup a profile @@ -1774,8 +1771,8 @@ bootstrap_stage1() { mkdir -p "${ROOT}"/tmp/etc/. || return 1 [[ -e ${ROOT}/tmp/etc/portage/make.profile ]] || \ ( - "${CP}" -dpR "${ROOT}"/etc/portage "${ROOT}"/tmp/etc && \ - rm -f "${ROOT}"/tmp/etc/portage/make.profile && \ + cp -pR "${ROOT}"/etc/portage "${ROOT}"/tmp/etc && \ + rm -Rf "${ROOT}"/tmp/etc/portage/make.profile && \ ( ROOT="${ROOT}"/tmp \ PREFIX_DISABLE_RAP="yes" \