Chocolatey的正确使用(包更新/版本管理) [英] Proper usage of Chocolatey (package update / version management)

查看:23
本文介绍了Chocolatey的正确使用(包更新/版本管理)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注意:此问题适用于 Chocolatey 0.9.8 及以下版本.后来的版本完全从PowerShell脚本改写成C#应用程序,包管理的整个过程得到了很大的改进.

我使用 Chocolatey 有一段时间了.一开始我很兴奋,但过了一段时间我不确定它是否可用.我最关心包更新的正确方式.

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.

例如,我已经使用 ChocolateyAtom 编辑器>.Atom 的新版本发布非常频繁,所以我已经多次更新这个包.然后我注意到我之前安装的所有 Atom 版本仍然存在于 Chocolateylib 目录中.Chocolatey 实际上不会更新包;除了旧版本之外,它只会安装一个新版本,如果您使用命令 choco update choco update all 都没有关系.目前也没有办法使用 Chocolatey 卸载以前安装的软件包,除了最近安装的软件包.

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.

因此,我想知道使用 Chocolatey 管理软件包版本的正确方法是什么.我是否应该手动删除旧版本的软件包并希望 Chocolatey 的软件包目录之外没有依赖项?

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>

如果我使用 Chocolatey 安装的不是一个软件包,而是数十个软件包怎么办?

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

此外,每个版本的软件包都在单独的目录中会导致各种问题(例如 this, thisthis).

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

我认为这不适合实际使用.或者也许我错过了一些东西.其实我希望我错过了一些东西:) 因为 Windows 上的软件管理多年来一直很痛苦.一团糟.

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.

我会说Chocolatey更像是一个依赖管理器,但它应该是一个包管理器.它宣传自己为apt-get for Windows",apt-get 是一个包管理器.包管理器(如 Chocolateyapt-getbrew)和依赖管理器(如 npmbower).这两种方法中的每一种都适用于不同的目的.谁需要同时使用不同版本的 Git、Atom、VLC 媒体播放器、Chrome 等?

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?

例如此处这里,但一年中没有任何变化.似乎应该在用C#而不是PowerShell编写的新客户端中解决,但它还没有发布(应该在2014年底之前发布).在那之前,我看不到 Chocolatey 有任何附加价值.

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.

推荐答案

更新: 在 choco 0.9.9+(C# 编译版本)中,情况不再如此.

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

你说得对.随着 PowerShell 版本的更新,Chocolatey 文件夹会变得非常疯狂.FWIW,Chocolatey 的 PowerShell 版本是一个已经存在太久的实验.我从第一年年底就一直在谈论重写它.同意你所看到的是丑陋的.请放心,这不是新版本的工作方式.现在有一些软件包可以安装多个版本(Ruby 和 Python),但它们很少.

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.

Chocolatey 的早期设计在某种程度上依赖于 NuGet.exe,它没有 NuGet.Core.dll 在包管理方面的所有相同功能(尽管它有一些我已经提交的非常迟钝的错误)在编写 C# 版本的 choco 时).

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).

我真的很高兴发布新版本,但功能奇偶校验需要先在那里.它将在发布之前或同时进行 FOSSed.该版本将支持专业/业务扩展.我无法尝试使用当前的 PowerShell 版本来做到这一点.;)

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. ;)

现在您可以手动跳转到 lib 文件夹并删除所有旧文件夹.在大多数情况下,Chocolatey 甚至不考虑旧版本.它只查看最新版本.它犯的唯一错误是没有删除旧文件夹(并首先在文件夹上使用版本).

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).

这篇关于Chocolatey的正确使用(包更新/版本管理)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