Conversation
|
All changes look good. Wait for review from human collaborators. gimp
|
545c723 to
b26627b
Compare
Signed-off-by: Ryan Keane <the.ra2.ifv@gmail.com>
b26627b to
72f3bca
Compare
|
I think it would be simpler to use the following directly without obtaining the relevant version information through a script: {
"env_set": {
"GIMP3_DIRECTORY": "$dir\\3.0"
}
} |
|
This prevents scoop from overwriting user's env. |
Hello, if my understanding of "preventing scoop from overwriting the user's environment" aligns with yours, I don't believe your current script achieves this for the following reasons: The script in {
"post_install": [
"if ($global) { $scope = 'Machine' } else { $scope = 'User' }",
"if (!$Env:GIMP3_DIRECTORY) { [Environment]::SetEnvironmentVariable('GIMP3_DIRECTORY', \"$persist_dir\\3.0\", $scope) }"
],
"post_uninstall": [
"if ($global) { $scope = 'Machine' } else { $scope = 'User' }",
"if ($Env:GIMP3_DIRECTORY -eq \"$persist_dir\\3.0\") { [Environment]::SetEnvironmentVariable('GIMP3_DIRECTORY', [NullString]::Value, $scope) }"
]
}This behavior is identical to that of the If you check |
|
Uh, I didn't get it... |
I believe the following example illustrates my previous point.# Modify the script within "post_uninstall"
┏[ D:\Temporary\Software\Microsoft\Windows Sandbox]
└─> jq -r '"post_install:", (.post_install[]), "", "post_uninstall:", (.post_uninstall[])' .\Gimp.json
post_install:
if ($global) { $scope = 'Machine' } else { $scope = 'User' }
if (!$Env:GIMP3_DIRECTORY) { [Environment]::SetEnvironmentVariable('GIMP3_DIRECTORY', "$persist_dir\3.0", $scope) }
post_uninstall:
if ($global) { $scope = 'Machine' } else { $scope = 'User' }
Write-Host "INFO `$Env:GIMP3_DIRECTORY = " -NoNewline
[Environment]::GetEnvironmentVariable('GIMP3_DIRECTORY')
$result = $Env:GIMP3_DIRECTORY -eq "$persist_dir\3.0"
Write-Host "INFO result is $result"
if ($Env:GIMP3_DIRECTORY -eq "$persist_dir\3.0") {
[Environment]::SetEnvironmentVariable('GIMP3_DIRECTORY', [NullString]::Value, $scope)
}
┏[ D:\Temporary\Software\Microsoft\Windows Sandbox]
└─> scoop install .\Gimp.json
Installing 'Gimp' (3.0.4) [64bit] from 'D:\Temporary\Software\Microsoft\Windows Sandbox\Gimp.json'
Loading gimp-3.0.4-setup.exe from cache.
Checking hash of gimp-3.0.4-setup.exe ... ok.
Extracting gimp-3.0.4-setup.exe ... done.
Running installer script...done.
Linking D:\Software\Scoop\Local\apps\Gimp\current => D:\Software\Scoop\Local\apps\Gimp\3.0.4
Creating shim for 'gimp-console-3.0'.
Creating shim for 'gimp-console'.
Creating shim for 'gimp'.
Creating shim for 'gimptool-3.0'.
Creating shim for 'gimptool'.
Creating shortcut for GIMP (gimp-3.0.exe)
Persisting _userdata
Running post_install script...done.
'Gimp' (3.0.4) was installed successfully!
Notes
-----
Scoop persists data since version 3.0.4. You may need to move data by yourself.
Before: '$Env:APPDATA\GIMP\3.0'
After : 'D:\Software\Scoop\Local\persist\Gimp\gimp\3.0'
# Open another PowerShell session
┏[ ~]
└─> scoop update Gimp -f
Gimp: 3.0.4 -> 3.0.4
Updating one outdated app:
Updating 'Gimp' (3.0.4 -> 3.0.4)
Downloading new version
Loading gimp-3.0.4-setup.exe from cache.
Checking hash of gimp-3.0.4-setup.exe ... ok.
Uninstalling 'Gimp' (3.0.4)
Removing shim 'gimp-console-3.0.shim'.
Removing shim 'gimp-console-3.0.exe'.
Removing shim 'gimp-console.shim'.
Removing shim 'gimp-console.exe'.
Removing shim 'gimp.shim'.
Removing shim 'gimp.exe'.
Removing shim 'gimptool-3.0.shim'.
Removing shim 'gimptool-3.0.exe'.
Removing shim 'gimptool.shim'.
Removing shim 'gimptool.exe'.
Unlinking D:\Software\Scoop\Local\apps\Gimp\current
Running post_uninstall script...INFO $Env:GIMP3_DIRECTORY = D:\Software\Scoop\Local\persist\Gimp\3.0
INFO result is True
done.
Installing 'Gimp' (3.0.4) [64bit] from 'D:\Temporary\Software\Microsoft\Windows Sandbox\Gimp.json'
Loading gimp-3.0.4-setup.exe from cache.
Extracting gimp-3.0.4-setup.exe ... done.
Running installer script...done.
Linking D:\Software\Scoop\Local\apps\Gimp\current => D:\Software\Scoop\Local\apps\Gimp\3.0.4
Creating shim for 'gimp-console-3.0'.
Creating shim for 'gimp-console'.
Creating shim for 'gimp'.
Creating shim for 'gimptool-3.0'.
Creating shim for 'gimptool'.
Creating shortcut for GIMP (gimp-3.0.exe)
Persisting _userdata
Running post_install script...done.
'Gimp' (3.0.4) was installed successfully!
Notes
-----
Scoop persists data since version 3.0.4. You may need to move data by yourself.
Before: '$Env:APPDATA\GIMP\3.0'
After : 'D:\Software\Scoop\Local\persist\Gimp\gimp\3.0'
|
|
No way... Detailsbash-5.2 $ echo $GIMP3_DIRECTORY
C:\ProgramData\scoop\persist\gimp1
bash-5.2 $ scoop uninstall -g gimp
Uninstalling 'gimp' (3.0.4).
Removing shim 'gimp-console-3.0.shim'.
Removing shim 'gimp-console-3.0.exe'.
Removing shim 'gimp-console.shim'.
Removing shim 'gimp-console.exe'.
Removing shim 'gimp.shim'.
Removing shim 'gimp.exe'.
Removing shim 'gimptool-3.0.shim'.
Removing shim 'gimptool-3.0.exe'.
Removing shim 'gimptool.shim'.
Removing shim 'gimptool.exe'.
Removing shortcut C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Scoop Apps\GIMP.lnk
Unlinking C:\ProgramData\scoop\apps\gimp\current
'gimp' was uninstalled.
bash-5.2 $ scoop cat gimp
{
"##": "Maintainer reminder: After major releases, update version number in notes, and variable in post install/uninstall scripts",
"version": "3.0.4",
"description": "GNU Image Manipulation Program",
"homepage": "https://www.gimp.org",
"license": "GPL-3.0-only",
"url": "https://download.gimp.org/mirror/pub/gimp/v3.0/windows/gimp-3.0.4-setup.exe",
"hash": "385e36fe577cbdbfc71ba79d6c046d6f4eaabc01effd7f067bf15fd98410b2a1",
"notes": [
"Scoop persists data since version 3.0.4. You may need to move data by yourself.",
"Before: '$Env:APPDATA\\GIMP\\3.0'",
"After : '$persist_dir\\gimp\\3.0'"
],
"innosetup": true,
"installer": {
"script": [
"$scriptver = $version -split '[-.]'",
"$shortver = $scriptver[0] + '.' + $scriptver[1]",
"Push-Location \"$dir\"",
"Get-ChildItem -Filter '*.debug' -Recurse | Remove-Item -Recurse",
"$file64 = Get-ChildItem -Recurse -Filter '*,?.*' | Where-Object {",
" $_.Name -match '^(.*?),[12]\\.(.*?)$' -and",
" (-not (Test-Path (Join-Path $_.Directory.FullName \"$($matches[1]),3.$($matches[2])\"))) -and",
" $matches[1] -ne 'libhwy'",
"}",
"$file64 | Rename-Item -NewName { $_.name -Replace ',2', ',3' }",
"$file64 | Rename-Item -NewName { $_.name -Replace ',1', ',2' }",
"if ($architecture -eq '32bit') {",
" Get-ChildItem -Filter '*,1*' -Recurse | Rename-Item -NewName { $_.name -Replace ',1', '' }",
"} else {",
" # 'twain.exe' is for 'gimp32on64' which is not included.",
" Remove-Item \"lib\\gimp\\$shortver\\plug-ins\\twain\" -Recurse -Force",
" if ($architecture -eq '64bit') {",
" Get-ChildItem -Filter '*,2*' -Recurse | Rename-Item -NewName { $_.name -Replace ',2', '' }",
" } else {",
" Get-ChildItem -Filter '*,3*' -Recurse | Rename-Item -NewName { $_.name -Replace ',3', '' }",
" }",
"}",
"Get-ChildItem -Filter '*,*' -Recurse | Remove-Item",
"Pop-Location"
]
},
"post_install": [
"if ($global) { $scope = 'Machine' } else { $scope = 'User' }",
"if (!$Env:GIMP3_DIRECTORY) { [Environment]::SetEnvironmentVariable('GIMP3_DIRECTORY', \"$persist_dir\\3.0\", $scope) }"
],
"bin": [
"bin\\gimp-console-3.0.exe",
[
"bin\\gimp-console-3.0.exe",
"gimp-console"
],
[
"bin\\gimp-console-3.0.exe",
"gimp"
],
"bin\\gimptool-3.0.exe",
[
"bin\\gimptool-3.0.exe",
"gimptool"
]
],
"shortcuts": [
[
"bin\\gimp-3.0.exe",
"GIMP"
]
],
"persist": [
[
"_userdata",
"3.0"
]
],
"post_uninstall": [
"if ($global) { $scope = 'Machine' } else { $scope = 'User' }",
"if ($Env:GIMP3_DIRECTORY -eq \"$persist_dir\\3.0\") { [Environment]::SetEnvironmentVariable('GIMP3_DIRECTORY', [NullString]::Value, $scope) }"
],
"checkver": {
"url": "https://www.gimp.org/downloads/",
"regex": "gimp-(?[\\d.]+)-setup(?-\\d)?\\.exe",
"replace": "${version}${build}"
},
"autoupdate": {
"url": "https://download.gimp.org/mirror/pub/gimp/v$majorVersion.$minorVersion/windows/gimp-$matchHead-setup$matchTail.exe",
"hash": {
"url": "$baseurl/SHA256SUMS"
},
"bin": [
"bin\\gimp-console-$majorVersion.$minorVersion.exe",
[
"bin\\gimp-console-$majorVersion.$minorVersion.exe",
"gimp-console"
],
[
"bin\\gimp-console-$majorVersion.$minorVersion.exe",
"gimp"
],
"bin\\gimptool-$majorVersion.$minorVersion.exe",
[
"bin\\gimptool-$majorVersion.$minorVersion.exe",
"gimptool"
]
],
"shortcuts": [
[
"bin\\gimp-$majorVersion.$minorVersion.exe",
"GIMP"
]
]
}
}
|
|
Thank you for your explanation. I think I understand your point now. You are considering the scenario where this environment variable already exists during installation, while I am considering a fresh installation or a situation where the environment variable does not exist. However, I still believe this approach is problematic for the following reasons:
In addition, I have concerns about the
Please note that the above opinions are solely my personal views. I am not a maintainer, nor do I intend to impose any requirement for you to modify the manifest based on my suggestions. |
Expected. If it exists, then user knows what he really wants. Don't break it. Why use
If autoupdate is working as expected then it shouldn't take too much to maintain this manifest. Manual intervention is expected following major releases, or why call it a major release?
I'll try to improve it. |
Only eligible for projects with long term release periods, like GIMP. Major release is rare and will definitely break something. |
But doesn’t the content in the If I still believe that if an application is installed through Scoop and its related data can be stored in
Based on my testing, it is not necessary to store data in ┏[ ~]
└─> Get-ChildItem -Path Env: -Include '*GIMP*' -Recurse
Name Value
---- -----
GIMP3_DIRECTORY D:\Download\Others\Aria2\Zertw\Test\Test
┏[ ~]
└─> Get-ChildItem -Path 'D:\Download\Others\Aria2\Zertw\Test\Test'
Directory: D:\Download\Others\Aria2\Zertw\Test\Test
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 2025/12/6 16:35 backups
d---- 2025/12/6 16:35 fonts
d---- 2025/12/6 16:35 tool-options
-a--- 2025/12/6 16:35 977 gimprc
-a--- 2025/12/6 16:35 290031 pluginrc
-a--- 2025/12/6 16:35 517 theme.cssHowever, if we take data compatibility between different versions into account, then on the basis of the script below, the only remaining concern would be handling the migration. What we aim for is not to eliminate manual maintenance entirely, but to reduce its likelihood to the lowest possible level. ┏[ ~]
└─> jq '{post_install, post_uninstall}' 'D:\Temporary\Software\Microsoft\Windows Sandbox\gimp-test.json'
{
"post_install": [
"$majorVersion = ($version -split '\\.')[0]",
"$name = 'GIMP{0}_DIRECTORY' -f $majorVersion",
"$majorMinor = ($version -split '\\.')[0..1] -join '.'",
"if ($global) { $scope = 'Machine' } else { $scope = 'User' }",
"[Environment]::SetEnvironmentVariable($name, \"$persist_dir\\gimp\\$majorMinor\", $scope)"
],
"post_uninstall": [
"$majorVersion = ($version -split '\\.')[0]",
"$name = 'GIMP{0}_DIRECTORY' -f $majorVersion",
"if ($global) { $scope = 'Machine' } else { $scope = 'User' }",
"[Environment]::SetEnvironmentVariable($name, [NullString]::Value, $scope)"
]
}P.S. Ideally, the method shown below would be the best approach, but it is currently not supported at all. Even using Version variables other than |
In normal cases this variable would not point to any location outside $persist_dir, if it really points to somewhere else, user must set it by hand, in this situation why override?
I mean only $majorVersion, like this Please notice I still need to review my changes previously pushed to Github, I fucked up with rebasing
DON'T |
|
Damn, is it really difficult to do find-replacing? If you insist I'll take it. |
<manifest-name[@version]|chore>: <general summary of the pull request>