Clang-9 build not working after migration from travis-ci.org to travis-ci.com

Finally migrated OSS repo from travis-ci.org to travis-ci.com, but our clang-9 build isn’t working after the migration. How do we fix it? Please help!

This is what we’ve been using:

dist: xenial

    - compiler: clang
      addons:
        apt:
          sources:
            - ubuntu-toolchain-r-test
            - sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
              key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
          packages:
            - clang-9
        artifacts: true
      env:
        - MATRIX_EVAL="CC=clang-9 && CXX=clang++-9"

Job output shows clang-9 is installed, but then this happens:

Setting environment variables from .travis.yml
$ export MATRIX_EVAL="CC=clang-9 && CXX=clang++-9"
$ export TRAVIS_COMPILER=clang
$ export CXX=${CXX:-clang++}
$ export CXX_FOR_BUILD=${CXX_FOR_BUILD:-clang++}
$ export CC=${CC:-clang}
$ export CC_FOR_BUILD=${CC_FOR_BUILD:-clang}
$ clang --version
clang version 7.0.0 (tags/RELEASE_700/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-7.0.0/bin
before_install.1
0.00s$ eval "${MATRIX_EVAL}"
2.68s$ . scripts/travis-$TRAVIS_OS_NAME.sh
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'python-clang-9' for regex 'clang++-9'
Note, selecting 'clang-9' for regex 'clang++-9'
Note, selecting 'clang-9-examples' for regex 'clang++-9'
Note, selecting 'libclang-9-dev' for regex 'clang++-9'
Note, selecting 'clang-9-doc' for regex 'clang++-9'
Note, selecting 'python3-clang-9' for regex 'clang++-9'
uuid-dev is already the newest version (2.27.1-6ubuntu3.10).
clang-9 is already the newest version (1:9~+20210314105943+c1a0a213378a-1~exp1~20210314220516.107).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
 python3-clang-9 : Breaks: python-clang-9 (< 1:9.0.1-3) but 1:9~+20210314105943+c1a0a213378a-1~exp1~20210314220516.107 is to be installed
E: Unable to correct problems, you have held broken packages.
The command ". scripts/travis-$TRAVIS_OS_NAME.sh" failed and exited with 100 during .
Your build has been stopped.

scripts/travis-$TRAVIS_OS_NAME.sh should be scripts/travis-linux.sh, which contains the following commands:

sudo apt-get update -qq
COMPILER_PACKAGE=$CXX
sudo apt-get install -y libboost-all-dev gperf libevent-dev uuid-dev python-sphinx libhiredis-dev $COMPILER_PACKAGE

Ended up changing our travis-linux.sh script to the following:

sudo apt-get update -qq
COMPILER_PACKAGE=$CXX
if echo "$COMPILER_PACKAGE" | grep -q '^clang++-'; then
    COMPILER_PACKAGE=$CC
fi
sudo apt-get install -y libboost-all-dev gperf libevent-dev uuid-dev python-sphinx libhiredis-dev $COMPILER_PACKAGE

And that seemed to fix the problem. apt-get was interpreting ‘clang+±9’ as a regex and it matched some python package. Clearly not what was intended. Not sure why this wasn’t a problem with our clang 4.9, 5, 6, 7, and 8 builds…

If anyone has a better solution, feel free to make a suggestion.