Skip to content

Commit

Permalink
Merge pull request #909 from ocaml/fix-darcs
Browse files Browse the repository at this point in the history
Filter installable system dependencies correctly
  • Loading branch information
smorimoto authored Dec 6, 2024
2 parents 2760130 + 24c7ef0 commit f8e1b8d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
11 changes: 9 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions packages/setup-ocaml/src/unix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,22 @@ async function checkAptInstallability(packageName: string) {
"--names-only",
`'^${packageName}$'`,
]);
return output.stdout.length !== 0;
return output.stdout.length > 0;
}

async function retrieveInstallableOptionalDependencies(
optionalDependencies: string[],
) {
switch (PLATFORM) {
case "linux": {
return optionalDependencies.filter(
async (dep) => await checkAptInstallability(dep),
);
const installableOptionalDependencies: string[] = [];
for (const optionalDependency of optionalDependencies) {
const isInstallable = await checkAptInstallability(optionalDependency);
if (isInstallable) {
installableOptionalDependencies.push(optionalDependency);
}
}
return installableOptionalDependencies;
}
default: {
return [];
Expand Down

0 comments on commit f8e1b8d

Please sign in to comment.