diff --git a/CHANGELOG.md b/CHANGELOG.md index a972451137..a891f5b6ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ - **scoop-checkup:** Change the message level of helpers from ERROR to WARN ([#5549](https://github.com/ScoopInstaller/Scoop/issues/5614)) - **scoop-(un)hold:** Correct output the messages when manifest not found, (already|not) held ([#5519](https://github.com/ScoopInstaller/Scoop/issues/5519)) - **scoop-update:** Change error message to a better instruction ([#5677](https://github.com/ScoopInstaller/Scoop/issues/5677)) +- **manifest:** Correct source of manifest ([#5575](https://github.com/ScoopInstaller/Scoop/issues/5575)) - **shim:** Check literal path in `Get-ShimPath` ([#5680](https://github.com/ScoopInstaller/Scoop/issues/5680)) - **shim:** Avoid unexpected output of `list` subcommand ([#5681](https://github.com/ScoopInstaller/Scoop/issues/5681)) - **scoop:** Do not call `scoop` externally from inside the code ([#5695](https://github.com/ScoopInstaller/Scoop/issues/5695)) diff --git a/lib/depends.ps1 b/lib/depends.ps1 index 9c8d29042d..bd4ed19cf2 100644 --- a/lib/depends.ps1 +++ b/lib/depends.ps1 @@ -37,9 +37,9 @@ function Get-Dependency { if (!$manifest) { if (((Get-LocalBucket) -notcontains $bucket) -and $bucket) { - warn "Bucket '$bucket' not installed. Add it with 'scoop bucket add $bucket' or 'scoop bucket add $bucket '." + warn "Bucket '$bucket' not added. Add it with $(if($bucket -in (known_buckets)) { "'scoop bucket add $bucket' or " })'scoop bucket add $bucket '." } - abort "Couldn't find manifest for '$AppName'$(if(!$bucket) { '.' } else { " from '$bucket' bucket." })" + abort "Couldn't find manifest for '$AppName'$(if($bucket) { " from '$bucket' bucket" } elseif($url) { " at '$url'" })." } $deps = @(Get-InstallationHelper $manifest $Architecture) + @($manifest.depends) | Select-Object -Unique diff --git a/lib/install.ps1 b/lib/install.ps1 index 519c26403d..822385d0cf 100644 --- a/lib/install.ps1 +++ b/lib/install.ps1 @@ -9,7 +9,7 @@ function install_app($app, $architecture, $global, $suggested, $use_cache = $tru $app, $manifest, $bucket, $url = Get-Manifest $app if(!$manifest) { - abort "Couldn't find manifest for '$app'$(if($url) { " at the URL $url" })." + abort "Couldn't find manifest for '$app'$(if($bucket) { " from '$bucket' bucket" } elseif($url) { " at '$url'" })." } $version = $manifest.version @@ -43,7 +43,7 @@ function install_app($app, $architecture, $global, $suggested, $use_cache = $tru return } } - Write-Output "Installing '$app' ($version) [$architecture]$(if ($bucket) { " from $bucket bucket" })" + Write-Output "Installing '$app' ($version) [$architecture]$(if ($bucket) { " from '$bucket' bucket" } else { " from '$url'" })" $dir = ensure (versiondir $app $version $global) $original_dir = $dir # keep reference to real (not linked) directory diff --git a/lib/manifest.ps1 b/lib/manifest.ps1 index 8b8a685736..5e0d9fe2c2 100644 --- a/lib/manifest.ps1 +++ b/lib/manifest.ps1 @@ -7,7 +7,7 @@ function parse_json($path) { try { Get-Content $path -Raw -Encoding UTF8 | ConvertFrom-Json -ErrorAction Stop } catch { - warn "Error parsing JSON at $path." + warn "Error parsing JSON at '$path'." } } @@ -27,7 +27,7 @@ function url_manifest($url) { try { $str | ConvertFrom-Json -ErrorAction Stop } catch { - warn "Error parsing JSON at $url." + warn "Error parsing JSON at '$url'." } } @@ -44,24 +44,23 @@ function Get-Manifest($app) { if ($bucket) { $manifest = manifest $app $bucket } else { - foreach ($bucket in Get-LocalBucket) { - $manifest = manifest $app $bucket + foreach ($tekcub in Get-LocalBucket) { + $manifest = manifest $app $tekcub if ($manifest) { + $bucket = $tekcub break } } } if (!$manifest) { # couldn't find app in buckets: check if it's a local path - $appPath = $app - $bucket = $null - if (!$appPath.EndsWith('.json')) { - $appPath += '.json' - } - if (Test-Path $appPath) { - $url = Convert-Path $appPath + if (Test-Path $app) { + $url = Convert-Path $app $app = appname_from_url $url $manifest = url_manifest $url + } else { + if (($app -match '\\/') -or $app.EndsWith('.json')) { $url = $app } + $app = appname_from_url $app } } } diff --git a/libexec/scoop-cat.ps1 b/libexec/scoop-cat.ps1 index 3e840c7149..5cf363162d 100644 --- a/libexec/scoop-cat.ps1 +++ b/libexec/scoop-cat.ps1 @@ -14,14 +14,14 @@ if (!$app) { error ' missing'; my_usage; exit 1 } $null, $manifest, $bucket, $url = Get-Manifest $app if ($manifest) { - $style = get_config CAT_STYLE - if ($style) { - $manifest | ConvertToPrettyJson | bat --no-paging --style $style --language json - } else { - $manifest | ConvertToPrettyJson - } + $style = get_config CAT_STYLE + if ($style) { + $manifest | ConvertToPrettyJson | bat --no-paging --style $style --language json + } else { + $manifest | ConvertToPrettyJson + } } else { - abort "Couldn't find manifest for '$app'$(if($url) { " at the URL $url" })." + abort "Couldn't find manifest for '$app'$(if($bucket) { " from '$bucket' bucket" } elseif($url) { " at '$url'" })." } exit $exitCode diff --git a/libexec/scoop-download.ps1 b/libexec/scoop-download.ps1 index 3ab2fa2867..ef43f8f41d 100644 --- a/libexec/scoop-download.ps1 +++ b/libexec/scoop-download.ps1 @@ -70,7 +70,7 @@ foreach ($curr_app in $apps) { } if(!$manifest) { - error "Couldn't find manifest for '$app'$(if($url) { " at the URL $url" })." + error "Couldn't find manifest for '$app'$(if($bucket) { " from '$bucket' bucket" } elseif($url) { " at '$url'" })." continue } $version = $manifest.version