diff options
author | 2022-12-27 11:46:18 +0000 | |
---|---|---|
committer | 2022-12-28 15:19:53 +0000 | |
commit | a627ff5554f4efb061d1ce261a248efb5e9d7e59 (patch) | |
tree | 95eafb2bfd6924e7108e8cc4ea4bd1e075ea5135 | |
parent | sys-apps/coreutils: sync with gx86 (diff) | |
download | prefix-a627ff5554f4efb061d1ce261a248efb5e9d7e59.tar.gz prefix-a627ff5554f4efb061d1ce261a248efb5e9d7e59.tar.bz2 prefix-a627ff5554f4efb061d1ce261a248efb5e9d7e59.zip |
scripts/bootstrap-prefix: Set a prefix-guest profile for RAP stage2
This is technically more correct, as stage2 uses the host's libc. It
also means that the Gentoo repo can check for the `prefix-guest` USE
flag instead of the magic `BOOTSTRAP_RAP_STAGE2` variable.
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Closes: https://github.com/gentoo/prefix/pull/15
Signed-off-by: Sam James <sam@gentoo.org>
-rwxr-xr-x | scripts/bootstrap-prefix.sh | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh index 4a6125b769..48f6b686cc 100755 --- a/scripts/bootstrap-prefix.sh +++ b/scripts/bootstrap-prefix.sh @@ -298,24 +298,8 @@ configure_toolchain() { } bootstrap_setup() { - local profile="" einfo "Setting up some guessed defaults" - # 2.6.32.1 -> 2*256^3 + 6*256^2 + 32 * 256 + 1 = 33955841 - kver() { uname -r|cut -d\- -f1|awk -F. '{for (i=1; i<=NF; i++){s+=lshift($i,(4-i)*8)};print s}'; } - # >=glibc-2.20 requires >=linux-2.6.32. - profile-kernel() { - if [[ $(kver) -ge 50462720 ]] ; then # 3.2 - echo kernel-3.2+ - elif [[ $(kver) -ge 33955840 ]] ; then # 2.6.32 - echo kernel-2.6.32+ - elif [[ $(kver) -ge 33951744 ]] ; then # 2.6.16 - echo kernel-2.6.16+ - elif [[ $(kver) -ge 33947648 ]] ; then # 2.6 - echo kernel-2.6+ - fi - } - local FS_INSENSITIVE=0 touch "${ROOT}"/FOO.$$ [[ -e ${ROOT}/foo.$$ ]] && FS_INSENSITIVE=1 @@ -377,6 +361,30 @@ bootstrap_setup() { fi [[ -f ${ROOT}/etc/resolv.conf ]] || ln -s {,"${ROOT}"}/etc/resolv.conf [[ -f ${ROOT}/etc/hosts ]] || cp {,"${ROOT}"}/etc/hosts + fi + + bootstrap_profile +} + +bootstrap_profile() { + local profile="" + + # 2.6.32.1 -> 2*256^3 + 6*256^2 + 32 * 256 + 1 = 33955841 + kver() { uname -r|cut -d\- -f1|awk -F. '{for (i=1; i<=NF; i++){s+=lshift($i,(4-i)*8)};print s}'; } + # >=glibc-2.20 requires >=linux-2.6.32. + profile-kernel() { + if [[ $(kver) -ge 50462720 ]] ; then # 3.2 + echo kernel-3.2+ + elif [[ $(kver) -ge 33955840 ]] ; then # 2.6.32 + echo kernel-2.6.32+ + elif [[ $(kver) -ge 33951744 ]] ; then # 2.6.16 + echo kernel-2.6.16+ + elif [[ $(kver) -ge 33947648 ]] ; then # 2.6 + echo kernel-2.6+ + fi + } + + if is-rap ; then local profile_linux=default/linux/ARCH/17.0/prefix/$(profile-kernel) else local profile_linux=prefix/linux/ARCH @@ -1624,8 +1632,13 @@ bootstrap_stage1() { [[ -e ${ROOT}/etc/portage/make.profile && \ -e ${MAKE_CONF_DIR}/0100_bootstrap_prefix_make.conf ]] \ || (bootstrap_setup) || return 1 + + # setup a profile for stage2 mkdir -p "${ROOT}"/tmp/etc/. || return 1 - [[ -e ${ROOT}/tmp/etc/portage/make.profile ]] || "${CP}" -dpR "${ROOT}"/etc/portage "${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 && \ + (ROOT="${ROOT}"/tmp PREFIX_DISABLE_RAP=yes bootstrap_profile) ) || return 1 # setup portage [[ -e ${ROOT}/tmp/usr/bin/emerge ]] || (bootstrap_portage) || return 1 @@ -1732,7 +1745,6 @@ do_emerge_pkgs() { && export CFLAGS=${OVERRIDE_CFLAGS} [[ -n ${OVERRIDE_CXXFLAGS} ]] \ && export CXXFLAGS=${OVERRIDE_CXXFLAGS} - PORTAGE_CONFIGROOT="${EPREFIX}" \ PORTAGE_SYNC_STALE=0 \ FEATURES="-news ${FEATURES}" \ USE="${myuse[*]}" \ @@ -1755,6 +1767,8 @@ do_emerge_pkgs() { } bootstrap_stage2() { + export PORTAGE_CONFIGROOT="${ROOT}"/tmp + if ! type -P emerge > /dev/null ; then eerror "emerge not found, did you bootstrap stage1?" return 1 @@ -1937,6 +1951,8 @@ bootstrap_stage2_log() { } bootstrap_stage3() { + export PORTAGE_CONFIGROOT="${ROOT}" + if ! type -P emerge > /dev/null ; then eerror "emerge not found, did you bootstrap stage1?" return 1 |