Merge remote-tracking branch 'oe21/master' into vuplus-3.0
[vuplus_openvuplus_3.0] / meta-openvuplus / recipes-devtools / opkg / opkg / 0001-pkg_hash_fetch_conflicts-move-iteration-over-conflic.patch
1 diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c
2 index eb630d1..de105bf 100644
3 --- a/libopkg/pkg_depends.c
4 +++ b/libopkg/pkg_depends.c
5 @@ -377,36 +377,23 @@ is_pkg_a_replaces(pkg_t *pkg_scout,pkg_t *pkg)
6  }
7  
8  
9 -pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg)
10 +static pkg_vec_t * __pkg_hash_fetch_conflicts(pkg_t * pkg, pkg_t * installed_conflicts)
11  {
12 -    pkg_vec_t * installed_conflicts, * test_vec;
13 +    pkg_vec_t * test_vec;
14      compound_depend_t * conflicts;
15      depend_t ** possible_satisfiers;
16      depend_t * possible_satisfier;
17      int i, j, k;
18      int count;
19 -    abstract_pkg_t * ab_pkg;
20      pkg_t **pkg_scouts;
21      pkg_t *pkg_scout;
22  
23 -    /*
24 -     * this is a setup to check for redundant/cyclic dependency checks,
25 -     * which are marked at the abstract_pkg level
26 -     */
27 -    if(!(ab_pkg = pkg->parent)){
28 -       opkg_msg(ERROR, "Internal error: %s not in hash table\n", pkg->name);
29 -       return (pkg_vec_t *)NULL;
30 -    }
31 -
32      conflicts = pkg->conflicts;
33 -    if(!conflicts){
34 -       return (pkg_vec_t *)NULL;
35 -    }
36 -    installed_conflicts = pkg_vec_alloc();
37 -
38 -    count = pkg->conflicts_count;
39  
40 +       if(!conflicts)
41 +               return;
42  
43 +    count = pkg->conflicts_count;
44  
45      /* foreach conflict */
46      for(i = 0; i < pkg->conflicts_count; i++){
47 @@ -446,10 +433,29 @@ pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg)
48         }
49         conflicts++;
50      }
51 +}
52 +
53 +pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg)
54 +{
55 +       pkg_vec_t * installed_conflicts;
56 +       abstract_pkg_t * ab_pkg;
57 +
58 +       /*
59 +        * this is a setup to check for redundant/cyclic dependency checks,
60 +        * which are marked at the abstract_pkg level
61 +        */
62 +       if(!(ab_pkg = pkg->parent)){
63 +               opkg_msg(ERROR, "Internal error: %s not in hash table\n", pkg->name);
64 +               return (pkg_vec_t *)NULL;
65 +       }
66 +
67 +       installed_conflicts = pkg_vec_alloc();
68 +
69 +       __pkg_hash_fetch_conflicts(pkg, installed_conflicts);
70  
71 -    if (installed_conflicts->len)
72 -           return installed_conflicts;
73 -    pkg_vec_free(installed_conflicts);
74 +       if (installed_conflicts->len)
75 +               return installed_conflicts;
76 +       pkg_vec_free(installed_conflicts);
77         return (pkg_vec_t *)NULL;
78  }
79