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

[Bug] Error while trying to enable scoop config use_sqlite_cache (current implementation incompatible with PS 5.1) #6041

Closed
mrplumber opened this issue Jul 5, 2024 · 2 comments · Fixed by #6057
Labels

Comments

@mrplumber
Copy link

Bug Report

Current Behavior

When trying to enable new SQLite cache feature with command scoop config use_sqlite_cache true got an error:

INFO  Initializing SQLite cache in progress... This may take a while, please wait.
Downloading SQLite 1.0.118...
Extracting SQLite 1.0.118...Scoop's Database cache requires the ADO.NET driver:
        http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki
At C:\Users\Romas\scoop\apps\scoop\current\lib\database.ps1:61 char:13
+             throw "Scoop's Database cache requires the ADO.NET driver ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Scoop's Databas.../downloads.wiki:String) [], RuntimeExcept
   ion
    + FullyQualifiedErrorId : Scoop's Database cache requires the ADO.NET driver:
        http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki

Expected Behavior

Obvious.

Additional context/output

Possible Solution

While debugging tried to manually follow commands in function Get-SQLite from lib/database.ps1 and got stuck there:

Expand-Archive -Path $sqlitePkgPath -DestinationPath $sqliteTempPath -Force

Expand-Archive : .nupkg is not a supported archive file format. .zip is the only supported archive file format.
At line:1 char:1
+ Expand-Archive -Path .\sqlite.nupkg -DestinationPath .\sqlite -Force  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (.nupkg:String) [Expand-Archive], IOException
    + FullyQualifiedErrorId : NotSupportedArchiveFileExtension,Expand-Archive

Shouldn't this line:

$sqlitePkgPath = "$env:TEMP\sqlite.nupkg"

be like this:

$sqlitePkgPath = "$env:TEMP\sqlite.zip"

?

System details

Windows version: 10

OS architecture: 64bit

PowerShell version:

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      19041  4522

Additional software: [(optional) e.g. ConEmu, Git]

Scoop Configuration

{
    "last_update":  "2024-07-05T17:09:48.7354952+03:00",
    "alias":  {
                  "fs":  "scoop-fs"
              },
    "scoop_branch":  "master",
    "scoop_repo":  "https://github.com/ScoopInstaller/Scoop",
    "cat_style":  "auto"
}
@mrplumber mrplumber added the bug label Jul 5, 2024
@mrplumber
Copy link
Author

Turns out it works with PowerShell 7.4
Still for compatibility's sake it seems reasonable to change the code as mentioned earlier.

@mrplumber
Copy link
Author

Hit couple of more issues due to current implementation's incompatibility with PowerShell 5.1:

  1. Directory "$env:TEMP\sqlite" must be explicitly created (after
    Invoke-WebRequest -Uri "https://api.nuget.org/v3-flatcontainer/stub.system.data.sqlite.core.netframework/$version/stub.system.data.sqlite.core.netframework.$version.nupkg" -OutFile $sqlitePkgPath
    )

New-Item -Path $sqliteTempPath -ItemType Directory -Force | Out-Null

  1. Due to documented bug in PowerShell 5.1 line
    Move-Item -Path "$sqliteTempPath\build\net45\*" -Destination $sqlitePath -Exclude '*.targets' -Force

    could be changed like this:

Get-ChildItem -Path "$sqliteTempPath\build\net45\*" -Recurse -Exclude '*.targets' | Move-Item -Destination $sqlitePath -Force

Scoop is being advertised as compatible with PowerShell 5.1 so these changes seem appropriate to implement.

@mrplumber mrplumber changed the title [Bug] Error while trying to enable scoop config use_sqlite_cache [Bug] Error while trying to enable scoop config use_sqlite_cache (current implementation incompatible with PS 5.1) Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant