Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean upgrade #2012

Closed
Foadsf opened this issue Mar 15, 2020 · 7 comments
Closed

Clean upgrade #2012

Foadsf opened this issue Mar 15, 2020 · 7 comments

Comments

@Foadsf
Copy link

Foadsf commented Mar 15, 2020

Following this Tweet, it would be great if we could have something like a

choco clean-upgrade

which would do basically:

- make a list of updatable/upgradable packages
- uninstall those packages
- reinstall the latest versions

the upgarding process is really messy now.

@mkevenaar
Copy link
Contributor

While I understand your frustration I can't help that software developers keep old versions of their software around.

As I suggested before, I would reach out to the maintainers of the package and ask if they are willing to cleanup older versions of the installation.

Unfortunately this is not an task for Chocolatey (choco.exe), as the software installs packages and executes the scripts inside the packages. What happens inside the package script is not part of the Chocolatey code and therefore Chocolatey can't solve this issue.

Doing an uninstall of a package is currently no guarantee that the software is uninstalled. There is currently no requirement that the uninstallation of a package is successful and the software is actually uninstalled.

@Foadsf
Copy link
Author

Foadsf commented Apr 7, 2020

Dear @mkevenaar ,

Let's acknowledge the problem first. When you run

 choco update all

what is the expected behavior you would like to see?

@gep13
Copy link
Member

gep13 commented Apr 7, 2020

@Foadsf I wanted to follow up here with regard to this issue, and also some of the tweets that you have sent recently at well.

The first thing that I want to clarify is "what" Chocolatey is. Chocolatey is a Package Manager for Windows. It manages packages. Those packages can/do install applications onto the Windows machine, and Chocolatey provides some helper methods to help with this endeavour.

So, for example, when you say this:

plus the installation path is still a huge issue. if this is not going to be standardized then at least this could be reported to the user through

https://twitter.com/fsfarimani/status/1244570106551848960

I need to make sure that we are talking about the same thing. The installation path of the package is _always` the same, this never changes. Where the package maintainer decides to install the application to is dependent on where they want to install it. Chocolatey attempts to find and report this installation location, but due to many factors, including the underlying Operating System, this isn't always possible.

With regard to this (where I am assuming you meant upgrade, and not update):

choco upgrade all

My expectation is that all packages that are currently outdated on the machine would be updated, based on what packages are available from my configured sources. I would also expect that if there were any problems with the installation of those packages upgrades, that this would be reported.

Now, in terms of what happens with the underlying application, that is completely dependent on what the package maintainer (as @mkevenaar has pointed out) has decided to do. Does that make sense?

@Foadsf
Copy link
Author

Foadsf commented Apr 7, 2020

Dear @gep13 ,

First of all thanks for your patience and kind reply. Some of the points you mentioned are actually a continuation of the discussions about the installation path on this feature request and this complaint report.

To be sure that I have a good understanding of what Chocolatey is, it is kind of an API to standardize all software installations on Windows. So the user can install and update/upgrade the software/packages through one interface. To my best understanding, Chocolatey leaves the quality test, installation path, uninstallation, upgrading ... to the software itself or the package maintainer. And this is the part I think which is causing a lot of problem in my opinion. I think all software/packages installed via Chocolatey must be placed in one standard place different from the Windows "Program files", the upgrading process should uninstall the previous version (while keeping the user data/settings safe).

I used to have almost all of my FLOSS installed via Chocolatey, but after a while, I realized I have 6-7 different versions of Python on my computer. Same thing for FreeCAD, Julia ... and almost all of the other software. So basically, Chocolatey installs the new versions but keeps the old versions as well. I can understand that standardizing the installation path might be difficult but a clean upgrade should not be difficult.

@mkevenaar
Copy link
Contributor

Hi @Foadsf,

Let's get some terminology right:

  • Package: A Chocolatey package. This contains metadata and, optionally, scripts that get triggered during specific events.
  • Package maintainer: A person or organisation that, in case of the Chocolatey.org Community Repository, volunteered to submit their created package to an central location for other to use.
  • Software: A piece of software, that in most cases is not created by Chocolatey.
  • Software Installer: A tool or script, most likely provided by the software developer, that installs the Software

As @gep13 already explained, Chocolatey upgrades (or installs) the package in a consistent, clean way. It moves the old package to the lib-bkp folder and puts the new package in the lib folder. It will then trigger, if available, the scripts shipped with that package. Depending on the outcome of those scripts, the package installation or upgrade can fail or success. If it failed, the package is put in lib-bad folder.

For more information about how Chocolatey works, please have a look at the documentation

What happens inside the script is up to the Package Maintainer, not Chocolatey, or the choco.exe tool.

Depending on the type of package, the software installer may or may not clean-up old versions of the software. That is totally up to the software developer, and not in any way the responsibility of Chocolatey.

I would kindly request you to contact the package maintainer of the packages you are having troubles with and ask them if they are willing to cleanup the older versions of the software.

@tsilvs
Copy link

tsilvs commented Aug 15, 2022

@mkevenaar The process you've described works only with files downloaded by Chocolatey and excludes what actually happens when the software itself is installed (if it is provided with a dedicated installer)?

AFAIK, Choco works with these different installation methods:

  1. Unpacking an archived release build as a lib @ C:\ProgramData\chocolatey\lib;
  2. Unpacking an archived release build as a bin @ C:\ProgramData\chocolatey\bin;
  3. Unpacking an archived release build as a program @ C:\Program Files or C:\Program Files (x86);
  4. Executing the packaged installer (.exe, .msi, etc.), which are installed @ respective default paths.

@pauby
Copy link
Member

pauby commented Aug 15, 2022

@JeffRockatansky This issue is over a year old now, but appreciate you adding to it.

The original request suggested at the start by @Foadsf isn't something we would be adding to Chocolatey CLI. This can already be scripted if it's required.

I'm going to go ahead and close this issue, but we can reopen it if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants