Proper usage of Chocolatey (package update / version management)

核能气质少年 提交于 2019-12-11 03:58:34

问题


NOTE: This question was valid for Chocolatey 0.9.8 and bellow. Later versions are completely rewritten from PowerShell scripts to a C# application and whole process of package management was improved a lot.

I have been using Chocolatey for some time. At the beginning I was excited, but after some time I'm not sure if it's usable yet. I'm concerned the most about proper way of package updating.

For example, I have installed Atom editor using Chocolatey. New versions of Atom are released pretty frequently, so I have updated this package several times. Then I noticed that I have all previously installed versions of Atom still present in a Chocolatey's lib directory. Chocolatey in fact doesn't update a package; it just installs a new version besides an older one, and it doesn't matter if you use a command choco update <package> or choco update all. And there is also currently no way to uninstall previously installed packages using Chocolatey except of the most recent one.

Therefore I wonder what's the proper way of managing package versions using Chocolatey. Should I just manually remove older versions of packages and hope there are no dependencies outside of Chocolatey's package directory?

Or rather do this?

choco uninstall <package>
choco install <package>

What if I don't have installed just one package using Chocolatey, but tens of packages?

Also the fact that each version of package is in individual directory causes various issues (like for example this, this or this).

I don't think this is suitable for real usage. Or maybe I'm missing something. Actually I wish I'm missing something :) Because software management on Windows is quite a pain for years. It's a mess.

I would say that Chocolatey works more as a dependency manager, but it should be a package manager. It advertises itself as "apt-get for Windows" and apt-get is a package manager. There is a quite big difference between a package managers (like Chocolatey, apt-get or brew) and a dependency managers (like npm or bower). Each one of these two approaches is good for different purpose. Who needs to use different versions of Git, Atom, VLC media player, Chrome, etc. at the same time?

It's also discussed for example here and here, but nothing has changed during a year. It seems that it should be addressed in a new client written in C# instead of PowerShell, but it wasn't released yet (should be released before the end of 2014). Until then I don't see any added value in Chocolatey.


回答1:


UPDATE: In choco 0.9.9+ (C# compiled version) this is no longer the case.

You are correct. Chocolatey folders can get really crazy with updates over time with the PowerShell version. FWIW, the PowerShell version of Chocolatey was an experiment that has stuck around for too long. I've been talking about rewriting it since the end of the first year. Agreed that what you are seeing is ugly. Rest assured this is not how the new version works. There are some packages right now where you do install multiple versions (Ruby and Python), but they are few and far between.

The early designs of Chocolatey were somewhat dependent on NuGet.exe which doesn't have all of the same functionality that NuGet.Core.dll has as far as package management (although it's got some really obtuse bugs that I've filed while writing the C# version of choco).

I'm really excited to release the new version, but the feature parity needs to be there first. It will be FOSSed either just before release or at the same time. It is the version that is going to support the professional/business extensions. There is no way I would attempt to do that with the current PowerShell version. ;)

Right now you can manually jump into the lib folder and delete all of the older folders. The older versions are not even considered there by Chocolatey in most cases. It's looking at only the latest versions. The only mistake it is making is not deleting the older folders (and using version on the folder in the first place).




回答2:


To update a package, use the Chocolatey update command.

It's simple:

chocolatey update <package>

OR

cup <package>

UPDATE in comments



来源:https://stackoverflow.com/questions/26870648/proper-usage-of-chocolatey-package-update-version-management

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!