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