Allow Gentoo to manage python versions by itself

Gentoo can manage python versions itself.  Before this commit users were
forced to set python versions themselves.  Now they have the option to
set it if they wish.

The workaround needed for git is also no longer needed, so it's been
removed.

Change-Id: I06b259ef73a40df6b8ab92a5b424bffcf4ef764d
Signed-off-by: Matthew Thode <mthode@mthode.org>
This commit is contained in:
Matthew Thode 2022-07-10 22:12:03 -05:00
parent 527e75a6de
commit eb162ec6ed
No known key found for this signature in database
GPG Key ID: 64A37BEAAE19A4E8
2 changed files with 31 additions and 31 deletions

View File

@ -3,7 +3,7 @@ export DISTRO_NAME=gentoo
export EFI_BOOT_DIR="EFI/gentoo"
export GENTOO_PROFILE=${GENTOO_PROFILE:-'default/linux/amd64/17.1'}
export GENTOO_PORTAGE_CLEANUP=${GENTOO_PORTAGE_CLEANUP:-'True'}
export GENTOO_PYTHON_TARGETS=${GENTOO_PYTHON_TARGETS:-'python3_10'}
export GENTOO_PYTHON_TARGETS=${GENTOO_PYTHON_TARGETS:-''}
export GENTOO_OVERLAYS=${GENTOO_OVERLAYS:-''}
export GENTOO_EMERGE_DEFAULT_OPTS=${GENTOO_EMERGE_DEFAULT_OPTS:-"--binpkg-respect-use --rebuilt-binaries=y --usepkg=y --with-bdeps=y --binpkg-changed-deps=y --quiet --jobs=2 --autounmask=n"}

View File

@ -6,34 +6,34 @@ fi
set -eu
set -o pipefail
if mountpoint -q /dev/shm; then
if [[ ${GENTOO_PYTHON_TARGETS} != '' ]]; then
if mountpoint -q /dev/shm; then
echo "/dev/shm found in /proc/self/mountinfo"
elif [[ -k /dev/shm ]]; then
elif [[ -k /dev/shm ]]; then
echo "/dev/shm exists and is stickied"
else
else
fix_shm
fi
[[ ! -f ${PORTDIR}/profiles ]] && emerge-webrsync -q
# set active python targets
echo "PYTHON_TARGETS=\"${GENTOO_PYTHON_TARGETS}\"" >> /etc/portage/make.conf
# install portage first due to bug in env vars not being passed when portage installs itself and re-inits
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --update --newuse --deep sys-apps/portage
# set the active python version
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot --update --newuse --nodeps dev-lang/python-exec dev-lang/python-exec-conf
echo yes | etc-update --automode -3 /etc/python-exec/python-exec.conf
# make world consistant
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --complete-graph=y --update --newuse --deep @world
# rebuild packages that might need it
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --usepkg=n @preserved-rebuild
# remove unneeded packages
emerge --verbose=n --depclean
# rebuild packages that might have somehow depended on the unneeded packages
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --usepkg=n @preserved-rebuild
unfix_shm
fi
[[ ! -f ${PORTDIR}/profiles ]] && emerge-webrsync -q
# set active python targets
echo "PYTHON_TARGETS=\"${GENTOO_PYTHON_TARGETS}\"" >> /etc/portage/make.conf
# disable python in git if we have to, it only supports python-2.7
[[ "${GENTOO_PYTHON_TARGETS}" != *"python2_7"* ]] && echo 'dev-vcs/git -python' >> /etc/portage/package.use/git
# install portage first due to bug in env vars not being passed when portage installs itself and re-inits
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --update --newuse --deep sys-apps/portage
# set the active python version
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot --update --newuse --nodeps dev-lang/python-exec dev-lang/python-exec-conf
echo yes | etc-update --automode -3 /etc/python-exec/python-exec.conf
# make world consistant
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --complete-graph=y --update --newuse --deep @world
# rebuild packages that might need it
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --usepkg=n @preserved-rebuild
# remove unneeded packages
emerge --verbose=n --depclean
# rebuild packages that might have somehow depended on the unneeded packages
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --usepkg=n @preserved-rebuild
unfix_shm