Merge "simplify updating python versions in gentoo"
This commit is contained in:
commit
6ebd8cb974
@ -6,7 +6,7 @@ located in profile specific sub directories:
|
|||||||
|
|
||||||
http://distfiles.gentoo.org/releases/amd64/autobuilds/
|
http://distfiles.gentoo.org/releases/amd64/autobuilds/
|
||||||
|
|
||||||
As of this writing, only x86_64 images are available.
|
As of this writing, only amd64 and arm64 images are available.
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
@ -31,6 +31,8 @@ Notes:
|
|||||||
default/linux/amd64/17.1/hardened
|
default/linux/amd64/17.1/hardened
|
||||||
default/linux/amd64/17.1/no-multilib/hardened
|
default/linux/amd64/17.1/no-multilib/hardened
|
||||||
default/linux/amd64/17.1/systemd
|
default/linux/amd64/17.1/systemd
|
||||||
|
default/linux/arm64/17.0
|
||||||
|
default/linux/arm64/17.0/systemd
|
||||||
|
|
||||||
* You can set the `GENTOO_PORTAGE_CLEANUP` environment variable to False to
|
* You can set the `GENTOO_PORTAGE_CLEANUP` environment variable to False to
|
||||||
disable the clean up of portage repositories (including overlays). This
|
disable the clean up of portage repositories (including overlays). This
|
||||||
@ -41,11 +43,6 @@ Notes:
|
|||||||
the versions of python you want on your image. The format of this variable
|
the versions of python you want on your image. The format of this variable
|
||||||
is a string as follows `"python2_7 python3_6"`.
|
is a string as follows `"python2_7 python3_6"`.
|
||||||
|
|
||||||
* In addition you can select the primary python version you wish to use (that
|
|
||||||
which will be called by running the `python` command. The
|
|
||||||
`GENTOO_PYTHON_ACTIVE_VERSION` is used to set that mapping. The variable
|
|
||||||
contents can be something like `python3.6`.
|
|
||||||
|
|
||||||
* You can enable overlays using the `GENTOO_OVERLAYS` variable. In it you
|
* You can enable overlays using the `GENTOO_OVERLAYS` variable. In it you
|
||||||
should put a space separated list of overlays. The overlays must be in the
|
should put a space separated list of overlays. The overlays must be in the
|
||||||
official overlay list and must be git based.
|
official overlay list and must be git based.
|
||||||
|
@ -2,8 +2,7 @@ export DIB_RELEASE=gentoo
|
|||||||
export DISTRO_NAME=gentoo
|
export DISTRO_NAME=gentoo
|
||||||
export GENTOO_PROFILE=${GENTOO_PROFILE:-'default/linux/amd64/17.1'}
|
export GENTOO_PROFILE=${GENTOO_PROFILE:-'default/linux/amd64/17.1'}
|
||||||
export GENTOO_PORTAGE_CLEANUP=${GENTOO_PORTAGE_CLEANUP:-'True'}
|
export GENTOO_PORTAGE_CLEANUP=${GENTOO_PORTAGE_CLEANUP:-'True'}
|
||||||
export GENTOO_PYTHON_TARGETS=${GENTOO_PYTHON_TARGETS:-'python2_7 python3_6'}
|
export GENTOO_PYTHON_TARGETS=${GENTOO_PYTHON_TARGETS:-'python3_8'}
|
||||||
export GENTOO_PYTHON_ACTIVE_VERSION=${GENTOO_PYTHON_ACTIVE_VERSION:-'python3.6'}
|
|
||||||
export GENTOO_OVERLAYS=${GENTOO_OVERLAYS:-''}
|
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"}
|
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"}
|
||||||
|
|
||||||
|
@ -9,7 +9,9 @@ set -o pipefail
|
|||||||
# get the directories in order
|
# get the directories in order
|
||||||
mkdir -p /etc/portage/profile
|
mkdir -p /etc/portage/profile
|
||||||
mkdir -p /etc/portage/package.accept_keywords
|
mkdir -p /etc/portage/package.accept_keywords
|
||||||
if [[ -f /etc/portage/package.keywords ]]; then mv /etc/portage/package.keywords /etc/portage/package.accept_keywords/prebuilt-1; fi
|
if [[ -f /etc/portage/package.keywords ]]; then
|
||||||
|
mv /etc/portage/package.keywords /etc/portage/package.accept_keywords/prebuilt-1
|
||||||
|
fi
|
||||||
mkdir -p /etc/portage/package.mask
|
mkdir -p /etc/portage/package.mask
|
||||||
mkdir -p /etc/portage/package.unmask
|
mkdir -p /etc/portage/package.unmask
|
||||||
mkdir -p /etc/portage/package.use
|
mkdir -p /etc/portage/package.use
|
||||||
@ -20,18 +22,22 @@ echo 'dev-python/pip vanilla' >> /etc/portage/package.use/pip
|
|||||||
echo 'sys-fs/lvm2 -thin' >> /etc/portage/package.use/grub
|
echo 'sys-fs/lvm2 -thin' >> /etc/portage/package.use/grub
|
||||||
echo 'sys-boot/grub device-mapper' >> /etc/portage/package.use/grub
|
echo 'sys-boot/grub device-mapper' >> /etc/portage/package.use/grub
|
||||||
echo 'sys-boot/grub grub_platforms_efi-64' >> /etc/portage/package.use/grub # always enable efi-64
|
echo 'sys-boot/grub grub_platforms_efi-64' >> /etc/portage/package.use/grub # always enable efi-64
|
||||||
if [[ 'x86_64' == "${ARCH}" ]]; then echo 'sys-boot/grub grub_platforms_pc' >> /etc/portage/package.use/grub; fi # bios support for bios systems
|
if [[ 'amd64' == "${ARCH}" ]]; then
|
||||||
|
echo 'sys-boot/grub grub_platforms_pc' >> /etc/portage/package.use/grub # bios support for bios systems
|
||||||
|
fi
|
||||||
|
|
||||||
|
# tool for setting python versions
|
||||||
|
echo "~dev-lang/python-exec-2.4.6 ~${ARCH}" >> /etc/portage/package.accept_keywords/python-exec-conf
|
||||||
|
echo "dev-lang/python-exec-conf ~${ARCH}" >> /etc/portage/package.accept_keywords/python-exec-conf
|
||||||
|
|
||||||
# needed to install static kernel
|
# needed to install static kernel
|
||||||
if [[ 'x86_64' == "${ARCH}" ]]; then echo 'sys-kernel/gentoo-kernel-bin ~amd64' >> /etc/portage/package.accept_keywords/kernel; fi
|
echo "sys-kernel/gentoo-kernel-bin ~${ARCH}" >> /etc/portage/package.accept_keywords/kernel
|
||||||
if [[ 'arm64' == "${ARCH}" ]]; then echo 'sys-kernel/gentoo-kernel-bin ~arm64' >> /etc/portage/package.accept_keywords/kernel; fi
|
echo "virtual/dist-kernel ~${ARCH}" >> /etc/portage/package.accept_keywords/kernel
|
||||||
|
|
||||||
# musl only valid for amd64 for now
|
# musl only valid for amd64 for now
|
||||||
if [[ "${GENTOO_PROFILE}" == *"musl"* ]]; then
|
if [[ "${GENTOO_PROFILE}" == *"musl"* ]]; then
|
||||||
echo "dev-vcs/git -gpg" >> /etc/portage/package.use/musl # gpg doesn't build on musl profiles
|
echo "dev-vcs/git -gpg" >> /etc/portage/package.use/musl # gpg doesn't build on musl profiles
|
||||||
echo "sys-libs/pam cracklib" >> /etc/portage/package.use/musl
|
echo "sys-libs/pam cracklib" >> /etc/portage/package.use/musl
|
||||||
if [[ 'x86_64' == "${ARCH}" ]]; then echo "~sys-block/open-iscsi-2.1.1 ~amd64" >> /etc/portage/package.accept_keywords/musl; fi
|
echo "~sys-block/open-iscsi-2.1.1 ~${ARCH}" >> /etc/portage/package.accept_keywords/musl
|
||||||
if [[ 'x86_64' == "${ARCH}" ]]; then echo "~sys-block/open-isns-0.100 ~amd64" >> /etc/portage/package.accept_keywords/musl; fi
|
echo "~sys-block/open-isns-0.100 ~${ARCH}" >> /etc/portage/package.accept_keywords/musl
|
||||||
if [[ 'arm64' == "${ARCH}" ]]; then echo "~sys-block/open-iscsi-2.1.1 ~arm64" >> /etc/portage/package.accept_keywords/musl; fi
|
|
||||||
if [[ 'arm64' == "${ARCH}" ]]; then echo "~sys-block/open-isns-0.100 ~arm64" >> /etc/portage/package.accept_keywords/musl; fi
|
|
||||||
fi
|
fi
|
||||||
|
@ -8,7 +8,7 @@ set -o pipefail
|
|||||||
|
|
||||||
if [[ ${GENTOO_OVERLAYS} != '' ]]; then
|
if [[ ${GENTOO_OVERLAYS} != '' ]]; then
|
||||||
if mountpoint -q /dev/shm; then
|
if mountpoint -q /dev/shm; then
|
||||||
echo "/dev/shm found in /proc/self/mountinfo"
|
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"
|
echo "/dev/shm exists and is stickied"
|
||||||
else
|
else
|
||||||
|
@ -16,38 +16,16 @@ fi
|
|||||||
|
|
||||||
[[ ! -f ${PORTDIR}/profiles ]] && emerge-webrsync -q
|
[[ ! -f ${PORTDIR}/profiles ]] && emerge-webrsync -q
|
||||||
|
|
||||||
|
# set active python targets
|
||||||
echo "PYTHON_TARGETS=\"${GENTOO_PYTHON_TARGETS}\"" >> /etc/portage/make.conf
|
echo "PYTHON_TARGETS=\"${GENTOO_PYTHON_TARGETS}\"" >> /etc/portage/make.conf
|
||||||
[[ "${GENTOO_PYTHON_TARGETS}" == *"python3_9"* ]] && [[ ! -e /usr/lib64/libpython3.9.so ]] && emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot dev-lang/python:3.9
|
|
||||||
[[ "${GENTOO_PYTHON_TARGETS}" == *"python3_8"* ]] && [[ ! -e /usr/lib64/libpython3.8.so ]] && emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot dev-lang/python:3.8
|
|
||||||
[[ "${GENTOO_PYTHON_TARGETS}" == *"python3_7"* ]] && [[ ! -e /usr/lib64/libpython3.7m.so ]] && emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot dev-lang/python:3.7
|
|
||||||
[[ "${GENTOO_PYTHON_TARGETS}" == *"python3_6"* ]] && [[ ! -e /usr/lib64/libpython3.6m.so ]] && emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot dev-lang/python:3.6
|
|
||||||
[[ "${GENTOO_PYTHON_TARGETS}" == *"python3_5"* ]] && [[ ! -e /usr/lib64/libpython3.5m.so ]] && emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot dev-lang/python:3.5
|
|
||||||
[[ "${GENTOO_PYTHON_TARGETS}" == *"python3_4"* ]] && [[ ! -e /usr/lib64/libpython3.4m.so ]] && emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot dev-lang/python:3.4
|
|
||||||
[[ "${GENTOO_PYTHON_TARGETS}" == *"python2_7"* ]] && [[ ! -e /usr/lib64/libpython2.7.so ]] && emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot 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
|
||||||
[[ "${GENTOO_PYTHON_TARGETS}" != *"python2_7"* ]] && echo 'dev-vcs/git -python' >> /etc/portage/package.use/git
|
[[ "${GENTOO_PYTHON_TARGETS}" != *"python2_7"* ]] && echo 'dev-vcs/git -python' >> /etc/portage/package.use/git
|
||||||
|
|
||||||
# make sure we have the new python for portage bevore we possibly remove python 2.7
|
|
||||||
# this is done one by one with nodeps because it can sometimes have dependency loops
|
|
||||||
PYTHON_PACKAGES="dev-python/six dev-python/toml dev-python/pyproject2setuppy dev-python/packaging dev-python/appdirs dev-python/setuptools dev-python/pyparsing dev-python/certifi"
|
|
||||||
for PACKAGE in ${PYTHON_PACKAGES}; do
|
|
||||||
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot --update --newuse --deep --nodeps "${PACKAGE}"
|
|
||||||
done
|
|
||||||
# install portage first due to bug in env vars not being passed when portage installs itself and re-inits
|
# install portage first due to bug in env vars not being passed when portage installs itself and re-inits
|
||||||
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot sys-apps/portage
|
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --update --newuse --deep sys-apps/portage
|
||||||
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot --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}
|
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --oneshot --update --newuse --nodeps dev-lang/python-exec python-exec-conf
|
||||||
# allow these uninstalls to fail as they may not be installed to begin with
|
echo yes | etc-update --automode -3 /etc/python-exec/python-exec.conf
|
||||||
set +e
|
|
||||||
[[ "${GENTOO_PYTHON_TARGETS}" != *"python2_7"* ]] && emerge -C -q dev-lang/python:2.7
|
|
||||||
[[ "${GENTOO_PYTHON_TARGETS}" != *"python3_4"* ]] && emerge -C -q dev-lang/python:3.4
|
|
||||||
[[ "${GENTOO_PYTHON_TARGETS}" != *"python3_5"* ]] && emerge -C -q dev-lang/python:3.5
|
|
||||||
[[ "${GENTOO_PYTHON_TARGETS}" != *"python3_6"* ]] && emerge -C -q dev-lang/python:3.6
|
|
||||||
[[ "${GENTOO_PYTHON_TARGETS}" != *"python3_7"* ]] && emerge -C -q dev-lang/python:3.7
|
|
||||||
[[ "${GENTOO_PYTHON_TARGETS}" != *"python3_8"* ]] && emerge -C -q dev-lang/python:3.8
|
|
||||||
[[ "${GENTOO_PYTHON_TARGETS}" != *"python3_9"* ]] && emerge -C -q dev-lang/python:3.9
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# make world consistant
|
# make world consistant
|
||||||
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --complete-graph=y --update --newuse --deep @world
|
emerge ${GENTOO_EMERGE_DEFAULT_OPTS} --complete-graph=y --update --newuse --deep @world
|
||||||
|
@ -24,12 +24,8 @@ set -o pipefail
|
|||||||
[ -n "${ARCH}" ]
|
[ -n "${ARCH}" ]
|
||||||
[ -n "${TARGET_ROOT}" ]
|
[ -n "${TARGET_ROOT}" ]
|
||||||
|
|
||||||
if [ 'amd64' = "${ARCH}" ] ; then
|
if [[ 'amd64' != "${ARCH}" ]] && [[ 'arm64' != "${ARCH}" ]]; then
|
||||||
ARCH='x86_64'
|
echo "Only amd64 or arm64 images are currently available but ARCH is set to ${ARCH}."
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ 'x86_64' != "${ARCH}" ]] && [[ 'arm64' != "${ARCH}" ]]; then
|
|
||||||
echo "Only x86_64 or arm64 images are currently available but ARCH is set to ${ARCH}."
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user