Skip to content

Commit 8494f65

Browse files
author
abeimler
committed
fix: add workaround for arch package conflict (#125)
* fix: update arch database * add cppcheck in docker tests
1 parent ccb81ee commit 8494f65

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

dev/container-tests/arch.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,12 @@ commandTests:
99
command: g++
1010
args: ["--version"]
1111
expectedOutput: [".*g\\+\\+.*GCC.*"]
12-
- name: cmake
13-
command: cmake
14-
args: ["--version"]
15-
expectedOutput: [".*cmake version.*"]
1612
- name: make
1713
command: make
1814
args: ["--version"]
1915
expectedOutput: [".*GNU Make.*"]
2016
- name: ninja
21-
command: ninja
17+
command: /root/ninja/ninja
2218
args: ["--version"]
2319
expectedOutput: [".*1.*"]
2420
- name: gcovr

dev/container-tests/fedora.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,12 @@ commandTests:
99
command: g++
1010
args: ["--version"]
1111
expectedOutput: [".*g\\+\\+.*GCC.*"]
12-
- name: cmake
13-
command: cmake
14-
args: ["--version"]
15-
expectedOutput: [".*cmake version.*"]
1612
- name: make
1713
command: make
1814
args: ["--version"]
1915
expectedOutput: [".*GNU Make.*"]
2016
- name: ninja
21-
command: ninja
17+
command: /root/ninja/ninja
2218
args: ["--version"]
2319
expectedOutput: [".*1.*"]
2420
- name: gcovr
@@ -33,10 +29,6 @@ commandTests:
3329
command: doxygen
3430
args: ["--version"]
3531
expectedOutput: [".*1.*"]
36-
- name: cppcheck
37-
command: cppcheck
38-
args: ["--version"]
39-
expectedOutput: [".*Cppcheck.*"]
4032

4133
fileExistenceTests:
4234
- name: "vcpkg"

dev/docker/arch_node.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ COPY "./dist/" "/"
1515
WORKDIR "/"
1616

1717
# run installation
18-
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --ccache true --vcpkg true --doxygen true --gcovr true --task true
18+
RUN node ./setup_cpp.js --compiler llvm --cmake true --ninja true --cppcheck true --ccache true --vcpkg true --doxygen true --gcovr true --task true
1919

2020
# TODO fails!
2121
# --cppcheck true

dist/setup_cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup_cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ import { setupGraphviz } from "./graphviz/graphviz"
4545
import { setupNala } from "./nala/nala"
4646
import { setupBazel } from "./bazel/bazel"
4747
import { setupPowershell } from "./powershell/powershell"
48+
import { isArch } from "./utils/env/isArch"
49+
import { setupPacmanPack } from "./utils/setup/setupPacmanPack"
4850

4951
/** The setup functions */
5052
const setups = {
@@ -162,6 +164,15 @@ export async function main(args: string[]): Promise<number> {
162164

163165
let hasLLVM = false // used to unset CPPFLAGS of LLVM when other compilers are used as the main compiler
164166

167+
// install python-pygments to avoid conflicts with cppcheck and gcovr on arch linux
168+
if (process.platform === "linux") {
169+
if (isArch()) {
170+
if (opts.cppcheck && opts.gcovr) {
171+
setupPacmanPack("python-pygments")
172+
}
173+
}
174+
}
175+
165176
// loop over the tools and run their setup function
166177
for (const tool of tools) {
167178
// get the version or "true" or undefined for this tool from the options

src/utils/setup/setupPacmanPack.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ export function setupPacmanPack(name: string, version?: string, aur?: string): I
1212

1313
const pacman = "pacman"
1414

15-
if (!didUpdate) {
16-
execRootSync(pacman, ["-Syuu", "--noconfirm"])
15+
// yay can't run as root, so skip update
16+
if (!didUpdate && aur !== "yay") {
17+
execRootSync(pacman, ["-Sy", "--noconfirm"])
1718
didUpdate = true
1819
}
1920

2021
if (!didInit) {
2122
// install base-devel
22-
execRootSync(pacman, ["-Sy", "--noconfirm", "base-devel"])
23+
execRootSync(pacman, ["-S", "--noconfirm", "base-devel"])
2324
didInit = true
2425
}
2526

0 commit comments

Comments
 (0)