Make python changes more reliable

We oneshot emerge without calculating dependencies a few things to solve
for possible dependency loops.

Python 3.5 also became stable, so don't need to do special things for
it.

Matched the uninstall with the install lines (no need for a full if
statement).

Change-Id: I7c5e546612ac47d659e73a46a52e34d39ca81949
This commit is contained in:
Matthew Thode 2017-10-31 21:41:36 -05:00
parent 5008358d52
commit ade82904a1
No known key found for this signature in database
GPG Key ID: 64A37BEAAE19A4E8

View File

@ -33,12 +33,7 @@ if [[ "${GENTOO_PYTHON_TARGETS}" == *"python3_6"* ]]; then
echo '~sys-apps/kmod-24 ~amd64' >> /etc/portage/package.keywords/python echo '~sys-apps/kmod-24 ~amd64' >> /etc/portage/package.keywords/python
[[ ! -e /usr/lib64/libpython3.6m.so ]] && USE="-build" emerge -1q --jobs=2 dev-lang/python:3.6 [[ ! -e /usr/lib64/libpython3.6m.so ]] && USE="-build" emerge -1q --jobs=2 dev-lang/python:3.6
fi fi
if [[ "${GENTOO_PYTHON_TARGETS}" == *"python3_5"* ]]; then [[ "${GENTOO_PYTHON_TARGETS}" == *"python3_5"* ]] && [[ ! -e /usr/lib64/libpython3.5m.so ]] && USE="-build" emerge -1q --jobs=2 dev-lang/python:3.5
echo -e "-python_targets_python3_5\n-python_single_target_python3_5" >> /etc/portage/profile/use.stable.mask
echo 'dev-lang/python:3.5 ~amd64' >> /etc/portage/package.keywords/python
echo '~dev-python/setuptools-36.0.1 ~amd64' >> /etc/portage/package.keywords/python
[[ ! -e /usr/lib64/libpython3.5m.so ]] && USE="-build" emerge -1q --jobs=2 dev-lang/python:3.5
fi
[[ "${GENTOO_PYTHON_TARGETS}" == *"python3_4"* ]] && [[ ! -e /usr/lib64/libpython3.4m.so ]] && USE="-build" emerge -1q --jobs=2 dev-lang/python:3.4 [[ "${GENTOO_PYTHON_TARGETS}" == *"python3_4"* ]] && [[ ! -e /usr/lib64/libpython3.4m.so ]] && USE="-build" emerge -1q --jobs=2 dev-lang/python:3.4
[[ "${GENTOO_PYTHON_TARGETS}" == *"python2_7"* ]] && [[ ! -e /usr/lib64/libpython2.7.so ]] && USE="-build" emerge -1q --jobs=2 dev-lang/python:2.7 [[ "${GENTOO_PYTHON_TARGETS}" == *"python2_7"* ]] && [[ ! -e /usr/lib64/libpython2.7.so ]] && USE="-build" emerge -1q --jobs=2 dev-lang/python:2.7
# disable python in git if we have to, it only supports python-2.7 # disable python in git if we have to, it only supports python-2.7
@ -46,23 +41,20 @@ if [[ "${GENTOO_PYTHON_TARGETS}" != *"python2_7"* ]]; then
echo 'dev-vcs/git -python' >> /etc/portage/package.use/git echo 'dev-vcs/git -python' >> /etc/portage/package.use/git
fi fi
# make sure we have the new python for portage bevore we possibly remove python 2.7 # make sure we have the new python for portage bevore we possibly remove python 2.7
USE="-build" emerge -q --oneshot --jobs=2 --with-bdeps=y --update --newuse --deep sys-apps/portage dev-python/pyxattr # this is done one by one with nodeps because it can sometimes have dependency loops
PYTHON_PACKAGES="dev-python/six dev-python/packaging dev-python/pyparsing dev-python/appdirs dev-python/setuptools dev-python/certifi"
for PACKAGE in ${PYTHON_PACKAGES}; do
USE="-build" emerge -q --oneshot --jobs=2 --with-bdeps=y --update --newuse --deep --nodeps "${PACKAGE}"
done
USE="-build" emerge -q --oneshot --jobs=2 --with-bdeps=y --update --newuse --deep --complete-graph=y sys-apps/portage dev-python/pyxattr
# set the active python version # set the active python version
eselect python set ${GENTOO_PYTHON_ACTIVE_VERSION} eselect python set ${GENTOO_PYTHON_ACTIVE_VERSION}
# allow these uninstalls to fail as they may not be installed to begin with # allow these uninstalls to fail as they may not be installed to begin with
set +e set +e
if [[ "${GENTOO_PYTHON_TARGETS}" != *"python2_7"* ]]; then [[ "${GENTOO_PYTHON_TARGETS}" != *"python2_7"* ]] && emerge -C -q dev-lang/python:2.7
emerge -C -q dev-lang/python:2.7 [[ "${GENTOO_PYTHON_TARGETS}" != *"python3_4"* ]] && emerge -C -q dev-lang/python:3.4
fi [[ "${GENTOO_PYTHON_TARGETS}" != *"python3_5"* ]] && emerge -C -q dev-lang/python:3.5
if [[ "${GENTOO_PYTHON_TARGETS}" != *"python3_4"* ]]; then [[ "${GENTOO_PYTHON_TARGETS}" != *"python3_6"* ]] && emerge -C -q dev-lang/python:3.6
emerge -C -q dev-lang/python:3.4
fi
if [[ "${GENTOO_PYTHON_TARGETS}" != *"python3_5"* ]]; then
emerge -C -q dev-lang/python:3.5
fi
if [[ "${GENTOO_PYTHON_TARGETS}" != *"python3_6"* ]]; then
emerge -C -q dev-lang/python:3.6
fi
set -e set -e
# make world consistant # make world consistant
@ -74,5 +66,4 @@ USE="-build" emerge --verbose=n --depclean
# rebuild packages that might have somehow depended on the unneeded packages # rebuild packages that might have somehow depended on the unneeded packages
USE="-build" emerge -q --jobs=2 --usepkg=n @preserved-rebuild USE="-build" emerge -q --jobs=2 --usepkg=n @preserved-rebuild
unfix_shm unfix_shm