Skip to content

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

@leoctrl

Description

@leoctrl

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);
+            }
         }
     }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions