How does Chocolatey know which packages are installed locally?
Asked Answered
H

1

14

How does Chocolatey determine which packages are installed on the local system?

Somehow choco list -localonly lists packages installed locally and invokes nuget.exe in the process. In NuGet I know packages.config lists installed packages, but in Chocolatey I don't seem to find a similar file.

Heliostat answered 17/6, 2015 at 15:44 Comment(0)
A
17

choco list -lo only lists the latest versions of the packages you have installed.

Old choco invoked nuget.exe, new choco (0.9.9+) does it directly since it has nuget.core built-in.

It does a list against %ChocolateyInstall%\lib when you call list -lo. If several versions of the same package exist, only the latest version will be listed. Use list -lo -a to show all versions of the same package available locally.

Further, it is not based on folders, but on the actual nupkg files in those folders.

If you want a list of programs and features, add -i as an option. See choco list -h or the docs page for details.

Atalaya answered 18/6, 2015 at 23:38 Comment(10)
Thanks @ferventcoder! In my lib dir is much more than what is just listed in list -lo. How does choco really determine what's installed and what's just and old version lying around?Heliostat
@Heliostat So chocolatey loads up nuget's package manager and points to the local directory. It looks at the nuget packages that are there at the latest versions. It's not a simple folder based scan to see what is installed. To see all the old versions as well you should look at choco list -h to get the all versions option to use with choco list -lo.Atalaya
@Heliostat I don't understand this: "and what's just and old version lying around?" What do you mean by that?Atalaya
What I meant was: If I enter choco list -lo I get as output for example putty 0.64, whereas choco's lib directory and choco list -lo -AllVersions show putty 0.63 AND putty 0.64. I was trying to determine the logic that choco uses to determine what's installed and what's not, i.e. trying to understand the logic why it only shows putty 0.64 (the latest version). Now I understand that it does not determine what's installed when running choco list -lo, but simply shows the latest version number. Thank you!Heliostat
I have edited the answer to reflect my current understanding: list -lo does not list installed packages as I thought, it lists the latest version of the locally available pacakges. The following question remains: Is there a way to list locally installed packages?Heliostat
Not quite right. I updated the edit. Perhaps you are using the term "package" and you mean to state "software" as in what is installed in programs and features?Atalaya
Installed packages of software through choco will be in the choco list -lo - and if you need all versions and prereleases you should adjust your query accordingly choco list -lo -pre -all.Atalaya
OK, many thanks for clarifying! Yes, I mean installed software as in programs and features.Heliostat
I will update the comment for how you can include the programs and features listAtalaya
@Heliostat there is a way to get to the ARP (programs and features) list as well. I'd suggest using the help menus in choco. They are actually quite good now. choco list -hAtalaya

© 2022 - 2024 — McMap. All rights reserved.