Skip to content

Commit

Permalink
Merge pull request #2407 from TheCakeIsNaOH/octave
Browse files Browse the repository at this point in the history
(octave.portable) Removes 32 bit support
  • Loading branch information
JPRuskin authored Jun 13, 2024
2 parents e90e5a0 + f53afba commit c3df9a2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 36 deletions.
2 changes: 0 additions & 2 deletions automatic/octave.portable/legal/VERIFICATION.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ location on <https://www.gnu.org/software/octave/download.html>
and can be verified by doing the following:

1. Download the following:
32-bit software: <https://ftp.gnu.org/gnu/octave/windows/octave-8.2.0-w32.7z>
64-bit software: <https://ftp.gnu.org/gnu/octave/windows/octave-8.2.0-w64.7z>

2. Get the checksum using one of the following methods:
Expand All @@ -18,7 +17,6 @@ and can be verified by doing the following:
3. The checksums should match the following:

checksum type: sha256
checksum32: 9d6a81d86d7128775f8e821d89704582da81cee51400071c6d099118c983f37a
checksum64: 6c07a7e5cf748e2efc2ae719dd8ad9b07e41cf7abb645b84cf753b6e0cc2bfd4

File 'gpl-3.0.txt' is obtained from <https://www.gnu.org/software/octave/license.html>
15 changes: 4 additions & 11 deletions automatic/octave.portable/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,20 @@ $version = '8.2.0'
$toolsDir = $(Split-Path -parent $MyInvocation.MyCommand.Definition)
$progDir = "$toolsDir\octave"

$osBitness = Get-OSArchitectureWidth

$packageArgs = @{
PackageName = 'octave.portable'
UnzipLocation = $toolsDir
Url = 'https://ftp.gnu.org/gnu/octave/windows/octave-8.2.0-w32.7z'
Url64 = 'https://ftp.gnu.org/gnu/octave/windows/octave-8.2.0-w64.7z'
Checksum = '9d6a81d86d7128775f8e821d89704582da81cee51400071c6d099118c983f37a'
Checksum64 = '6c07a7e5cf748e2efc2ae719dd8ad9b07e41cf7abb645b84cf753b6e0cc2bfd4'
ChecksumType = 'sha256'
ChecksumType64 = 'sha256'
}

Install-ChocolateyZipPackage @packageArgs

