xiaoyifang / goldendict-ng

The Next Generation GoldenDict
https://xiaoyifang.github.io/goldendict-ng/
Other
1.68k stars 93 forks source link

Write version into the registry #1744

Closed gotounix closed 1 month ago

gotounix commented 2 months ago

While using winget manage software, winget can't get goldendict-ng's version.

So while using winget upgrade --all to upgrade software will reinstall goldendict-ng again.

https://github.com/goldendict/goldendict/issues/1677

https://github.com/microsoft/winget-cli/issues/3854

shenlebantongying commented 2 months ago

Add something like

WriteRegStr/DeleteRegValue HKLM `Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" DisplayVersion "${VERSION}"

to

CPACK_NSIS_EXTRA_INSTALL_COMMANDS / CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS

should fix the problem.


Alternatively, we can use a custom template instead

https://gitlab.kitware.com/cmake/community/-/wikis/doc/cpack/NSISAdvancedTips#nsis-script-file-creation

And restore this file https://github.com/xiaoyifang/goldendict-ng/blob/ea8bc6056b5d68e1011d65571f1cdb971c310eab/tools/nsis/GoldenDict.nsi

https://github.com/search?q=WriteRegStr+DisplayVersion+language%3Acmake&type=code

gotounix commented 2 months ago

@shenlebantongying Is there a plan to add this in the next version?

xiaoyifang commented 2 months ago

Is the registry the only way to provide the version information to winget?

xiaoyifang commented 2 months ago

I think winget as a package manager tool which handle its package seperately 。 Does Winget have a centralized place to store ,manage all the packages including the version information.

xiaoyifang commented 2 months ago

https://github.com/microsoft/winget-pkgs/blob/1de9c093e13421ce95fe75f124cebf9eb4344598/manifests/x/xiaoyifang/GoldenDict-ng/24.01.22/xiaoyifang.GoldenDict-ng.locale.en-US.yaml#L5

gotounix commented 2 months ago

@xiaoyifang Windows Package Manager Community Repository is the place to store all packages's information. But while using Winget to upgrade your package, it only get the current installed version from registry. It doesn't save the package manifest in local.

shenlebantongying commented 2 months ago

This seems already fixed after we switched to CPack.

The newest version from https://github.com/xiaoyifang/goldendict-ng/releases shows these:

The registry path is Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\GoldenDict-ng

The NSIS template used by CPack already did it for us 😅

https://github.com/Kitware/CMake/blob/3bf4bcba114380924ab829da2099a1ceb5a231c6/Modules/Internal/CPack/NSIS.template.in#L669-L670

shenlebantongying commented 2 months ago

Is the registry the only way to provide the version information to winget? I think winget as a package manager tool which handle its package seperately 。 Does Winget have a centralized place to store ,manage all the packages including the version information.

winget has to deal with Windows's existing legacy. It can upgrade software that isn't installed with winget. I think they have no choice but to continue using the registry for eternity.

gotounix commented 2 months ago

There are so many releases named 24.05.13, I don't know how to add this version to winget-pkgs. Is it possible to use minor version numbers to mark alpha versions instead of using a series of random characters?

shenlebantongying commented 2 months ago

Maybe just don't package alpha versions? Some of them are just for testing 😅

I plan to cut a release within this month after qt6.7.3 is released. What do you think about this schedule @xiaoyifang?

https://wiki.qt.io/Qt_6.7_Release

xiaoyifang commented 1 month ago

I plan to cut a release within this month after qt6.7.3 is released. What do you think about this schedule

Does goldendict-ng have some dependencies on qt6.7.3? If not, we do not have to wait the release of qt6.7.3. We can cut the release on our own plan.

gotounix commented 1 month ago

@xiaoyifang Why would you modify the Assets file after a version has been released? It causes the SHA-256 hash to change, preventing the submission/use of the winget repository. Shouldn't the correct approach be to release a new version to fix the error?

shenlebantongying commented 1 month ago

😅My bad. I triggered build again because I thought something was wrong with uploading (a few files were seems missing).

They won't be changed anymore.