@@ -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-
6963async 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-
305283async function choco ( tool : Tool , version : string ) : Promise < void > {
306284 core . info ( `Attempting to install ${ tool } ${ version } using chocolatey` ) ;
307285
0 commit comments