cc3383
From b9b1f92cdc74beb8487c87aa2b5c2806e100d1aa Mon Sep 17 00:00:00 2001
cc3383
From: Frantisek Sumsal <frantisek@sumsal.cz>
cc3383
Date: Tue, 22 Feb 2022 14:43:40 +0100
cc3383
Subject: [PATCH] ci: fix clang-13 installation
cc3383
cc3383
For some reason Ubuntu Focal repositories now have `llvm-13` virtual
cc3383
package which can't be installed, but successfully fools our check,
cc3383
resulting in no clang/llvm being installed...
cc3383
cc3383
```
cc3383
$ apt show llvm-13
cc3383
Package: llvm-13
cc3383
State: not a real package (virtual)
cc3383
N: Can't select candidate version from package llvm-13 as it has no candidate
cc3383
N: Can't select versions from package 'llvm-13' as it is purely virtual
cc3383
N: No packages found
cc3383
cc3383
$ apt install --dry-run llvm-13
cc3383
Reading package lists... Done
cc3383
Building dependency tree
cc3383
Reading state information... Done
cc3383
Package llvm-13 is not available, but is referred to by another package.
cc3383
This may mean that the package is missing, has been obsoleted, or
cc3383
is only available from another source
cc3383
cc3383
E: Package 'llvm-13' has no installation candidate
cc3383
```
cc3383
cc3383
(cherry picked from commit b491d74064f9d5e17a71b38b014434237169a077)
cc3383
cc3383
Related: #2013213
cc3383
---
cc3383
 .github/workflows/build_test.sh | 4 ++--
cc3383
 1 file changed, 2 insertions(+), 2 deletions(-)
cc3383
cc3383
diff --git a/.github/workflows/build_test.sh b/.github/workflows/build_test.sh
cc3383
index 549e59b2c9..5a173a18d5 100755
cc3383
--- a/.github/workflows/build_test.sh
cc3383
+++ b/.github/workflows/build_test.sh
cc3383
@@ -78,12 +78,12 @@ if [[ "$COMPILER" == clang ]]; then
cc3383
     # ATTOW llvm-11 got into focal-updates, which conflicts with llvm-11
cc3383
     # provided by the apt.llvm.org repositories. Let's use the system
cc3383
     # llvm package if available in such cases to avoid that.
cc3383
-    if ! apt show --quiet "llvm-$COMPILER_VERSION" &>/dev/null; then
cc3383
+    if ! apt install --dry-run "llvm-$COMPILER_VERSION" >/dev/null; then
cc3383
         # Latest LLVM stack deb packages provided by https://apt.llvm.org/
cc3383
         # Following snippet was partly borrowed from https://apt.llvm.org/llvm.sh
cc3383
         wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --yes --dearmor --output /usr/share/keyrings/apt-llvm-org.gpg
cc3383
         printf "deb [signed-by=/usr/share/keyrings/apt-llvm-org.gpg] http://apt.llvm.org/%s/   llvm-toolchain-%s-%s  main\n" \
cc3383
-		"$RELEASE" "$RELEASE" "$COMPILER_VERSION" >/etc/apt/sources.list.d/llvm-toolchain.list
cc3383
+               "$RELEASE" "$RELEASE" "$COMPILER_VERSION" >/etc/apt/sources.list.d/llvm-toolchain.list
cc3383
         PACKAGES+=("clang-$COMPILER_VERSION" "lldb-$COMPILER_VERSION" "lld-$COMPILER_VERSION" "clangd-$COMPILER_VERSION")
cc3383
     fi
cc3383
 elif [[ "$COMPILER" == gcc ]]; then