Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): Bump to version 0.5.0 #6035

Merged
merged 35 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2dd91d5
feat(sqlite): Use SQLite for caching apps to speed up local search (#…
niheaven Apr 19, 2024
eac5840
fix(sqlite): Skip `use_sqlite_cache` config on ARM64 platform (#5918)
niheaven Apr 25, 2024
bb88dfb
Sync 'master' branch
niheaven Apr 25, 2024
3b34497
fix(json): Serialize jsonpath return (#5921)
chawyehsu Apr 26, 2024
36026f1
feat(core): New cache filename format (#5929)
chawyehsu Apr 29, 2024
23d55ce
fix(scoop-search): Catch error of parsing invalid manifest (#5930)
chawyehsu Apr 30, 2024
b8580aa
fix(autoupdate): Copy `PSCustomObject`-type properties within `autoup…
amorphobia May 1, 2024
5b86c30
fix(system): Fix argument passing to `Split-PathLikeEnvVar()` in depr…
Capella87 May 6, 2024
cc86335
fix(scoop-cache): Fix regression in 36026f18 (#5944)
chawyehsu May 8, 2024
776135e
fix(database): Update cache when adding bucket (#5946)
niheaven May 8, 2024
edaae8d
fix(database): Skip caching 'deprecated' dir (#5949)
niheaven May 9, 2024
1752050
fix(core): Fix "Invoke-ExternalCommand" quoting rules (#5945)
niheaven May 11, 2024
1dd479f
fix(database): Use 'Find-BucketDirectory()' to locate bucket dir (#5955)
niheaven May 11, 2024
b710ff6
fix(scoop-info): Fix download size estimating (#5958)
niheaven May 11, 2024
a5bd229
refactor(install): Separate archive extraction from downloader (#5951)
niheaven May 12, 2024
4dd2cfd
fix(core): Add 'PSObject.Copy()' to 'substitute()' (#5962)
niheaven May 13, 2024
f6f46f6
fix(sqlite): Dispose all command to release database file handle (#5966)
niheaven May 14, 2024
2d50a02
fix(scoop-download|install|update): Use consistent options (#5956)
lewis-yeung May 14, 2024
5ce70c4
fix(sqlite): Update cache after removing bucket or manifests (#5967)
niheaven May 15, 2024
2544745
refactor(install): Replace 'run_(un)installer()' with 'Invoke-Install…
niheaven May 15, 2024
8ea3738
fix(install): Add back arg `$Name` in `Invoke-Installer()` (#5971)
niheaven May 15, 2024
5c896e9
refactor(decompress): Use 7zip to extract Zstd archive (#5973)
niheaven May 17, 2024
c9048ad
fix(sqlite): Fix generic class error in PS5 (#5981)
niheaven May 20, 2024
700a2f4
feat(install): Added the ability to specify @ version when installing…
insertokname May 23, 2024
fa1b42b
fix(checkver): Correct variable 'regex' to 'regexp' (#5993)
chawyehsu May 26, 2024
dec4232
fix(decompress): Match `extract_dir`/`extract_to` and archives (#5983)
lewis-yeung May 26, 2024
d20819e
fix(core): Search for Git executable instead of any cmdlet (#5998)
MatejKafka Jun 7, 2024
a9ca75c
fix(core): Use correct path in 'bash' (#6006)
niheaven Jun 11, 2024
3a39ba0
fix(core): Limit the number of commands to get (#6013)
qwertyhjklxyz Jun 13, 2024
9239c26
feat(decompress): Use `innounp-unicode` as default Inno Setup Unpacke…
niheaven Jun 24, 2024
d8b3cc8
fix(checkver): Correct error messages (#6024)
lewis-yeung Jun 25, 2024
93359a4
fix(shim): Restore original path for JAR cmd (#6030)
niheaven Jun 26, 2024
2d02483
Merge branch 'master' into develop
niheaven Jun 30, 2024
7e0a2a2
Update chglog
niheaven Jun 30, 2024
ade7aa4
(chore): Update changelog (#6036)
niheaven Jun 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ test/installer/tmp/*
test/tmp/*
*~
TestResults.xml
supporting/sqlite/*
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
## [v0.5.0](https://github.com/ScoopInstaller/Scoop/compare/v0.4.2...v0.5.0) - 2024-07-01

### Features

- **scoop-search:** Use SQLite for caching apps to speed up local search ([#5851](https://github.com/ScoopInstaller/Scoop/issues/5851), [#5918](https://github.com/ScoopInstaller/Scoop/issues/5918), [#5946](https://github.com/ScoopInstaller/Scoop/issues/5946), [#5949](https://github.com/ScoopInstaller/Scoop/issues/5949), [#5955](https://github.com/ScoopInstaller/Scoop/issues/5955), [#5966](https://github.com/ScoopInstaller/Scoop/issues/5966), [#5967](https://github.com/ScoopInstaller/Scoop/issues/5967), [#5981](https://github.com/ScoopInstaller/Scoop/issues/5981))
- **core:** New cache filename format ([#5929](https://github.com/ScoopInstaller/Scoop/issues/5929), [#5944](https://github.com/ScoopInstaller/Scoop/issues/5944))
- **decompress:** Use innounp-unicode as default Inno Setup Unpacker ([#6028](https://github.com/ScoopInstaller/Scoop/issues/6028))
- **install:** Added the ability to install specific version of app from URL/file link ([#5988](https://github.com/ScoopInstaller/Scoop/issues/5988))

### Bug Fixes

- **scoop-download|install|update:** Use consistent options ([#5956](https://github.com/ScoopInstaller/Scoop/issues/5956))
- **scoop-info:** Fix download size estimating ([#5958](https://github.com/ScoopInstaller/Scoop/issues/5958))
- **scoop-search:** Catch error of parsing invalid manifest ([#5930](https://github.com/ScoopInstaller/Scoop/issues/5930))
- **checkver:** Correct variable 'regex' to 'regexp' ([#5993](https://github.com/ScoopInstaller/Scoop/issues/5993))
- **checkver:** Correct error messages ([#6024](https://github.com/ScoopInstaller/Scoop/issues/6024))
- **core:** Search for Git executable instead of any cmdlet ([#5998](https://github.com/ScoopInstaller/Scoop/issues/5998))
- **core:** Use correct path in 'bash' ([#6006](https://github.com/ScoopInstaller/Scoop/issues/6006))
- **core:** Limit the number of commands to get when search for git executable ([#6013](https://github.com/ScoopInstaller/Scoop/pull/6013))
- **decompress:** Match `extract_dir`/`extract_to` and archives ([#5983](https://github.com/ScoopInstaller/Scoop/issues/5983))
- **json:** Serialize jsonpath return ([#5921](https://github.com/ScoopInstaller/Scoop/issues/5921))
- **shim:** Restore original path for JAR cmd ([#6030](https://github.com/ScoopInstaller/Scoop/issues/6030))

### Code Refactoring

- **decompress:** Use 7zip to extract Zstd archive ([#5973](https://github.com/ScoopInstaller/Scoop/issues/5973))
- **install:** Separate archive extraction from downloader ([#5951](https://github.com/ScoopInstaller/Scoop/issues/5951))
- **install:** Replace 'run_(un)installer()' with 'Invoke-Installer()' ([#5968](https://github.com/ScoopInstaller/Scoop/issues/5968), [#5971](https://github.com/ScoopInstaller/Scoop/issues/5971))

## [v0.4.2](https://github.com/ScoopInstaller/Scoop/compare/v0.4.1...v0.4.2) - 2024-05-14

### Bug Fixes
Expand Down
24 changes: 13 additions & 11 deletions bin/checkver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ while ($in_progress -gt 0) {
$ver = $Version

if (!$ver) {
if (!$regex -and $replace) {
if (!$regexp -and $replace) {
next "'replace' requires 're' or 'regex'"
continue
}
Expand All @@ -294,13 +294,15 @@ while ($in_progress -gt 0) {
}
$page = (New-Object System.IO.StreamReader($ms, (Get-Encoding $wc))).ReadToEnd()
}
$source = $url
if ($script) {
$page = Invoke-Command ([scriptblock]::Create($script -join "`r`n"))
$source = 'the output of script'
}

if ($jsonpath) {
# Return only a single value if regex is absent
$noregex = [String]::IsNullOrEmpty($regex)
$noregex = [String]::IsNullOrEmpty($regexp)
# If reverse is ON and regex is ON,
# Then reverse would have no effect because regex handles reverse
# on its own
Expand All @@ -310,7 +312,7 @@ while ($in_progress -gt 0) {
$ver = json_path_legacy $page $jsonpath
}
if (!$ver) {
next "couldn't find '$jsonpath' in $url"
next "couldn't find '$jsonpath' in $source"
continue
}
}
Expand All @@ -332,7 +334,7 @@ while ($in_progress -gt 0) {
# Getting version from XML, using XPath
$ver = $xml.SelectSingleNode($xpath, $nsmgr).'#text'
if (!$ver) {
next "couldn't find '$($xpath -replace 'ns:', '')' in $url"
next "couldn't find '$($xpath -replace 'ns:', '')' in $source"
continue
}
}
Expand All @@ -348,31 +350,31 @@ while ($in_progress -gt 0) {
}

if ($regexp) {
$regex = New-Object System.Text.RegularExpressions.Regex($regexp)
$re = New-Object System.Text.RegularExpressions.Regex($regexp)
if ($reverse) {
$match = $regex.Matches($page) | Select-Object -Last 1
$match = $re.Matches($page) | Select-Object -Last 1
} else {
$match = $regex.Matches($page) | Select-Object -First 1
$match = $re.Matches($page) | Select-Object -First 1
}

if ($match -and $match.Success) {
$matchesHashtable = @{}
$regex.GetGroupNames() | ForEach-Object { $matchesHashtable.Add($_, $match.Groups[$_].Value) }
$re.GetGroupNames() | ForEach-Object { $matchesHashtable.Add($_, $match.Groups[$_].Value) }
$ver = $matchesHashtable['1']
if ($replace) {
$ver = $regex.Replace($match.Value, $replace)
$ver = $re.Replace($match.Value, $replace)
}
if (!$ver) {
$ver = $matchesHashtable['version']
}
} else {
next "couldn't match '$regexp' in $url"
next "couldn't match '$regexp' in $source"
continue
}
}

if (!$ver) {
next "couldn't find new version in $url"
next "couldn't find new version in $source"
continue
}
}
Expand Down
2 changes: 1 addition & 1 deletion bin/uninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function do_uninstall($app, $global) {
$architecture = $install.architecture

Write-Output "Uninstalling '$app'"
run_uninstaller $manifest $architecture $dir
Invoke-Installer -Path $dir -Manifest $manifest -ProcessorArchitecture $architecture -Uninstall
rm_shims $app $manifest $global $architecture

# If a junction was used during install, that will have been used
Expand Down
9 changes: 9 additions & 0 deletions lib/buckets.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ function add_bucket($name, $repo) {
$dir = ensure $dir
Invoke-Git -ArgumentList @('clone', $repo, $dir, '-q')
Write-Host 'OK'
if (get_config USE_SQLITE_CACHE) {
info 'Updating cache...'
Set-ScoopDB -Path (Get-ChildItem (Find-BucketDirectory $name) -Filter '*.json' -Recurse).FullName
}
success "The $name bucket was added successfully."
return 0
}
Expand All @@ -168,6 +172,11 @@ function rm_bucket($name) {
}

Remove-Item $dir -Recurse -Force -ErrorAction Stop
if (get_config USE_SQLITE_CACHE) {
info 'Updating cache...'
Remove-ScoopDBItem -Bucket $name
}
success "The $name bucket was removed successfully."
return 0
}

Expand Down
72 changes: 53 additions & 19 deletions lib/core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,16 @@ function Complete-ConfigChange {
}
}
}

if ($Name -eq 'use_sqlite_cache' -and $Value -eq $true) {
if ((Get-DefaultArchitecture) -eq 'arm64') {
abort 'SQLite cache is not supported on ARM64 platform.'
}
. "$PSScriptRoot\..\lib\database.ps1"
. "$PSScriptRoot\..\lib\manifest.ps1"
info 'Initializing SQLite cache in progress... This may take a while, please wait.'
Set-ScoopDB
}
}

function setup_proxy() {
Expand Down Expand Up @@ -314,10 +324,6 @@ function Invoke-GitLog {
# helper functions
function coalesce($a, $b) { if($a) { return $a } $b }

function format($str, $hash) {
$hash.keys | ForEach-Object { set-variable $_ $hash[$_] }
$executionContext.invokeCommand.expandString($str)
}
function is_admin {
$admin = [security.principal.windowsbuiltinrole]::administrator
$id = [security.principal.windowsidentity]::getcurrent()
Expand Down Expand Up @@ -399,7 +405,22 @@ function currentdir($app, $global) {
function persistdir($app, $global) { "$(basedir $global)\persist\$app" }
function usermanifestsdir { "$(basedir)\workspace" }
function usermanifest($app) { "$(usermanifestsdir)\$app.json" }
function cache_path($app, $version, $url) { "$cachedir\$app#$version#$($url -replace '[^\w\.\-]+', '_')" }
function cache_path($app, $version, $url) {
$underscoredUrl = $url -replace '[^\w\.\-]+', '_'
$filePath = "$cachedir\$app#$version#$underscoredUrl"

# NOTE: Scoop cache files migration. Remove this 6 months after the feature ships.
if (Test-Path $filePath) {
return $filePath
}

$urlStream = [System.IO.MemoryStream]::new([System.Text.Encoding]::UTF8.GetBytes($url))
$sha = (Get-FileHash -Algorithm SHA256 -InputStream $urlStream).Hash.ToLower().Substring(0, 7)
$extension = [System.IO.Path]::GetExtension($url)
$filePath = $filePath -replace "$underscoredUrl", "$sha$extension"

return $filePath
}

# apps
function sanitary_path($path) { return [regex]::replace($path, "[/\\?:*<>|]", "") }
Expand Down Expand Up @@ -477,7 +498,7 @@ function Get-HelperPath {
[OutputType([String])]
param(
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
[ValidateSet('Git', '7zip', 'Lessmsi', 'Innounp', 'Dark', 'Aria2', 'Zstd')]
[ValidateSet('Git', '7zip', 'Lessmsi', 'Innounp', 'Dark', 'Aria2')]
[String]
$Helper
)
Expand All @@ -491,20 +512,24 @@ function Get-HelperPath {
if ($internalgit) {
$HelperPath = $internalgit
} else {
$HelperPath = (Get-Command git -ErrorAction Ignore).Source
$HelperPath = (Get-Command git -CommandType Application -TotalCount 1 -ErrorAction Ignore).Source
}
}
'7zip' { $HelperPath = Get-AppFilePath '7zip' '7z.exe' }
'Lessmsi' { $HelperPath = Get-AppFilePath 'lessmsi' 'lessmsi.exe' }
'Innounp' { $HelperPath = Get-AppFilePath 'innounp' 'innounp.exe' }
'Innounp' {
$HelperPath = Get-AppFilePath 'innounp-unicode' 'innounp.exe'
if ([String]::IsNullOrEmpty($HelperPath)) {
$HelperPath = Get-AppFilePath 'innounp' 'innounp.exe'
}
}
'Dark' {
$HelperPath = Get-AppFilePath 'wixtoolset' 'wix.exe'
if ([String]::IsNullOrEmpty($HelperPath)) {
$HelperPath = Get-AppFilePath 'dark' 'dark.exe'
}
}
'Aria2' { $HelperPath = Get-AppFilePath 'aria2' 'aria2c.exe' }
'Zstd' { $HelperPath = Get-AppFilePath 'zstd' 'zstd.exe' }
}

return $HelperPath
Expand Down Expand Up @@ -551,7 +576,7 @@ function Test-HelperInstalled {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
[ValidateSet('7zip', 'Lessmsi', 'Innounp', 'Dark', 'Aria2', 'Zstd')]
[ValidateSet('7zip', 'Lessmsi', 'Innounp', 'Dark', 'Aria2')]
[String]
$Helper
)
Expand Down Expand Up @@ -1013,19 +1038,20 @@ function shim($path, $global, $name, $arg) {
warn_on_overwrite "$shim.cmd" $path
@(
"@rem $resolved_path",
"@cd /d $(Split-Path $resolved_path -Parent)"
"@java -jar `"$resolved_path`" $arg %*"
"@pushd $(Split-Path $resolved_path -Parent)",
"@java -jar `"$resolved_path`" $arg %*",
"@popd"
) -join "`r`n" | Out-UTF8File "$shim.cmd"

warn_on_overwrite $shim $path
@(
"#!/bin/sh",
"# $resolved_path",
"if [ `$(echo `$WSL_DISTRO_NAME) ]",
"if [ `$WSL_INTEROP ]",
'then',
" cd `$(wslpath -u '$(Split-Path $resolved_path -Parent)')",
'else',
" cd `"$((Split-Path $resolved_path -Parent).Replace('\', '/'))`"",
" cd `$(cygpath -u '$(Split-Path $resolved_path -Parent)')",
'fi',
"java.exe -jar `"$resolved_path`" $arg `"$@`""
) -join "`n" | Out-UTF8File $shim -NoNewLine
Expand All @@ -1038,22 +1064,30 @@ function shim($path, $global, $name, $arg) {

warn_on_overwrite $shim $path
@(
"#!/bin/sh",
'#!/bin/sh',
"# $resolved_path",
"python.exe `"$resolved_path`" $arg `"$@`""
) -join "`n" | Out-UTF8File $shim -NoNewLine
} else {
warn_on_overwrite "$shim.cmd" $path
@(
"@rem $resolved_path",
"@bash `"$resolved_path`" $arg %*"
"@bash `"`$(wslpath -u '$resolved_path')`" $arg %* 2>nul",
'@if %errorlevel% neq 0 (',
" @bash `"`$(cygpath -u '$resolved_path')`" $arg %* 2>nul",
')'
) -join "`r`n" | Out-UTF8File "$shim.cmd"

warn_on_overwrite $shim $path
@(
"#!/bin/sh",
'#!/bin/sh',
"# $resolved_path",
"`"$resolved_path`" $arg `"$@`""
"if [ `$WSL_INTEROP ]",
'then',
" `"`$(wslpath -u '$resolved_path')`" $arg `"$@`"",
'else',
" `"`$(cygpath -u '$resolved_path')`" $arg `"$@`"",
'fi'
) -join "`n" | Out-UTF8File $shim -NoNewLine
}
}
Expand Down Expand Up @@ -1172,7 +1206,7 @@ function applist($apps, $global) {
}

function parse_app([string]$app) {
if ($app -match '^(?:(?<bucket>[a-zA-Z0-9-_.]+)/)?(?<app>.*\.json$|[a-zA-Z0-9-_.]+)(?:@(?<version>.*))?$') {
if ($app -match '^(?:(?<bucket>[a-zA-Z0-9-_.]+)/)?(?<app>.*\.json|[a-zA-Z0-9-_.]+)(?:@(?<version>.*))?$') {
return $Matches['app'], $Matches['bucket'], $Matches['version']
} else {
return $app, $null, $null
Expand Down
Loading