@@ -60,12 +60,6 @@ function warn(tool: Tool, version: string): void {
60
60
) ;
61
61
}
62
62
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
-
69
63
async function isInstalled (
70
64
tool : Tool ,
71
65
version : string ,
@@ -79,10 +73,6 @@ async function isInstalled(
79
73
const ghcupPath =
80
74
os === 'win32' ? 'C:/ghcup/bin' : `${ process . env . HOME } /.ghcup/bin` ;
81
75
82
- // Path where apt installs binaries of a tool
83
- const v = aptVersion ( tool , version ) ;
84
- const aptPath = `/opt/${ tool } /${ v } /bin` ;
85
-
86
76
// Path where choco installs binaries of a tool
87
77
const chocoPath = await getChocoPath (
88
78
tool ,
@@ -94,12 +84,12 @@ async function isInstalled(
94
84
stack : [ ] , // Always installed into the tool cache
95
85
cabal : {
96
86
win32 : [ chocoPath , ghcupPath ] ,
97
- linux : [ aptPath , ghcupPath ] ,
87
+ linux : [ ghcupPath ] ,
98
88
darwin : [ ghcupPath ]
99
89
} [ os ] ,
100
90
ghc : {
101
91
win32 : [ chocoPath , ghcupPath ] ,
102
- linux : [ aptPath , ghcupPath ] ,
92
+ linux : [ ghcupPath ] ,
103
93
darwin : [ ghcupPath ]
104
94
} [ os ]
105
95
} ;
@@ -141,7 +131,7 @@ async function isInstalled(
141
131
await exec ( await ghcupBin ( os , arch ) , [ 'unset' , tool ] ) ;
142
132
}
143
133
} else {
144
- // Install methods apt and choco have precise install paths,
134
+ // Install method choco has precise install paths,
145
135
// so if the install path is present, the tool should be present, too.
146
136
return success ( tool , version , installedPath , os ) ;
147
137
}
@@ -187,8 +177,6 @@ export async function installTool(
187
177
await aptLibNCurses5 ( ) ;
188
178
}
189
179
await ghcup ( tool , version , os , arch ) ;
190
- if ( await isInstalled ( tool , version , os , arch ) ) return ;
191
- await apt ( tool , version ) ;
192
180
break ;
193
181
case 'win32' :
194
182
await choco ( tool , version ) ;
@@ -292,16 +280,6 @@ async function aptLibNCurses5(): Promise<boolean> {
292
280
return returnCode === 0 ;
293
281
}
294
282
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
-
305
283
async function choco ( tool : Tool , version : string ) : Promise < void > {
306
284
core . info ( `Attempting to install ${ tool } ${ version } using chocolatey` ) ;
307
285
0 commit comments