aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-01-02 05:00:46 +0100
committerEgor Tensin <Egor.Tensin@gmail.com>2023-01-02 05:00:46 +0100
commit5cc3e086451d33a5f45585be560cc7d792e55bd5 (patch)
tree6ad7a2206fe1486de3af5cfca19e9e963fcb00d7
parentworkflows/test: upgrade actions (diff)
downloadsetup-clang-5cc3e086451d33a5f45585be560cc7d792e55bd5.tar.gz
setup-clang-5cc3e086451d33a5f45585be560cc7d792e55bd5.zip
simplify and future-proof adding apt repositories
-rw-r--r--action.yml39
1 files changed, 5 insertions, 34 deletions
diff --git a/action.yml b/action.yml
index fb0f7f9..7a03e6e 100644
--- a/action.yml
+++ b/action.yml
@@ -75,15 +75,6 @@ runs:
}
}
- function Get-DistroVersion {
- if (!(Get-Command lsb_release -ErrorAction SilentlyContinue)) {
- throw "Couldn't find lsb_release; LLVM only provides repositories for Debian/Ubuntu"
- }
- $distro = lsb_release -is
- $version = lsb_release -sr
- "$distro-$version"
- }
-
function Format-UpstreamVersion {
param(
[Parameter(Mandatory=$true)]
@@ -102,37 +93,17 @@ runs:
}
function Format-AptLine {
- # Source: https://apt.llvm.org/llvm.sh
- # Don't forget to update once in a while.
-
param(
[Parameter(Mandatory=$true)]
[string] $Version
)
- $distro = Get-DistroVersion
-
- switch -Wildcard -CaseSensitive ($distro) {
- 'Debian-9*' { "deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-$Version main" }
- 'Debian-10*' { "deb http://apt.llvm.org/buster/ llvm-toolchain-buster-$Version main" }
- 'Debian-11*' { "deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-$Version main" }
- 'Debian-unstable' { "deb http://apt.llvm.org/unstable/ llvm-toolchain-$Version main" }
- 'Debian-testing' { "deb http://apt.llvm.org/unstable/ llvm-toolchain-$Version main" }
- 'Ubuntu-16.04' { "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-$Version main" }
- 'Ubuntu-18.04' { "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-$Version main" }
- 'Ubuntu-18.10' { "deb http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic-$Version main" }
- 'Ubuntu-19.04' { "deb http://apt.llvm.org/disco/ llvm-toolchain-disco-$Version main" }
- 'Ubuntu-19.10' { "deb http://apt.llvm.org/eoan/ llvm-toolchain-eoan-$Version main" }
- 'Ubuntu-20.04' { "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-$Version main" }
- # WTF is this? As of 2021-10-15, Ubuntu 20.10 is missing from the upstream llvm.sh,
- # 21.04 (Hirsute) points to the the previous release (Groovy), and 21.10 (Impish)
- # also points to the previous release (Hirsute). A mistake on their part?
- 'Ubuntu-20.10' { "deb http://apt.llvm.org/groovy/ llvm-toolchain-groovy-$Version main" }
- 'Ubuntu-21.04' { "deb http://apt.llvm.org/groovy/ llvm-toolchain-groovy-$Version main" }
- 'Ubuntu-21.10' { "deb http://apt.llvm.org/hirsute/ llvm-toolchain-hirsute-$Version main" }
-
- default { throw "Unsupported distribution: $distro" }
+ if (!(Get-Command lsb_release -ErrorAction SilentlyContinue)) {
+ throw "Couldn't find lsb_release; LLVM only provides repositories for Debian/Ubuntu"
}
+ $codename = lsb_release -sc
+
+ "deb http://apt.llvm.org/$codename/ llvm-toolchain-$codename-$Version main"
}
function Add-UpstreamRepo {