Page 1 of 1

[SOLVED] Installing the previous version of a package

Published: March 19, 2025 - 11:56
by VincentUCA
WAPT version 2.6

Good morning,
Sorry if a similar topic has already been opened, I couldn't find it.
I'm currently developing a software package whose installer doesn't remove the old version. So I added a piece of code to do that. But for testing purposes, I'd like to be able to reinstall the old version. I think I've done this before, but I didn't take notes and I've since forgotten how.
I found a section in the documentation stating:
Each command that takes a package name as a parameter can also take the package's unique package_uuid as a parameter (wapt-get install, wapt-get forget, etc.). Using a GUID allows you to specify a unique package without ambiguity about its architecture or version. The package_uuid is listed in the output of wapt-get list and wapt-get search. For example:
So I made a

Code: Select all

wapt-get search monpaquet
to retrieve the package ID in the version I'm interested in.
But then when I execute the command

Code: Select all

wapt-get install c65ecfc2-ed87-428a-abc7-1646497ee71e
I get the following error:
Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
install using WAPT packages c65ecfc2-ed87-428a-abc7-1646497ee71e

Results:
Critical:
=== Unavailable packages ===
c65ecfc2-ed87-428a-abc7-1646497ee71e [x64_fr_PROD,DEV,PREPROD]
Where am I going wrong?
Thank you in advance for your reply.
Sincerely.
Vincent

Re: Installing the previous version of a package

Published: March 20, 2025 - 09:42
by dcardon
Hello Vincent,

You can force the installation of a particular version using the following syntax:

Code: Select all

wapt-get install "tis-monpaquet(=2.5.3)"
However, the version "pinning" is not stored in the agent, and therefore the package will be updated at the next wapt-get upgrade.

Sincerely,

Denis

Re: Installing the previous version of a package

Published: March 20, 2025 - 7:46 PM
by vcardon
Hello, to follow up on Denis's comment, if you want a version of a software without it updating, duplicate the version you're interested in and rename the package with the software version.

For example: the tis-firefox package for version 136.0.2 would become tis-firefox-pinned-136.0.2.

Re: Installing the previous version of a package

Published: March 21, 2025 - 11:34
by VincentUCA
Hello everyone,
Thank you for your valuable advice. I successfully tested the installation of an older version of my package. However, the part added by WAPT must not be omitted from the version number, otherwise it won't work. To use the previous example, it looks like this:

Code: Select all

wapt-get install "tis-monpaquet(=2.5.3-2)"
I suggest removing the installation via the UUID of a package from the documentation if it no longer works and adding this method via version "pinning" which I have not been able to find elsewhere.

To be perfectly honest, the package I'm trying to develop is for the Chimera software. A package already exists in the tranquil.it repository with the code to uninstall previous versions, but I've noticed two things.

The first issue is that the Chimera software version number is not recorded in the Windows registry. Therefore, the package code is as follows:

Code: Select all

for to_uninstall in installed_softwares("UCSF Chimera"):
        if Version(to_uninstall["version"]) < Version(last_version):
Always test the condition:

Code: Select all

if 0.0.0.0 < N° de la dernière version:
Therefore, regardless of the version installed, it will be uninstalled.

The second issue is that the `installed_softwares("UCSF Chimera")` function also retrieves the ChimeraX registry key, which also lacks a version number. This results in ChimeraX being uninstalled during the Chimera installation process.

I saw that in the Chimera uninstallation registry key, the version number was indicated in the "DisplayName" key. Therefore, I modified the code as follows:

Code: Select all

for to_uninstall in installed_softwares("UCSF Chimera"):
        to_uninstall_version = to_uninstall["name"].split()[-1]
        if Version(to_uninstall_version) < Version(last_version):
            print(f"Removing: {to_uninstall['name']} ({to_uninstall_version})")
The tested conditions become:

Code: Select all

if 1.18.0.0 <1.19.0.0:
And

Code: Select all

if "ChimeraX"<1.19.0.0:
Because ChimeraX does not have the version number included in "DisplayName", this condition appears to return False.

It's not the cleanest solution, but it works. The latest version of Chimera isn't uninstalled and then reinstalled when the package is updated without changing the software version, and ChimeraX isn't uninstalled either, allowing both software packages to coexist. I admit it's a bit of a nitpick :oops: Because now that I've added the function to remove the desktop shortcut, I don't think I'll touch the code of this package. And normally there's little point in having Chimera and ChimeraX installed on the same machine, but apparently there are functions that were removed from Chimera in ChimeraX that are useful for some users.

Thank you again for responding to my request.
Sincerely.
Vincent

Re: Installing the previous version of a package

Published: March 21, 2025 - 2:11 PM
by dcardon
Hi Vincent,

thanks for the feedback. I'm forwarding your post to the team that maintains the store packages so they can fix the package following your advice. :-)

Regards,

Denis

Re: Installing the previous version of a package

Published: March 24, 2025 - 11:10
by italbot
Hello,

I've just adapted the code so that an already installed version of ChimeraX isn't uninstalled along with Chimera. Indeed, the version check wasn't working; I've also modified that.

Thank you for bringing this to our attention.

Sincerely,

Ingrid