Skip to content

Commit

Permalink
Pin the Python 3 version to 3.8 in Clang/GCC Linux Containers (#3147)
Browse files Browse the repository at this point in the history
This affects only clang and gcc linux images used to build Cobalt on
older toolchains to monitor for breaking changes to partner toolchains.
The python version available in Ubuntu Bionic is 3.6.9 which is older
than what we guarantee at 3.8.x. We cannot upgrade the Linux distro here
since it provides the specific clang 3.9 and gcc 6.3 versions, so as a
workaround we backport python 3.8 from a PPA.

b/338466640
  • Loading branch information
arjungm committed May 6, 2024
1 parent 38d4e2b commit 4000da2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docker/linux/clang-3-9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ RUN apt update -qqy \
&& add-apt-repository -y ppa:savoury1/backports \
&& apt update -qqy \
&& apt install -qqy --no-install-recommends git nasm \
python3.8 python3.8-dev python3.8-venv \
&& /opt/clean-after-apt.sh

# TODO(b/338650174): Upgrade the base linux distro to avoid backporting python
# 3.8 manually. Additionally, this involves upgrading clang or backporting
# the current version (3.9) to the new distro.
RUN python3.8 -m venv /python38_env
ENV VIRTUAL_ENV /python38_env
ENV PATH /python38_env/bin:$PATH

CMD gn gen ${OUTDIR}/${PLATFORM}_${CONFIG} --args="target_platform=\"${PLATFORM}\" build_type=\"${CONFIG}\" using_old_compiler=true build_with_separate_cobalt_toolchain=true" && \
ninja -v -j ${NINJA_PARALLEL} -C ${OUTDIR}/${PLATFORM}_${CONFIG} ${TARGET:-cobalt_install}
8 changes: 8 additions & 0 deletions docker/linux/gcc-6-3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ RUN apt update -qqy \
&& add-apt-repository -y ppa:savoury1/backports \
&& apt update -qqy \
&& apt install -qqy --no-install-recommends git nasm \
python3.8 python3.8-dev python3.8-venv \
&& /opt/clean-after-apt.sh

# TODO(b/338650174): Upgrade the base linux distro to avoid backporting python
# 3.8 manually. Additionally, this involves upgrading gcc or backporting
# the current version (6.3) to the new distro.
RUN python3.8 -m venv /python38_env
ENV VIRTUAL_ENV /python38_env
ENV PATH /python38_env/bin:$PATH

CMD gn gen ${OUTDIR}/${PLATFORM}${SB_API_VERSION:+-sbversion-$SB_API_VERSION}_${CONFIG:-debug} --args="target_platform=\"${PLATFORM}\" build_type=\"${CONFIG:-debug}\" build_with_separate_cobalt_toolchain=true using_old_compiler=true ${SB_API_VERSION:+sb_api_version=$SB_API_VERSION}" && \
ninja -v -j ${NINJA_PARALLEL} -C ${OUTDIR}/${PLATFORM}${SB_API_VERSION:+-sbversion-$SB_API_VERSION}_${CONFIG:-debug} ${TARGET:-cobalt_install}

0 comments on commit 4000da2

Please sign in to comment.