From ea1f09e2112cf5c98d45c973af0bcc34fb3f43f1 Mon Sep 17 00:00:00 2001 From: pixdamix@gmail.com Date: Thu, 22 Nov 2012 04:17:43 -0500 Subject: Fix dependency issues for preinst scripts There is a problem with dependency order when installing packages. The key problem revolves around the satisfy_dependencies_for() function which is called from opkg_install_pkg just before the installation (and preinst) happens. The satisfy_dependencies_for() function calls pkg_hash_fetch_unsatisfied_dependencies() which will only return packages which were previously not marked as *going* to be installed at some point. For the purposes of opkg_install_pkg() we really need to know which dependencies haven't been installed yet. This patch adds pkg_hash_fetch_satisfied_dependencies() which returns a list of package dependencies. We can then directly check the status of these and ensure any hard dependencies (not suggestions or recommendations) are installed before returning. Consider the situation (where -> means 'depends on'): X -> A,E A -> B,E E -> B B -> C Currently X would install A and E. When installing A the packages B, E and C would be marked as "to install". When the package B is considered the second time (as a dependency of E rather than A), it would install straight away even though C was not currently installed, just marked as needing to be installed. The patch changes the behaviour so B can't install until C really is installed. This change is required to run the postinst scripts in the correct order. Signed-off-by: Martin Jansa git-svn-id: http://opkg.googlecode.com/svn/trunk@638 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- (limited to 'libopkg/pkg_depends.h') diff --git a/libopkg/pkg_depends.h b/libopkg/pkg_depends.h index 5d1f074..b8072e2 100644 --- a/libopkg/pkg_depends.h +++ b/libopkg/pkg_depends.h @@ -82,6 +82,7 @@ char *pkg_depend_str(pkg_t *pkg, int index); void buildDependedUponBy(pkg_t * pkg, abstract_pkg_t * ab_pkg); int version_constraints_satisfied(depend_t * depends, pkg_t * pkg); int pkg_hash_fetch_unsatisfied_dependencies(pkg_t * pkg, pkg_vec_t *depends, char *** unresolved); +pkg_vec_t * pkg_hash_fetch_satisfied_dependencies(pkg_t * pkg); pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg); int pkg_dependence_satisfiable(depend_t *depend); int pkg_dependence_satisfied(depend_t *depend); -- cgit v0.9.1