opkg: update patches, revert SVN r556
[opendreambox.git] / meta-opendreambox / recipes-devtools / opkg / opkg / 0007-pkg_hash_fetch_conflicts-move-iteration-over-conflic.patch
1 From b925a520a63fb291675f707e602d04295236c85b Mon Sep 17 00:00:00 2001
2 From: Andreas Oberritter <obi@opendreambox.org>
3 Date: Thu, 17 May 2012 01:17:52 +0200
4 Subject: [PATCH 7/9] pkg_hash_fetch_conflicts: move iteration over conflicts
5  to subroutine
6
7 Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
8 ---
9  libopkg/pkg_depends.c |   46 ++++++++++++++++++++++++----------------------
10  1 file changed, 24 insertions(+), 22 deletions(-)
11
12 diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c
13 index 6ff75f1..1999b64 100644
14 --- a/libopkg/pkg_depends.c
15 +++ b/libopkg/pkg_depends.c
16 @@ -284,39 +284,22 @@ is_pkg_a_replaces(pkg_t *pkg_scout,pkg_t *pkg)
17  
18  }
19  
20 -
21 -pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg)
22 +static void __pkg_hash_fetch_conflicts(pkg_t * pkg, pkg_vec_t * installed_conflicts)
23  {
24 -    pkg_vec_t * installed_conflicts, * test_vec;
25 +    pkg_vec_t * test_vec;
26      compound_depend_t * conflicts;
27      depend_t ** possible_satisfiers;
28      depend_t * possible_satisfier;
29      int i, j, k;
30 -    abstract_pkg_t * ab_pkg;
31      pkg_t **pkg_scouts;
32      pkg_t *pkg_scout;
33  
34 -    /*
35 -     * this is a setup to check for redundant/cyclic dependency checks,
36 -     * which are marked at the abstract_pkg level
37 -     */
38 -    if(!(ab_pkg = pkg->parent)){
39 -       opkg_msg(ERROR, "Internal error: %s not in hash table\n", pkg->name);
40 -       return (pkg_vec_t *)NULL;
41 -    }
42 -
43      conflicts = pkg->conflicts;
44 -    if(!conflicts){
45 -       return (pkg_vec_t *)NULL;
46 -    }
47 -    installed_conflicts = pkg_vec_alloc();
48 -
49 -
50 -
51 +    if(!conflicts)
52 +       return;
53  
54      /* foreach conflict */
55      for(i = 0; i < pkg->conflicts_count; i++){
56 -
57         possible_satisfiers = conflicts->possibilities;
58  
59         /* foreach possible satisfier */
60 @@ -352,11 +335,30 @@ pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg)
61         }
62         conflicts++;
63      }
64 +}
65 +
66 +pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg)
67 +{
68 +    pkg_vec_t * installed_conflicts;
69 +    abstract_pkg_t * ab_pkg;
70 +
71 +    /*
72 +     * this is a setup to check for redundant/cyclic dependency checks,
73 +     * which are marked at the abstract_pkg level
74 +     */
75 +    if(!(ab_pkg = pkg->parent)){
76 +       opkg_msg(ERROR, "Internal error: %s not in hash table\n", pkg->name);
77 +       return (pkg_vec_t *)NULL;
78 +    }
79 +
80 +    installed_conflicts = pkg_vec_alloc();
81 +
82 +    __pkg_hash_fetch_conflicts(pkg, installed_conflicts);
83  
84      if (installed_conflicts->len)
85             return installed_conflicts;
86      pkg_vec_free(installed_conflicts);
87 -       return (pkg_vec_t *)NULL;
88 +    return (pkg_vec_t *)NULL;
89  }
90  
91  int version_constraints_satisfied(depend_t * depends, pkg_t * pkg)
92 -- 
93 1.7.9.5
94