Skip to content

Commit 0a171e6

Browse files
authored
Merge pull request #879 from ocaml/fix-darcs
Fix darcs installation failure on latest Ubuntu image
2 parents 5279fd0 + 2ae7a65 commit 0a171e6

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0),
66

77
## [unreleased]
88

9+
### Fixed
10+
11+
- Fix darcs installation failure on latest Ubuntu image.
12+
913
## [3.0.9]
1014

1115
### Changed

dist/index.js

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

packages/setup-ocaml/src/unix.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,39 @@
11
import * as process from "node:process";
2-
import { exec } from "@actions/exec";
2+
import { exec, getExecOutput } from "@actions/exec";
33
import { PLATFORM } from "./constants.js";
44

5+
async function checkInstallability(packageName: string) {
6+
const output = await getExecOutput("sudo", [
7+
"apt-cache",
8+
"search",
9+
"--names-only",
10+
`'^${packageName}$'`,
11+
]);
12+
return output.stdout.length !== 0;
13+
}
14+
515
export async function installUnixSystemPackages() {
616
const isGitHubRunner = process.env.GITHUB_ACTIONS === "true";
717
if (isGitHubRunner) {
818
if (PLATFORM === "linux") {
19+
const darcs = await (async () => {
20+
const installability = await checkInstallability("darcs");
21+
if (installability) {
22+
return ["darcs"];
23+
}
24+
return [];
25+
})();
926
await exec("sudo", [
1027
"apt-get",
1128
"--yes",
1229
"install",
1330
"bubblewrap",
14-
"darcs",
1531
"g++-multilib",
1632
"gcc-multilib",
1733
"mercurial",
1834
"musl-tools",
1935
"rsync",
36+
...darcs,
2037
]);
2138
} else if (PLATFORM === "macos") {
2239
await exec("brew", ["install", "darcs", "gpatch", "mercurial"]);

0 commit comments

Comments
 (0)