slapt-get icon indicating copy to clipboard operation
slapt-get copied to clipboard

slapt-get always trying to reinstall itself (patch included)

Open leoctrl opened this issue 11 months ago • 2 comments

Hi, I have a local repo of packages built from SBo, including slapt-get, and I noticed that on every --dist-upgrade (I'm on -current) slapt-get would include itself in the list of packages to upgrade, even if version, arch and build of the installed one were exactly the same of the package in the repo. Eventually I've taken a look at the code and I think I found what the problem was (for some reason Github refuses to upload my patch as an attachment to this issue, so I had to copy and paste it below) HTH

diff -Nru slapt-get-0.11.11.orig/src/main.c slapt-get-0.11.11/src/main.c
--- slapt-get-0.11.11.orig/src/main.c	2025-01-04 20:30:04.000000000 +0100
+++ slapt-get-0.11.11/src/main.c	2025-02-04 21:47:13.478025611 +0100
@@ -1033,9 +1033,10 @@
         newest_slaptget = slapt_get_newest_pkg(avail_pkgs, "slapt-get");
         if (newest_slaptget != NULL) {
             const slapt_pkg_t *installed_slaptget = slapt_get_newest_pkg(installed_pkgs, "slapt-get");
-            slapt_transaction_t_add_dependencies(global_config, trxn, avail_pkgs, installed_pkgs, newest_slaptget);
-            if (installed_slaptget != NULL) /* should never be null */
+            if (installed_slaptget != NULL && (slapt_pkg_t_cmp_versions(installed_slaptget->version, newest_slaptget->version) > 0)) {
+                slapt_transaction_t_add_dependencies(global_config, trxn, avail_pkgs, installed_pkgs, newest_slaptget);
                 slapt_transaction_t_add_reinstall(trxn, installed_slaptget, newest_slaptget);
+            }
         }
     }

leoctrl avatar Feb 04 '25 21:02 leoctrl

This is intentional for dist-upgrade to always reinstall. This avoids any issues if the same version exists for multiple releases and avoids leaving a non-working utility afterward.

jaos avatar Feb 05 '25 00:02 jaos

I see... Thanks for the explanation. Since it's necessary to --dist-upgrade quite often on -current, I guess I'll have to find an alternative solution, such as removing slapt-get from my repo, or just accept it being reinstalled every time. Thanks

leoctrl avatar Feb 05 '25 16:02 leoctrl