summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-12-18 23:54:30 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-12-19 09:29:16 +0000
commitf4c80d646f633215ba8341c389875b99f7f526e6 (patch)
treecd1140081fc6b8bc7f69bcbf18f7943c0eb38046 /meta/recipes-devtools
parentb281fd127bac9ba77ab63a5c2b812ddd5d56df37 (diff)
downloadpoky-f4c80d646f633215ba8341c389875b99f7f526e6.tar.gz
opkg: Add logic to detect and creak circular dependencies
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. (From OE-Core rev: 5a2b67b8faad3dd5417ba89d8e82ca564753ccc9) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/opkg/opkg/track_parents.patch99
-rw-r--r--meta/recipes-devtools/opkg/opkg_svn.bb3
2 files changed, 101 insertions, 1 deletions
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 0000000000..1f54256c2d
--- /dev/null
+++ b/meta/recipes-devtools/opkg/opkg/track_parents.patch
@@ -0,0 +1,99 @@
1Add logic to detect circular dependencies. If we see any dependency from any
2given parent twice, ignore it the second time and print a notice message
3that we did so.
4
5Upstream-Status: Pending
6RP 2011/12/18
7
8Index: trunk/libopkg/opkg_install.c
9===================================================================
10--- trunk.orig/libopkg/opkg_install.c 2011-12-18 11:15:17.320725365 +0000
11+++ trunk/libopkg/opkg_install.c 2011-12-18 12:38:54.980609225 +0000
12@@ -84,8 +84,14 @@
13 /* The package was uninstalled when we started, but another
14 dep earlier in this loop may have depended on it and pulled
15 it in, so check first. */
16+ if (is_pkg_in_pkg_vec(dep->wanted_by, pkg)) {
17+ opkg_msg(NOTICE,"Breaking cicular dependency on %s for %s.\n", pkg->name, dep->name);
18+ continue;
19+ }
20 if ((dep->state_status != SS_INSTALLED) && (dep->state_status != SS_UNPACKED)) {
21 opkg_msg(DEBUG2,"Calling opkg_install_pkg.\n");
22+ if (!is_pkg_in_pkg_vec(dep->wanted_by, pkg))
23+ pkg_vec_insert(dep->wanted_by, pkg);
24 err = opkg_install_pkg(dep, 0);
25 /* mark this package as having been automatically installed to
26 * satisfy a dependancy */
27@@ -115,6 +121,8 @@
28 /* The package was uninstalled when we started, but another
29 dep earlier in this loop may have depended on it and pulled
30 it in, so check first. */
31+ if (!is_pkg_in_pkg_vec(dep->wanted_by, pkg))
32+ pkg_vec_insert(dep->wanted_by, pkg);
33 if ((dep->state_status != SS_INSTALLED)
34 && (dep->state_status != SS_UNPACKED)) {
35 opkg_msg(DEBUG2,"Calling opkg_install_pkg.\n");
36Index: trunk/libopkg/pkg.c
37===================================================================
38--- trunk.orig/libopkg/pkg.c 2011-12-18 11:12:39.976729002 +0000
39+++ trunk/libopkg/pkg.c 2011-12-18 11:22:34.528715535 +0000
40@@ -86,6 +86,7 @@
41 pkg->section = NULL;
42 pkg->description = NULL;
43 pkg->state_want = SW_UNKNOWN;
44+ pkg->wanted_by = pkg_vec_alloc();
45 pkg->state_flag = SF_OK;
46 pkg->state_status = SS_NOT_INSTALLED;
47 pkg->depends_str = NULL;
48@@ -191,6 +192,7 @@
49 pkg->description = NULL;
50
51 pkg->state_want = SW_UNKNOWN;
52+ pkg_vec_free(pkg->wanted_by);
53 pkg->state_flag = SF_OK;
54 pkg->state_status = SS_NOT_INSTALLED;
55
56Index: trunk/libopkg/pkg.h
57===================================================================
58--- trunk.orig/libopkg/pkg.h 2011-12-18 11:12:37.120728742 +0000
59+++ trunk/libopkg/pkg.h 2011-12-18 11:15:39.080725150 +0000
60@@ -129,6 +129,7 @@
61 char *description;
62 char *tags;
63 pkg_state_want_t state_want;
64+ pkg_vec_t *wanted_by;
65 pkg_state_flag_t state_flag;
66 pkg_state_status_t state_status;
67 char **depends_str;
68Index: trunk/libopkg/pkg_depends.c
69===================================================================
70--- trunk.orig/libopkg/pkg_depends.c 2011-12-18 11:14:24.464726569 +0000
71+++ trunk/libopkg/pkg_depends.c 2011-12-18 11:30:32.516704127 +0000
72@@ -30,7 +30,6 @@
73 static depend_t * depend_init(void);
74 static char ** add_unresolved_dep(pkg_t * pkg, char ** the_lost, int ref_ndx);
75 static char ** merge_unresolved(char ** oldstuff, char ** newstuff);
76-static int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg);
77
78 static int pkg_installed_and_constraint_satisfied(pkg_t *pkg, void *cdata)
79 {
80@@ -531,7 +530,7 @@
81 return 0;
82 }
83
84-static int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg)
85+int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg)
86 {
87 int i;
88 pkg_t ** pkgs = vec->pkgs;
89Index: trunk/libopkg/pkg_depends.h
90===================================================================
91--- trunk.orig/libopkg/pkg_depends.h 2011-12-18 11:28:51.960706484 +0000
92+++ trunk/libopkg/pkg_depends.h 2011-12-18 11:29:19.400705862 +0000
93@@ -87,5 +87,6 @@
94 int pkg_dependence_satisfiable(depend_t *depend);
95 int pkg_dependence_satisfied(depend_t *depend);
96 const char* constraint_to_str(enum version_constraint c);
97+int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg);
98
99 #endif
diff --git a/meta/recipes-devtools/opkg/opkg_svn.bb b/meta/recipes-devtools/opkg/opkg_svn.bb
index 2645d52c81..dbdfc7e82b 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 \
15 file://fix_installorder.patch \ 15 file://fix_installorder.patch \
16 file://offline_postinstall.patch\ 16 file://offline_postinstall.patch\
17 file://offlineroot_varname.patch \ 17 file://offlineroot_varname.patch \
18 file://track_parents.patch \
18" 19"
19 20
20S = "${WORKDIR}/trunk" 21S = "${WORKDIR}/trunk"
21 22
22SRCREV = "633" 23SRCREV = "633"
23PV = "0.1.8+svnr${SRCPV}" 24PV = "0.1.8+svnr${SRCPV}"
24PR = "r2" 25PR = "r3"
25 26
26PACKAGES =+ "libopkg${PKGSUFFIX}-dev libopkg${PKGSUFFIX} update-alternatives-cworth${PKGSUFFIX}" 27PACKAGES =+ "libopkg${PKGSUFFIX}-dev libopkg${PKGSUFFIX} update-alternatives-cworth${PKGSUFFIX}"
27 28