Skip to content

Commit 716b6db

Browse files
authoredJul 5, 2024
chore(release): Bump to version 0.5.0 (#6035)
2 parents d337bb1 + ade7aa4 commit 716b6db

26 files changed

+860
-353
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ test/installer/tmp/*
66
test/tmp/*
77
*~
88
TestResults.xml
9+
supporting/sqlite/*

‎CHANGELOG.md

+29
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
## [v0.5.0](https://github.com/ScoopInstaller/Scoop/compare/v0.4.2...v0.5.0) - 2024-07-01
2+
3+
### Features
4+
5+
- **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))
6+
- **core:** New cache filename format ([#5929](https://github.com/ScoopInstaller/Scoop/issues/5929), [#5944](https://github.com/ScoopInstaller/Scoop/issues/5944))
7+
- **decompress:** Use innounp-unicode as default Inno Setup Unpacker ([#6028](https://github.com/ScoopInstaller/Scoop/issues/6028))
8+
- **install:** Added the ability to install specific version of app from URL/file link ([#5988](https://github.com/ScoopInstaller/Scoop/issues/5988))
9+
10+
### Bug Fixes
11+
12+
- **scoop-download|install|update:** Use consistent options ([#5956](https://github.com/ScoopInstaller/Scoop/issues/5956))
13+
- **scoop-info:** Fix download size estimating ([#5958](https://github.com/ScoopInstaller/Scoop/issues/5958))
14+
- **scoop-search:** Catch error of parsing invalid manifest ([#5930](https://github.com/ScoopInstaller/Scoop/issues/5930))
15+
- **checkver:** Correct variable 'regex' to 'regexp' ([#5993](https://github.com/ScoopInstaller/Scoop/issues/5993))
16+
- **checkver:** Correct error messages ([#6024](https://github.com/ScoopInstaller/Scoop/issues/6024))
17+
- **core:** Search for Git executable instead of any cmdlet ([#5998](https://github.com/ScoopInstaller/Scoop/issues/5998))
18+
- **core:** Use correct path in 'bash' ([#6006](https://github.com/ScoopInstaller/Scoop/issues/6006))
19+
- **core:** Limit the number of commands to get when search for git executable ([#6013](https://github.com/ScoopInstaller/Scoop/pull/6013))
20+
- **decompress:** Match `extract_dir`/`extract_to` and archives ([#5983](https://github.com/ScoopInstaller/Scoop/issues/5983))
21+
- **json:** Serialize jsonpath return ([#5921](https://github.com/ScoopInstaller/Scoop/issues/5921))
22+
- **shim:** Restore original path for JAR cmd ([#6030](https://github.com/ScoopInstaller/Scoop/issues/6030))
23+
24+
### Code Refactoring
25+
26+
- **decompress:** Use 7zip to extract Zstd archive ([#5973](https://github.com/ScoopInstaller/Scoop/issues/5973))
27+
- **install:** Separate archive extraction from downloader ([#5951](https://github.com/ScoopInstaller/Scoop/issues/5951))
28+
- **install:** Replace 'run_(un)installer()' with 'Invoke-Installer()' ([#5968](https://github.com/ScoopInstaller/Scoop/issues/5968), [#5971](https://github.com/ScoopInstaller/Scoop/issues/5971))
29+
130
## [v0.4.2](https://github.com/ScoopInstaller/Scoop/compare/v0.4.1...v0.4.2) - 2024-05-14
231

332
### Bug Fixes

‎bin/checkver.ps1

+13-11
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ while ($in_progress -gt 0) {
275275
$ver = $Version
276276

277277
if (!$ver) {
278-
if (!$regex -and $replace) {
278+
if (!$regexp -and $replace) {
279279
next "'replace' requires 're' or 'regex'"
280280
continue
281281
}
@@ -294,13 +294,15 @@ while ($in_progress -gt 0) {
294294
}
295295
$page = (New-Object System.IO.StreamReader($ms, (Get-Encoding $wc))).ReadToEnd()
296296
}
297+
$source = $url
297298
if ($script) {
298299
$page = Invoke-Command ([scriptblock]::Create($script -join "`r`n"))
300+
$source = 'the output of script'
299301
}
300302

301303
if ($jsonpath) {
302304
# Return only a single value if regex is absent
303-
$noregex = [String]::IsNullOrEmpty($regex)
305+
$noregex = [String]::IsNullOrEmpty($regexp)
304306
# If reverse is ON and regex is ON,
305307
# Then reverse would have no effect because regex handles reverse
306308
# on its own
@@ -310,7 +312,7 @@ while ($in_progress -gt 0) {
310312
$ver = json_path_legacy $page $jsonpath
311313
}
312314
if (!$ver) {
313-
next "couldn't find '$jsonpath' in $url"
315+
next "couldn't find '$jsonpath' in $source"
314316
continue
315317
}
316318
}
@@ -332,7 +334,7 @@ while ($in_progress -gt 0) {
332334
# Getting version from XML, using XPath
333335
$ver = $xml.SelectSingleNode($xpath, $nsmgr).'#text'
334336
if (!$ver) {
335-
next "couldn't find '$($xpath -replace 'ns:', '')' in $url"
337+
next "couldn't find '$($xpath -replace 'ns:', '')' in $source"
336338
continue
337339
}
338340
}
@@ -348,31 +350,31 @@ while ($in_progress -gt 0) {
348350
}
349351

350352
if ($regexp) {
351-
$regex = New-Object System.Text.RegularExpressions.Regex($regexp)
353+
$re = New-Object System.Text.RegularExpressions.Regex($regexp)
352354
if ($reverse) {
353-
$match = $regex.Matches($page) | Select-Object -Last 1
355+
$match = $re.Matches($page) | Select-Object -Last 1
354356
} else {
355-
$match = $regex.Matches($page) | Select-Object -First 1
357+
$match = $re.Matches($page) | Select-Object -First 1
356358
}
357359

358360
if ($match -and $match.Success) {
359361
$matchesHashtable = @{}
360-
$regex.GetGroupNames() | ForEach-Object { $matchesHashtable.Add($_, $match.Groups[$_].Value) }
362+
$re.GetGroupNames() | ForEach-Object { $matchesHashtable.Add($_, $match.Groups[$_].Value) }
361363
$ver = $matchesHashtable['1']
362364
if ($replace) {
363-
$ver = $regex.Replace($match.Value, $replace)
365+
$ver = $re.Replace($match.Value, $replace)
364366
}
365367
if (!$ver) {
366368
$ver = $matchesHashtable['version']
367369
}
368370
} else {
369-
next "couldn't match '$regexp' in $url"
371+
next "couldn't match '$regexp' in $source"
370372
continue
371373
}
372374
}
373375

374376
if (!$ver) {
375-
next "couldn't find new version in $url"
377+
next "couldn't find new version in $source"
376378
continue
377379
}
378380
}

‎bin/uninstall.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function do_uninstall($app, $global) {
4242
$architecture = $install.architecture
4343

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

4848
# If a junction was used during install, that will have been used

‎lib/buckets.ps1

+9
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ function add_bucket($name, $repo) {
156156
$dir = ensure $dir
157157
Invoke-Git -ArgumentList @('clone', $repo, $dir, '-q')
158158
Write-Host 'OK'
159+
if (get_config USE_SQLITE_CACHE) {
160+
info 'Updating cache...'
161+
Set-ScoopDB -Path (Get-ChildItem (Find-BucketDirectory $name) -Filter '*.json' -Recurse).FullName
162+
}
159163
success "The $name bucket was added successfully."
160164
return 0
161165
}
@@ -168,6 +172,11 @@ function rm_bucket($name) {
168172
}
169173

170174
Remove-Item $dir -Recurse -Force -ErrorAction Stop
175+
if (get_config USE_SQLITE_CACHE) {
176+
info 'Updating cache...'
177+
Remove-ScoopDBItem -Bucket $name
178+
}
179+
success "The $name bucket was removed successfully."
171180
return 0
172181
}
173182

‎lib/core.ps1

+53-19
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,16 @@ function Complete-ConfigChange {
216216
}
217217
}
218218
}
219+
220+
if ($Name -eq 'use_sqlite_cache' -and $Value -eq $true) {
221+
if ((Get-DefaultArchitecture) -eq 'arm64') {
222+
abort 'SQLite cache is not supported on ARM64 platform.'
223+
}
224+
. "$PSScriptRoot\..\lib\database.ps1"
225+
. "$PSScriptRoot\..\lib\manifest.ps1"
226+
info 'Initializing SQLite cache in progress... This may take a while, please wait.'
227+
Set-ScoopDB
228+
}
219229
}
220230

221231
function setup_proxy() {
@@ -314,10 +324,6 @@ function Invoke-GitLog {
314324
# helper functions
315325
function coalesce($a, $b) { if($a) { return $a } $b }
316326

317-
function format($str, $hash) {
318-
$hash.keys | ForEach-Object { set-variable $_ $hash[$_] }
319-
$executionContext.invokeCommand.expandString($str)
320-
}
321327
function is_admin {
322328
$admin = [security.principal.windowsbuiltinrole]::administrator
323329
$id = [security.principal.windowsidentity]::getcurrent()
@@ -399,7 +405,22 @@ function currentdir($app, $global) {
399405
function persistdir($app, $global) { "$(basedir $global)\persist\$app" }
400406
function usermanifestsdir { "$(basedir)\workspace" }
401407
function usermanifest($app) { "$(usermanifestsdir)\$app.json" }
402-
function cache_path($app, $version, $url) { "$cachedir\$app#$version#$($url -replace '[^\w\.\-]+', '_')" }
408+
function cache_path($app, $version, $url) {
409+
$underscoredUrl = $url -replace '[^\w\.\-]+', '_'
410+
$filePath = "$cachedir\$app#$version#$underscoredUrl"
411+
412+
# NOTE: Scoop cache files migration. Remove this 6 months after the feature ships.
413+
if (Test-Path $filePath) {
414+
return $filePath
415+
}
416+
417+
$urlStream = [System.IO.MemoryStream]::new([System.Text.Encoding]::UTF8.GetBytes($url))
418+
$sha = (Get-FileHash -Algorithm SHA256 -InputStream $urlStream).Hash.ToLower().Substring(0, 7)
419+
$extension = [System.IO.Path]::GetExtension($url)
420+
$filePath = $filePath -replace "$underscoredUrl", "$sha$extension"
421+
422+
return $filePath
423+
}
403424

404425
# apps
405426
function sanitary_path($path) { return [regex]::replace($path, "[/\\?:*<>|]", "") }
@@ -477,7 +498,7 @@ function Get-HelperPath {
477498
[OutputType([String])]
478499
param(
479500
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
480-
[ValidateSet('Git', '7zip', 'Lessmsi', 'Innounp', 'Dark', 'Aria2', 'Zstd')]
501+
[ValidateSet('Git', '7zip', 'Lessmsi', 'Innounp', 'Dark', 'Aria2')]
481502
[String]
482503
$Helper
483504
)
@@ -491,20 +512,24 @@ function Get-HelperPath {
491512
if ($internalgit) {
492513
$HelperPath = $internalgit
493514
} else {
494-
$HelperPath = (Get-Command git -ErrorAction Ignore).Source
515+
$HelperPath = (Get-Command git -CommandType Application -TotalCount 1 -ErrorAction Ignore).Source
495516
}
496517
}
497518
'7zip' { $HelperPath = Get-AppFilePath '7zip' '7z.exe' }
498519
'Lessmsi' { $HelperPath = Get-AppFilePath 'lessmsi' 'lessmsi.exe' }
499-
'Innounp' { $HelperPath = Get-AppFilePath 'innounp' 'innounp.exe' }
520+
'Innounp' {
521+
$HelperPath = Get-AppFilePath 'innounp-unicode' 'innounp.exe'
522+
if ([String]::IsNullOrEmpty($HelperPath)) {
523+
$HelperPath = Get-AppFilePath 'innounp' 'innounp.exe'
524+
}
525+
}
500526
'Dark' {
501527
$HelperPath = Get-AppFilePath 'wixtoolset' 'wix.exe'
502528
if ([String]::IsNullOrEmpty($HelperPath)) {
503529
$HelperPath = Get-AppFilePath 'dark' 'dark.exe'
504530
}
505531
}
506532
'Aria2' { $HelperPath = Get-AppFilePath 'aria2' 'aria2c.exe' }
507-
'Zstd' { $HelperPath = Get-AppFilePath 'zstd' 'zstd.exe' }
508533
}
509534

510535
return $HelperPath
@@ -551,7 +576,7 @@ function Test-HelperInstalled {
551576
[CmdletBinding()]
552577
param(
553578
[Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)]
554-
[ValidateSet('7zip', 'Lessmsi', 'Innounp', 'Dark', 'Aria2', 'Zstd')]
579+
[ValidateSet('7zip', 'Lessmsi', 'Innounp', 'Dark', 'Aria2')]
555580
[String]
556581
$Helper
557582
)
@@ -1013,19 +1038,20 @@ function shim($path, $global, $name, $arg) {
10131038
warn_on_overwrite "$shim.cmd" $path
10141039
@(
10151040
"@rem $resolved_path",
1016-
"@cd /d $(Split-Path $resolved_path -Parent)"
1017-
"@java -jar `"$resolved_path`" $arg %*"
1041+
"@pushd $(Split-Path $resolved_path -Parent)",
1042+
"@java -jar `"$resolved_path`" $arg %*",
1043+
"@popd"
10181044
) -join "`r`n" | Out-UTF8File "$shim.cmd"
10191045

10201046
warn_on_overwrite $shim $path
10211047
@(
10221048
"#!/bin/sh",
10231049
"# $resolved_path",
1024-
"if [ `$(echo `$WSL_DISTRO_NAME) ]",
1050+
"if [ `$WSL_INTEROP ]",
10251051
'then',
10261052
" cd `$(wslpath -u '$(Split-Path $resolved_path -Parent)')",
10271053
'else',
1028-
" cd `"$((Split-Path $resolved_path -Parent).Replace('\', '/'))`"",
1054+
" cd `$(cygpath -u '$(Split-Path $resolved_path -Parent)')",
10291055
'fi',
10301056
"java.exe -jar `"$resolved_path`" $arg `"$@`""
10311057
) -join "`n" | Out-UTF8File $shim -NoNewLine
@@ -1038,22 +1064,30 @@ function shim($path, $global, $name, $arg) {
10381064

10391065
warn_on_overwrite $shim $path
10401066
@(
1041-
"#!/bin/sh",
1067+
'#!/bin/sh',
10421068
"# $resolved_path",
10431069
"python.exe `"$resolved_path`" $arg `"$@`""
10441070
) -join "`n" | Out-UTF8File $shim -NoNewLine
10451071
} else {
10461072
warn_on_overwrite "$shim.cmd" $path
10471073
@(
10481074
"@rem $resolved_path",
1049-
"@bash `"$resolved_path`" $arg %*"
1075+
"@bash `"`$(wslpath -u '$resolved_path')`" $arg %* 2>nul",
1076+
'@if %errorlevel% neq 0 (',
1077+
" @bash `"`$(cygpath -u '$resolved_path')`" $arg %* 2>nul",
1078+
')'
10501079
) -join "`r`n" | Out-UTF8File "$shim.cmd"
10511080

10521081
warn_on_overwrite $shim $path
10531082
@(
1054-
"#!/bin/sh",
1083+
'#!/bin/sh',
10551084
"# $resolved_path",
1056-
"`"$resolved_path`" $arg `"$@`""
1085+
"if [ `$WSL_INTEROP ]",
1086+
'then',
1087+
" `"`$(wslpath -u '$resolved_path')`" $arg `"$@`"",
1088+
'else',
1089+
" `"`$(cygpath -u '$resolved_path')`" $arg `"$@`"",
1090+
'fi'
10571091
) -join "`n" | Out-UTF8File $shim -NoNewLine
10581092
}
10591093
}
@@ -1172,7 +1206,7 @@ function applist($apps, $global) {
11721206
}
11731207

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

0 commit comments

Comments
 (0)
Please sign in to comment.