From 947ca85b39537a39dfdbcb1769e046c8e8e27dbd Mon Sep 17 00:00:00 2001 From: HUMORCE Date: Tue, 11 Jul 2023 02:05:15 +0000 Subject: [PATCH 1/7] fix Get-Manifest() --- lib/manifest.ps1 | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) 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 } } } From 0c8ce958c538400b192c3142732a8b2c0dbdf855 Mon Sep 17 00:00:00 2001 From: HUMORCE Date: Tue, 11 Jul 2023 02:06:26 +0000 Subject: [PATCH 2/7] update abort, error messages --- lib/depends.ps1 | 4 ++-- lib/install.ps1 | 2 +- libexec/scoop-cat.ps1 | 14 +++++++------- libexec/scoop-download.ps1 | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/depends.ps1 b/lib/depends.ps1 index 9c8d29042d..00cdc2a1db 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 '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 22b76423ca..b08edf0919 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 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 d339e7907f..84c90af48e 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 From 2b430dcb424c3c62ff5500aa12abc1e6aba4b781 Mon Sep 17 00:00:00 2001 From: HUMORCE Date: Tue, 11 Jul 2023 02:52:52 +0000 Subject: [PATCH 3/7] prompt different message for known bucket or not --- lib/depends.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/depends.ps1 b/lib/depends.ps1 index 00cdc2a1db..8b1743a43b 100644 --- a/lib/depends.ps1 +++ b/lib/depends.ps1 @@ -37,7 +37,7 @@ function Get-Dependency { if (!$manifest) { if (((Get-LocalBucket) -notcontains $bucket) -and $bucket) { - warn "Bucket '$bucket' not Added. 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) { " from '$bucket' bucket" } elseif($url) { " at '$url'" })." } From 213423d1320f613d430a12843ffa679978e3f00f Mon Sep 17 00:00:00 2001 From: HUMORCE Date: Sun, 8 Oct 2023 12:28:17 +0000 Subject: [PATCH 4/7] CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 808b9c8ca6..3bd42f3447 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ - **shim:** Use bash executable directly ([#5433](https://github.com/ScoopInstaller/Scoop/issues/5433)) - **scoop-checkup:** Skip defender check in Windows Sandbox ([#5519]https://github.com/ScoopInstaller/Scoop/issues/5519) - **buckets:** Avoid error messages for unexpected dir ([#5549]https://github.com/ScoopInstaller/Scoop/issues/5549) +- **manifest:** Correct source of manifest ([#5575](https://github.com/ScoopInstaller/Scoop/issues/5575)) ### Performance Improvements From 2d5c4b72fa025fc085602895dc49866c0c533ea0 Mon Sep 17 00:00:00 2001 From: HUMORCE Date: Sun, 8 Oct 2023 14:04:13 +0000 Subject: [PATCH 5/7] show source for remote/local when installing --- lib/install.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/install.ps1 b/lib/install.ps1 index b08edf0919..d531ea436a 100644 --- a/lib/install.ps1 +++ b/lib/install.ps1 @@ -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 From d35efac160e2a4beb494ad4e17968badb4a0df19 Mon Sep 17 00:00:00 2001 From: HUMORCE Date: Mon, 9 Oct 2023 07:40:28 +0000 Subject: [PATCH 6/7] quote `$bucket` for consistency --- lib/install.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/install.ps1 b/lib/install.ps1 index 1e7d5aa698..822385d0cf 100644 --- a/lib/install.ps1 +++ b/lib/install.ps1 @@ -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" } else { " from '$url'" })" + 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 From fb555b03637e5b97aca877a1ac0a74d1deeb05ed Mon Sep 17 00:00:00 2001 From: Hsiao-nan Cheung Date: Tue, 10 Oct 2023 14:06:57 +0800 Subject: [PATCH 7/7] Update lib/depends.ps1 Co-authored-by: HUMORCE --- lib/depends.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/depends.ps1 b/lib/depends.ps1 index 8b1743a43b..bd4ed19cf2 100644 --- a/lib/depends.ps1 +++ b/lib/depends.ps1 @@ -37,7 +37,7 @@ function Get-Dependency { if (!$manifest) { if (((Get-LocalBucket) -notcontains $bucket) -and $bucket) { - warn "Bucket '$bucket' not Added. Add it with $(if($bucket -in (known_buckets)) { "'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) { " from '$bucket' bucket" } elseif($url) { " at '$url'" })." }