libopkg: work-around yet another dependency checking problem
authorDaniel Golle <daniel@makrotopia.org>
Mon, 2 Nov 2020 22:44:43 +0000 (22:44 +0000)
committerDaniel Golle <daniel@makrotopia.org>
Mon, 2 Nov 2020 22:44:43 +0000 (22:44 +0000)
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
libopkg/pkg.h
libopkg/pkg_hash.c

index 21108b395316aa1f2c9ef9c1591c45c5457eb3df..28998f39fdc9405d22c530676ac92ee19b55c722 100644 (file)
@@ -114,6 +114,7 @@ struct abstract_pkg {
        abstract_pkg_vec_t *replaced_by;
 
        int dependencies_checked:2;
+       int prev_dependencies_checked:2;
        pkg_state_status_t state_status:4;
        pkg_state_flag_t state_flag:11;
 };
index 098206d03853e9e18496ac02cb8d08f18a3be58e..6eeedec70610be4b5ef150f12cddafbf4c0cea92 100644 (file)
@@ -283,6 +283,12 @@ pkg_hash_check_unresolved(pkg_t *maybe)
        int i, res = 0;
 
        depends = pkg_vec_alloc();
+       all = pkg_vec_alloc();
+       pkg_hash_fetch_available(all);
+       /* backup dependencies_checked marks, they get destroyed by pkg_hash_fetch_unsatisfied_dependencies */
+       for (i = 0; i < all->len; i++)
+               all->pkgs[i]->parent->prev_dependencies_checked = all->pkgs[i]->parent->dependencies_checked;
+
        pkg_hash_fetch_unsatisfied_dependencies(maybe, depends, &unresolved);
 
        if (unresolved) {
@@ -294,12 +300,10 @@ pkg_hash_check_unresolved(pkg_t *maybe)
        }
        pkg_vec_free(depends);
 
-       /* clear depenacy checked marks, left by pkg_hash_fetch_unsatisfied_dependencies */
-       all = pkg_vec_alloc();
-       pkg_hash_fetch_available(all);
-       for (i = 0; i < all->len; i++) {
-               all->pkgs[i]->parent->dependencies_checked = 0;
-       }
+       /* restore dependencies_checked marks */
+       for (i = 0; i < all->len; i++)
+               all->pkgs[i]->parent->dependencies_checked = all->pkgs[i]->parent->prev_dependencies_checked;
+
        pkg_vec_free(all);
 
        return res;