Skip to content

Commit

Permalink
Merge pull request #3 from whisperity/fix/alternatives
Browse files Browse the repository at this point in the history
Fix install of `clang-tidy` conflicting with the alternatives system.
  • Loading branch information
whisperity committed Jun 9, 2022
2 parents a052369 + 26b43fa commit aa43d49
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
branches:
- master
- 'releases/*'
- 'fix/*'
- 'feat/*'
paths-ignore:
- '**.md'

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,12 @@ Please refer to earlier parts of the documentation for the configuration of thes

### Versions to install

| Variable | Default | Description |
|------------------|------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `llvm-version` | `latest` | The major version of LLVM to install and use. LLVM is installed from [PPA](http://apt.llvm.org/). If `latest`, automatically gather the latest version. If `ignore`, don't install anything. (Not recommended) |
| `install-custom` | `false` | If set to `true`, opens the ability to locally clone and install CodeChecker from the specified `repository` and `version`. Otherwise, `version` is taken as a release version, and the [CodeChecker suite from PyPI](http://pypi.org/project/codechecker) is downloaded. |
| `repository` | [`Ericsson/CodeChecker`](http://github.com/Ericsson/CodeChecker) | The CodeChecker repository to check out and build, if `install-custom` is `true`. |
| `version` | `master` | If `install-custom` is `false`, the release version (e.g. `6.18.0`) to download from PyPI, or `master` to fetch the latest release. Otherwise, the branch (defaulting to `master`), tag, or commit SHA in the `repository` to check out. |
| Variable | Default | Description |
|------------------|------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `llvm-version` | `latest` | The major version of LLVM to install and use. LLVM is installed from the community [PPA](http://apt.llvm.org/). The value **MUST** be a major version (e.g. `13`) that is supported by the _PPA_ for the OS used! If `latest`, automatically gather the latest (yet unreleased) version. If `ignore`, don't install anything. (Not recommended.) |
| `install-custom` | `false` | If set to `true`, opens the ability to locally clone and install CodeChecker from the specified `repository` and `version`. Otherwise, `version` is taken as a release version, and the [CodeChecker suite from PyPI](http://pypi.org/project/codechecker) is downloaded. |
| `repository` | [`Ericsson/CodeChecker`](http://github.com/Ericsson/CodeChecker) | The CodeChecker repository to check out and build, if `install-custom` is `true`. |
| `version` | `master` | If `install-custom` is `false`, the release version (e.g. `6.18.0`) to download from PyPI, or `master` to fetch the latest release. Otherwise, the branch (defaulting to `master`), tag, or commit SHA in the `repository` to check out. |

### Build log configuration

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ inputs:
required: true
default: 'master'
llvm-version:
description: 'The major version of LLVM to install and use. LLVM is installed from PPA. If "latest", automatically gather the latest version. If "ignore", do not install anything. (Not recommended)'
description: 'The major version of LLVM to install and use. LLVM is installed from the community PPA at http://apt.llvm.org. The value MUST be a major version (e.g. 13) that is supported by the PPA for the OS used! If "latest", automatically gather the latest version. If "ignore", do not install anything. (Not recommended.)'
required: true
default: 'latest'

Expand Down
14 changes: 9 additions & 5 deletions src/get-llvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ fi

echo "::group::Installing LLVM"

update-alternatives --query clang
update-alternatives --query clang-tidy

export DISTRO_FANCYNAME="$(lsb_release -c | awk '{ print $2 }')"
curl -sL http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -

Expand All @@ -21,12 +24,13 @@ fi
sudo apt-get -y --no-install-recommends install \
clang-$LLVM_VER \
clang-tidy-$LLVM_VER
sudo update-alternatives --install \
/usr/bin/clang clang /usr/bin/clang-$LLVM_VER 1000 \
--slave \
/usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-$LLVM_VER
echo "::endgroup::"
sudo update-alternatives --install \
/usr/bin/clang clang /usr/bin/clang-$LLVM_VER 10000
sudo update-alternatives --install \
/usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-$LLVM_VER 10000

update-alternatives --query clang
update-alternatives --query clang-tidy
echo "::endgroup::"

echo "::set-output name=REAL_VERSION::$(clang --version | head -n 1 | cut -d' ' -f4-)"

0 comments on commit aa43d49

Please sign in to comment.