diff options
-rw-r--r-- | libopkg/opkg_install.c | 8 | ||||
-rw-r--r-- | libopkg/pkg.c | 2 | ||||
-rw-r--r-- | libopkg/pkg.h | 1 | ||||
-rw-r--r-- | libopkg/pkg_depends.c | 3 | ||||
-rw-r--r-- | libopkg/pkg_depends.h | 1 |
5 files changed, 13 insertions, 2 deletions
diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c index 6ed67d2..be36a64 100644 --- a/libopkg/opkg_install.c +++ b/libopkg/opkg_install.c @@ -84,8 +84,14 @@ satisfy_dependencies_for(pkg_t *pkg) /* The package was uninstalled when we started, but another dep earlier in this loop may have depended on it and pulled it in, so check first. */ + if (is_pkg_in_pkg_vec(dep->wanted_by, pkg)) { + opkg_msg(NOTICE,"Breaking cicular dependency on %s for %s.\n", pkg->name, dep->name); + continue; + } if ((dep->state_status != SS_INSTALLED) && (dep->state_status != SS_UNPACKED)) { opkg_msg(DEBUG2,"Calling opkg_install_pkg.\n"); + if (!is_pkg_in_pkg_vec(dep->wanted_by, pkg)) + pkg_vec_insert(dep->wanted_by, pkg); err = opkg_install_pkg(dep, 0); /* mark this package as having been automatically installed to * satisfy a dependency */ @@ -115,6 +121,8 @@ satisfy_dependencies_for(pkg_t *pkg) /* The package was uninstalled when we started, but another dep earlier in this loop may have depended on it and pulled it in, so check first. */ + if (!is_pkg_in_pkg_vec(dep->wanted_by, pkg)) + pkg_vec_insert(dep->wanted_by, pkg); if ((dep->state_status != SS_INSTALLED) && (dep->state_status != SS_UNPACKED)) { opkg_msg(DEBUG2,"Calling opkg_install_pkg.\n"); diff --git a/libopkg/pkg.c b/libopkg/pkg.c index 3493a8b..018c0c7 100644 --- a/libopkg/pkg.c +++ b/libopkg/pkg.c @@ -86,6 +86,7 @@ pkg_init(pkg_t *pkg) pkg->section = NULL; pkg->description = NULL; pkg->state_want = SW_UNKNOWN; + pkg->wanted_by = pkg_vec_alloc(); pkg->state_flag = SF_OK; pkg->state_status = SS_NOT_INSTALLED; pkg->depends_str = NULL; @@ -191,6 +192,7 @@ pkg_deinit(pkg_t *pkg) pkg->description = NULL; pkg->state_want = SW_UNKNOWN; + pkg_vec_free(pkg->wanted_by); pkg->state_flag = SF_OK; pkg->state_status = SS_NOT_INSTALLED; diff --git a/libopkg/pkg.h b/libopkg/pkg.h index 775b656..5d468cb 100644 --- a/libopkg/pkg.h +++ b/libopkg/pkg.h @@ -129,6 +129,7 @@ struct pkg char *description; char *tags; pkg_state_want_t state_want; + pkg_vec_t *wanted_by; pkg_state_flag_t state_flag; pkg_state_status_t state_status; char **depends_str; diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c index 208b934..d45f697 100644 --- a/libopkg/pkg_depends.c +++ b/libopkg/pkg_depends.c @@ -30,7 +30,6 @@ static int parseDepends(compound_depend_t *compound_depend, char * depend_str); static depend_t * depend_init(void); static char ** add_unresolved_dep(pkg_t * pkg, char ** the_lost, int ref_ndx); static char ** merge_unresolved(char ** oldstuff, char ** newstuff); -static int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg); static int pkg_installed_and_constraint_satisfied(pkg_t *pkg, void *cdata) { @@ -531,7 +530,7 @@ int pkg_dependence_satisfied(depend_t *depend) return 0; } -static int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg) +int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg) { int i; pkg_t ** pkgs = vec->pkgs; diff --git a/libopkg/pkg_depends.h b/libopkg/pkg_depends.h index b8072e2..ca0801f 100644 --- a/libopkg/pkg_depends.h +++ b/libopkg/pkg_depends.h @@ -87,5 +87,6 @@ pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg); int pkg_dependence_satisfiable(depend_t *depend); int pkg_dependence_satisfied(depend_t *depend); const char* constraint_to_str(enum version_constraint c); +int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg); #endif |