From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: openembedded-core <openembedded-core@lists.openembedded.org>
Cc: "graham.gower" <graham.gower@gmail.com>
Subject: [PATCH] opkg: Add logic to detect and creak circular dependencies
Date: Sun, 18 Dec 2011 23:54:30 +0000 [thread overview]
Message-ID: <1324252470.4568.156.camel@ted> (raw)
This addresses some of the concerns about the previous opkg changes
allowing it to break out of circular dependency loops with just a notice
in the logs rather than effectively going OOM.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
diff --git a/meta/recipes-devtools/opkg/opkg/track_parents.patch b/meta/recipes-devtools/opkg/opkg/track_parents.patch
new file mode 100644
index 0000000..1f54256
--- /dev/null
+++ b/meta/recipes-devtools/opkg/opkg/track_parents.patch
@@ -0,0 +1,99 @@
+Add logic to detect circular dependencies. If we see any dependency from any
+given parent twice, ignore it the second time and print a notice message
+that we did so.
+
+Upstream-Status: Pending
+RP 2011/12/18
+
+Index: trunk/libopkg/opkg_install.c
+===================================================================
+--- trunk.orig/libopkg/opkg_install.c 2011-12-18 11:15:17.320725365 +0000
++++ trunk/libopkg/opkg_install.c 2011-12-18 12:38:54.980609225 +0000
+@@ -84,8 +84,14 @@
+ /* 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 dependancy */
+@@ -115,6 +121,8 @@
+ /* 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");
+Index: trunk/libopkg/pkg.c
+===================================================================
+--- trunk.orig/libopkg/pkg.c 2011-12-18 11:12:39.976729002 +0000
++++ trunk/libopkg/pkg.c 2011-12-18 11:22:34.528715535 +0000
+@@ -86,6 +86,7 @@
+ 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->description = NULL;
+
+ pkg->state_want = SW_UNKNOWN;
++ pkg_vec_free(pkg->wanted_by);
+ pkg->state_flag = SF_OK;
+ pkg->state_status = SS_NOT_INSTALLED;
+
+Index: trunk/libopkg/pkg.h
+===================================================================
+--- trunk.orig/libopkg/pkg.h 2011-12-18 11:12:37.120728742 +0000
++++ trunk/libopkg/pkg.h 2011-12-18 11:15:39.080725150 +0000
+@@ -129,6 +129,7 @@
+ 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;
+Index: trunk/libopkg/pkg_depends.c
+===================================================================
+--- trunk.orig/libopkg/pkg_depends.c 2011-12-18 11:14:24.464726569 +0000
++++ trunk/libopkg/pkg_depends.c 2011-12-18 11:30:32.516704127 +0000
+@@ -30,7 +30,6 @@
+ 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 @@
+ 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;
+Index: trunk/libopkg/pkg_depends.h
+===================================================================
+--- trunk.orig/libopkg/pkg_depends.h 2011-12-18 11:28:51.960706484 +0000
++++ trunk/libopkg/pkg_depends.h 2011-12-18 11:29:19.400705862 +0000
+@@ -87,5 +87,6 @@
+ 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
diff --git a/meta/recipes-devtools/opkg/opkg_svn.bb b/meta/recipes-devtools/opkg/opkg_svn.bb
index 2645d52..dbdfc7e 100644
--- a/meta/recipes-devtools/opkg/opkg_svn.bb
+++ b/meta/recipes-devtools/opkg/opkg_svn.bb
@@ -15,13 +15,14 @@ SRC_URI = "svn://opkg.googlecode.com/svn;module=trunk;proto=http \
file://fix_installorder.patch \
file://offline_postinstall.patch\
file://offlineroot_varname.patch \
+ file://track_parents.patch \
"
S = "${WORKDIR}/trunk"
SRCREV = "633"
PV = "0.1.8+svnr${SRCPV}"
-PR = "r2"
+PR = "r3"
PACKAGES =+ "libopkg${PKGSUFFIX}-dev libopkg${PKGSUFFIX} update-alternatives-cworth${PKGSUFFIX}"
next reply other threads:[~2011-12-19 0:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-18 23:54 Richard Purdie [this message]
2011-12-19 7:46 ` [PATCH] opkg: Add logic to detect and creak circular dependencies Andreas Müller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1324252470.4568.156.camel@ted \
--to=richard.purdie@linuxfoundation.org \
--cc=graham.gower@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.