Skip to content

Commit 96f3daf

Browse files
committed
Remove apt (ppa:hvr) fallback install method
This PR replicates haskell/actions#138 by Bodigrim. For recent Ubuntu (> 20.04) the PPA hvr does not provide any GHC releases, so this install method is now dead.
1 parent b8bca22 commit 96f3daf

File tree

4 files changed

+9
-68
lines changed

4 files changed

+9
-68
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ This action sets up a Haskell environment for use in actions by:
1111
The GitHub runners come with [pre-installed versions of GHC and Cabal](https://github.com/actions/runner-images).
1212
Those will be used whenever possible.
1313
For all other versions, this action utilizes
14-
[`ppa:hvr/ghc`](https://launchpad.net/~hvr/+archive/ubuntu/ghc),
1514
[`ghcup`](https://github.com/haskell/ghcup-hs), and
1615
[`chocolatey`](https://chocolatey.org/packages/ghc).
1716

dist/index.js

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

lib/installer.js

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

src/installer.ts

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ function warn(tool: Tool, version: string): void {
6060
);
6161
}
6262

63-
function aptVersion(tool: string, version: string): string {
64-
// For Cabal, extract the first two segments of the version number.
65-
// This regex is intentionally liberal to accommodate unusual cases like "head".
66-
return tool === 'cabal' ? /[^.]*\.?[^.]*/.exec(version)![0] : version;
67-
}
68-
6963
async function isInstalled(
7064
tool: Tool,
7165
version: string,
@@ -79,10 +73,6 @@ async function isInstalled(
7973
const ghcupPath =
8074
os === 'win32' ? 'C:/ghcup/bin' : `${process.env.HOME}/.ghcup/bin`;
8175

82-
// Path where apt installs binaries of a tool
83-
const v = aptVersion(tool, version);
84-
const aptPath = `/opt/${tool}/${v}/bin`;
85-
8676
// Path where choco installs binaries of a tool
8777
const chocoPath = await getChocoPath(
8878
tool,
@@ -94,12 +84,12 @@ async function isInstalled(
9484
stack: [], // Always installed into the tool cache
9585
cabal: {
9686
win32: [chocoPath, ghcupPath],
97-
linux: [aptPath, ghcupPath],
87+
linux: [ghcupPath],
9888
darwin: [ghcupPath]
9989
}[os],
10090
ghc: {
10191
win32: [chocoPath, ghcupPath],
102-
linux: [aptPath, ghcupPath],
92+
linux: [ghcupPath],
10393
darwin: [ghcupPath]
10494
}[os]
10595
};
@@ -141,7 +131,7 @@ async function isInstalled(
141131
await exec(await ghcupBin(os, arch), ['unset', tool]);
142132
}
143133
} else {
144-
// Install methods apt and choco have precise install paths,
134+
// Install method choco has precise install paths,
145135
// so if the install path is present, the tool should be present, too.
146136
return success(tool, version, installedPath, os);
147137
}
@@ -187,8 +177,6 @@ export async function installTool(
187177
await aptLibNCurses5();
188178
}
189179
await ghcup(tool, version, os, arch);
190-
if (await isInstalled(tool, version, os, arch)) return;
191-
await apt(tool, version);
192180
break;
193181
case 'win32':
194182
await choco(tool, version);
@@ -292,16 +280,6 @@ async function aptLibNCurses5(): Promise<boolean> {
292280
return returnCode === 0;
293281
}
294282

295-
async function apt(tool: Tool, version: string): Promise<void> {
296-
const toolName = tool === 'ghc' ? 'ghc' : 'cabal-install';
297-
const v = aptVersion(tool, version);
298-
core.info(`Attempting to install ${toolName} ${v} using apt-get`);
299-
// Ignore the return code so we can fall back to ghcup
300-
await exec(
301-
`sudo -- sh -c "add-apt-repository -y ppa:hvr/ghc && apt-get update && apt-get -y install ${toolName}-${v}"`
302-
);
303-
}
304-
305283
async function choco(tool: Tool, version: string): Promise<void> {
306284
core.info(`Attempting to install ${tool} ${version} using chocolatey`);
307285

0 commit comments

Comments
 (0)