Skip to content

Commit

Permalink
[Tests] Fix conan install of cpython
Browse files Browse the repository at this point in the history
Due to a new `xorg/system` recipe, which the cpython recipe depends on,
the `conan install` step on CI (and Vagrant) fails attempting to
install system packages (i.e. `apt` packages).

This is because the `xorg/system` recipe has been refactored and will
now always try to install the latest version of system packages, even
if they are already available.

The default conan mode in this case is to only "check" if packages are
installed and throw an error if they're not found (the alternative
behaviour being to "install" if not found). However, this has a bug
(reported and hopefully fixed in
conan-io/conan#11712), whereby if the recipe has
specified to `apt-get update` (or platform-specific equivalent) before
installing, then conan always tries and throws an error if in "check"
mode.

So switch to "install" mode, which will cause a pointless
`apt-get update` followed by
> xorg/system: System requirements:  already installed
during the conan install.

Also extracted the list of system packages required by the latest
`xorg/system` recipe and updated the package list in our bootstrap
script.

Added a TODO to revisit this once conan 1.51 is released, where this
problem should be fixed.

Signed-off-by: David Feltell <david.feltell@foundry.com>
  • Loading branch information
feltech committed Jul 27, 2022
1 parent 12fe764 commit d9b1870
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 15 additions & 7 deletions resources/build/bootstrap-ubuntu-20.04.sh
Expand Up @@ -10,13 +10,14 @@ sudo apt-get install -y build-essential pkgconf clang-format-12 clang-tidy-12 py
# These would be installed as part of the conan package install, but
# we're caching the conan directory via the `actions/cache` Github
# action, so a fresh Github VM is left without these system packages.
sudo apt-get install -y --no-install-recommends libfontenc-dev libx11-xcb-dev libxaw7-dev \
libxcb-dri3-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev \
libxcb-render-util0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-util-dev libxcb-xfixes0-dev \
libxcb-xinerama0-dev libxcb-xkb-dev libxcomposite-dev libxcursor-dev libxdamage-dev \
libxfixes-dev libxi-dev libxinerama-dev libxmu-dev libxmuu-dev libxpm-dev libxrandr-dev \
libxres-dev libxss-dev libxtst-dev libxv-dev libxvmc-dev libxxf86vm-dev uuid-dev \
libxkbfile-dev
sudo apt-get install -y --no-install-recommends libfontenc-dev libice-dev libsm-dev libx11-dev \
libx11-xcb-dev libxau-dev libxaw7-dev libxcb-dri3-dev libxcb-icccm4-dev libxcb-image0-dev \
libxcb-keysyms1-dev libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev \
libxcb-shape0-dev libxcb-sync-dev libxcb-util-dev libxcb-xfixes0-dev libxcb-xinerama0-dev \
libxcb-xkb-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev \
libxfixes-dev libxi-dev libxinerama-dev libxkbfile-dev libxmu-dev libxmuu-dev libxpm-dev \
libxrandr-dev libxrender-dev libxres-dev libxss-dev libxt-dev libxtst-dev libxv-dev libxvmc-dev \
libxxf86vm-dev uuid-dev xkb-data xtrans-dev

# Install additional build tools.
sudo pip3 install -r "$WORKSPACE/resources/build/requirements.txt"
Expand All @@ -32,7 +33,14 @@ conan profile new default --detect --force
conan profile update settings.compiler.libcxx=libstdc++ default
# Install openassetio third-party dependencies from public Conan Center
# package repo.
# TODO(DF): conan<1.51 (not yet released) has a bug that means we have
# to allow conan recipes to try to install system packages, even if the
# system packages are already available. In particular, this affects
# recent versions of the xorg/system recipe (a dependency of cpython).
# The problem is reported and fixed in https://github.com/conan-io/conan/pull/11712
conan install --install-folder "$CONAN_USER_HOME" --build=missing \
-c tools.system.package_manager:mode=install \
-c tools.system.package_manager:sudo=True \
"$WORKSPACE/resources/build"
# Ensure we have the expected version of clang-* available
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-12 10
Expand Down
2 changes: 1 addition & 1 deletion resources/build/requirements.txt
@@ -1,4 +1,4 @@
conan==1.48.1
conan==1.50.0
cmake==3.21
ninja==1.10.2.3
cpplint==1.5.5

0 comments on commit d9b1870

Please sign in to comment.