Skip to content

Commit 1686a48

Browse files
authored
Merge pull request #918 from ocaml/opam-update-depext
Run `opam update --depext` before installing system dependencies
2 parents 373b552 + 582d101 commit 1686a48

File tree

3 files changed

+5
-47
lines changed

3 files changed

+5
-47
lines changed

dist/index.js

Lines changed: 2 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/setup-ocaml/src/opam.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ import {
1313
OPAM_DISABLE_SANDBOXING,
1414
PLATFORM,
1515
} from "./constants.js";
16-
import {
17-
installUnixSystemPackages,
18-
updateUnixPackageIndexFiles,
19-
} from "./unix.js";
16+
import { installUnixSystemPackages } from "./unix.js";
2017

2118
export async function retrieveLatestOpamRelease() {
2219
const semverRange = ALLOW_PRERELEASE_OPAM ? "*" : "<2.4.0";
@@ -88,18 +85,9 @@ async function acquireOpam() {
8885

8986
async function initializeOpam() {
9087
await core.group("Initialise opam state", async () => {
88+
await exec("opam", ["update", "--depexts"]);
9189
if (PLATFORM !== "windows") {
92-
try {
93-
await installUnixSystemPackages();
94-
} catch (error) {
95-
if (error instanceof Error) {
96-
core.notice(
97-
`An error has been caught in some system package index files, so the system package index files have been re-synchronised, and the system package installation has been retried: ${error.message.toLocaleLowerCase()}`,
98-
);
99-
}
100-
await updateUnixPackageIndexFiles();
101-
await installUnixSystemPackages();
102-
}
90+
await installUnixSystemPackages();
10391
}
10492
const extraOptions = [];
10593
if (PLATFORM === "windows") {

packages/setup-ocaml/src/unix.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,3 @@ export async function installUnixSystemPackages() {
5656
}
5757
}
5858
}
59-
60-
export async function updateUnixPackageIndexFiles() {
61-
const isGitHubRunner = process.env.GITHUB_ACTIONS === "true";
62-
if (isGitHubRunner) {
63-
if (PLATFORM === "linux") {
64-
await exec("sudo", ["apt-get", "update"]);
65-
} else if (PLATFORM === "macos") {
66-
await exec("brew", ["update"]);
67-
}
68-
}
69-
}

0 commit comments

Comments
 (0)