summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/opkg/opkg/track_parents.patch
blob: ef327e3ef0ec101ec50345be626c9c2d61b2f201 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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 dependency */
@@ -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