# Rename unzipped folder
If (Test-Path "$toolsDir\octave-$version-w$osBitness") {
Rename-Item -Path "$toolsDir\octave-$version-w$osBitness" -NewName 'octave'
}
If (Test-Path "$toolsDir\octave-$version") {
Rename-Item -Path "$toolsDir\octave-$version" -NewName 'octave'
If (Test-Path "$toolsDir\octave-$version-w64") {
Rename-Item -Path "$toolsDir\octave-$version-w64" -NewName 'octave'
}

# Don't create shims for any executables
Expand All @@ -35,7 +28,7 @@ foreach ($file in $files) {
}

# Link batch
$path = "$progDir\mingw$osBitness\bin\octave.bat"
$path = "$progDir\mingw64\bin\octave.bat"
Install-BinFile -Name 'octave' -Path $path -Command '--gui' -UseStart
Install-BinFile -Name 'octave-cli' -Path $path -Command '--no-gui'

Expand Down Expand Up @@ -65,7 +58,7 @@ if ($pp.Count -gt 0) {
}

if ($paths.Count -gt 0) {
$icon = "$progDir\mingw$osBitness\share\octave\$version\imagelib\octave-logo.ico"
$icon = "$progDir\mingw64\share\octave\$version\imagelib\octave-logo.ico"
$target = "$progDir\octave.vbs"

$paths.GetEnumerator() | foreach-object {
Expand Down
29 changes: 6 additions & 23 deletions automatic/octave.portable/update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,21 @@ Import-Module Chocolatey-AU
$releases = "https://ftp.gnu.org/gnu/octave/windows/?C=M;O=D"

function global:au_BeforeUpdate {
$checksumType = 'sha256'
$Latest.ChecksumType64 = $Latest.ChecksumType32 = $checksumType

$Latest.Checksum32 = Get-RemoteChecksum $Latest.URL32 -Algorithm $checksumType
$Latest.Checksum64 = Get-RemoteChecksum $Latest.URL64 -Algorithm $checksumType
$Latest.Checksum64 = Get-RemoteChecksum $Latest.URL64 -Algorithm $Latest.checksumType64
}

function global:au_SearchReplace {
@{
".\legal\VERIFICATION.txt" = @{
"(?i)(^\s*32\-bit software.*)\<.*\>" = "`${1}<$($Latest.URL32)>"
"(?i)(^\s*64\-bit software.*)\<.*\>" = "`${1}<$($Latest.URL64)>"
"(?i)(^\s*checksum\s*type\:).*" = "`${1} $($Latest.ChecksumType32)"
"(?i)(^\s*checksum32?\:).*" = "`${1} $($Latest.Checksum32)"
"(?i)(^\s*checksum\s*type\:).*" = "`${1} $($Latest.ChecksumType64)"
"(?i)(^\s*checksum64\:).*" = "`${1} $($Latest.Checksum64)"
}

".\tools\chocolateyInstall.ps1" = @{
"(?i)(^\s*\`$version\s*=\s*)('.*')" = "`${1}'$($Latest.Version)'"
"(?i)(^\s*Url\s*=\s*)('.*')" = "`${1}'$($Latest.URL32)'"
"(?i)(^\s*Url64\s*=\s*)('.*')" = "`${1}'$($Latest.URL64)'"
"(?i)(^\s*Checksum\s*=\s*)('.*')" = "`${1}'$($Latest.Checksum32)'"
"(?i)(^\s*Checksum64\s*=\s*)('.*')" = "`${1}'$($Latest.Checksum64)'"
"(?i)(^\s*ChecksumType\s*=\s*)('.*')" = "`${1}'$($Latest.ChecksumType32)'"
"(?i)(^\s*ChecksumType64\s*=\s*)('.*')" = "`${1}'$($Latest.ChecksumType64)'"
}

Expand All @@ -43,30 +34,22 @@ function global:au_SearchReplace {
function global:au_GetLatest {
$download_page = Invoke-WebRequest -Uri $releases -UseBasicParsing

$re = 'octave-.*-.*w(64|32)\.7z$'
$urls = $download_page.links | where-object href -match $re | select-object -First 2 -expand href | foreach-object{ New-Object uri([uri]$releases, $_) }

$url32 = $urls -match "w32" | select-object -first 1
$url64 = $urls -match "w64" | select-object -first 1
$re = 'octave-.*-.*w64\.7z$'
$url64 = $download_page.links | where-object href -match $re | select-object -First 1 -expand href | foreach-object{ New-Object uri([uri]$releases, $_) }

$version32 = $url32 -split '[-]' | select-object -Last 1 -Skip 1
$version64 = $url64 -split '[-]' | select-object -Last 1 -Skip 1

if ($version32 -ne $version64) {
throw "32bit and 64bit versions do not match. Please Investigate."
}

$releases_url = "https://www.gnu.org/software/octave/news.html"
$releases_page = Invoke-WebRequest -Uri $releases_url -UseBasicParsing
$re = 'octave-.*-released'
$releaseNotes = $releases_page.links | where-object href -match $re | select-object -First 1 -expand href | foreach-object { New-Object uri([uri]$releases_url, $_) }

return @{
Version = $version32.Replace('_', '.')
URL32 = $url32
Version = $version64.Replace('_', '.')
URL64 = $url64
ReleaseNotes = $releaseNotes
UpdateYear = (Get-Date).ToString('yyyy')
ChecksumType64 = 'sha256'
}
}

Expand Down

0 comments on commit c3df9a2

Please sign in to comment.