summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/opkg/opkg/0006-detect-circular-dependencies.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/opkg/opkg/0006-detect-circular-dependencies.patch')
-rw-r--r--meta/recipes-devtools/opkg/opkg/0006-detect-circular-dependencies.patch117
1 files changed, 117 insertions, 0 deletions
diff --git a/meta/recipes-devtools/opkg/opkg/0006-detect-circular-dependencies.patch b/meta/recipes-devtools/opkg/opkg/0006-detect-circular-dependencies.patch
new file mode 100644
index 0000000000..5cf8618170
--- /dev/null
+++ b/meta/recipes-devtools/opkg/opkg/0006-detect-circular-dependencies.patch
@@ -0,0 +1,117 @@
1From f434078a342435ae8a666b599d989c30d4c6a7f5 Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Sun, 18 Dec 2011 23:54:30 +0000
4Subject: [PATCH 6/7] detect circular dependencies
5
6Add logic to detect circular dependencies. If we see any dependency from
7any given parent twice, ignore it the second time and print a notice message
8that we did so.
9
10Upstream-Status: Submitted
11http://code.google.com/p/opkg/issues/detail?id=93
12
13Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
14Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
15---
16 libopkg/opkg_install.c | 8 ++++++++
17 libopkg/pkg.c | 2 ++
18 libopkg/pkg.h | 1 +
19 libopkg/pkg_depends.c | 3 +--
20 libopkg/pkg_depends.h | 1 +
21 5 files changed, 13 insertions(+), 2 deletions(-)
22
23diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c
24index 1632066..0216914 100644
25--- a/libopkg/opkg_install.c
26+++ b/libopkg/opkg_install.c
27@@ -84,8 +84,14 @@ satisfy_dependencies_for(pkg_t *pkg)
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+ opkg_msg(NOTICE,"Breaking cicular dependency on %s for %s.\n", pkg->name, dep->name);
33+ continue;
34+ }
35 if ((dep->state_status != SS_INSTALLED) && (dep->state_status != SS_UNPACKED)) {
36 opkg_msg(DEBUG2,"Calling opkg_install_pkg.\n");
37+ if (!is_pkg_in_pkg_vec(dep->wanted_by, pkg))
38+ pkg_vec_insert(dep->wanted_by, pkg);
39 err = opkg_install_pkg(dep, 0);
40 /* mark this package as having been automatically installed to
41 * satisfy a dependency */
42@@ -115,6 +121,8 @@ satisfy_dependencies_for(pkg_t *pkg)
43 /* The package was uninstalled when we started, but another
44 dep earlier in this loop may have depended on it and pulled
45 it in, so check first. */
46+ if (!is_pkg_in_pkg_vec(dep->wanted_by, pkg))
47+ pkg_vec_insert(dep->wanted_by, pkg);
48 if ((dep->state_status != SS_INSTALLED)
49 && (dep->state_status != SS_UNPACKED)) {
50 opkg_msg(DEBUG2,"Calling opkg_install_pkg.\n");
51diff --git a/libopkg/pkg.c b/libopkg/pkg.c
52index 6ccbde2..be486ee 100644
53--- a/libopkg/pkg.c
54+++ b/libopkg/pkg.c
55@@ -86,6 +86,7 @@ pkg_init(pkg_t *pkg)
56 pkg->section = NULL;
57 pkg->description = NULL;
58 pkg->state_want = SW_UNKNOWN;
59+ pkg->wanted_by = pkg_vec_alloc();
60 pkg->state_flag = SF_OK;
61 pkg->state_status = SS_NOT_INSTALLED;
62 pkg->depends_str = NULL;
63@@ -191,6 +192,7 @@ pkg_deinit(pkg_t *pkg)
64 pkg->description = NULL;
65
66 pkg->state_want = SW_UNKNOWN;
67+ pkg_vec_free(pkg->wanted_by);
68 pkg->state_flag = SF_OK;
69 pkg->state_status = SS_NOT_INSTALLED;
70
71diff --git a/libopkg/pkg.h b/libopkg/pkg.h
72index 775b656..5d468cb 100644
73--- a/libopkg/pkg.h
74+++ b/libopkg/pkg.h
75@@ -129,6 +129,7 @@ struct pkg
76 char *description;
77 char *tags;
78 pkg_state_want_t state_want;
79+ pkg_vec_t *wanted_by;
80 pkg_state_flag_t state_flag;
81 pkg_state_status_t state_status;
82 char **depends_str;
83diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c
84index 36c76aa..a72eed7 100644
85--- a/libopkg/pkg_depends.c
86+++ b/libopkg/pkg_depends.c
87@@ -30,7 +30,6 @@ static int parseDepends(compound_depend_t *compound_depend, char * depend_str);
88 static depend_t * depend_init(void);
89 static char ** add_unresolved_dep(pkg_t * pkg, char ** the_lost, int ref_ndx);
90 static char ** merge_unresolved(char ** oldstuff, char ** newstuff);
91-static int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg);
92
93 static int pkg_installed_and_constraint_satisfied(pkg_t *pkg, void *cdata)
94 {
95@@ -531,7 +530,7 @@ int pkg_dependence_satisfied(depend_t *depend)
96 return 0;
97 }
98
99-static int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg)
100+int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg)
101 {
102 int i;
103 pkg_t ** pkgs = vec->pkgs;
104diff --git a/libopkg/pkg_depends.h b/libopkg/pkg_depends.h
105index b8072e2..ca0801f 100644
106--- a/libopkg/pkg_depends.h
107+++ b/libopkg/pkg_depends.h
108@@ -87,5 +87,6 @@ pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg);
109 int pkg_dependence_satisfiable(depend_t *depend);
110 int pkg_dependence_satisfied(depend_t *depend);
111 const char* constraint_to_str(enum version_constraint c);
112+int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg);
113
114 #endif
115--
1161.7.12
117