devnodes-minimal: new recipe to create /dev/console and /dev/null
[opendreambox.git] / meta-opendreambox / recipes-devtools / opkg / opkg / 0014-__pkg_hash_fetch_conflicts-ignore-virtual-conflicts.patch
1 From 882ac246fc642c7cd18da9d4c28c3935fc8e4920 Mon Sep 17 00:00:00 2001
2 From: Andreas Oberritter <obi@opendreambox.org>
3 Date: Sun, 17 Mar 2013 22:52:07 +0100
4 Subject: [PATCH 14/17] __pkg_hash_fetch_conflicts: ignore virtual conflicts
5
6 * If a package a both provides and conflicts the same package b,
7   then it's a virtual package. Ignore it!
8
9 Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
10 ---
11  libopkg/pkg_depends.c | 18 ++++++++++++++++--
12  1 file changed, 16 insertions(+), 2 deletions(-)
13
14 diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c
15 index cbb77ce..413f74d 100644
16 --- a/libopkg/pkg_depends.c
17 +++ b/libopkg/pkg_depends.c
18 @@ -363,7 +363,21 @@ static int is_pkg_a_replaces(const pkg_t *pkg_scout, const pkg_t *pkg)
19      }
20  
21      return 0;
22 +}
23  
24 +static int is_pkg_a_provides(const pkg_t *pkg_scout, const pkg_t *pkg)
25 +{
26 +    int i ;
27 +
28 +    for (i = 0; i < pkg->provides_count; i++) {
29 +        if (strcmp(pkg_scout->name,pkg->provides[i]->name)==0) {      // Found
30 +            opkg_msg(DEBUG2, "Seems I've found a provide %s %s\n",
31 +                       pkg_scout->name, pkg->provides[i]->name);
32 +            return 1;
33 +        }
34 +    }
35 +
36 +    return 0;
37  }
38  
39  static void __pkg_hash_fetch_conflicts(pkg_t * pkg, pkg_vec_t * installed_conflicts)
40 @@ -407,7 +421,7 @@ static void __pkg_hash_fetch_conflicts(pkg_t * pkg, pkg_vec_t * installed_confli
41                          continue;
42                      }
43                     if ((pkg_scout->state_status == SS_INSTALLED || pkg_scout->state_want == SW_INSTALL) &&
44 -                      version_constraints_satisfied(possible_satisfier, pkg_scout) && !is_pkg_a_replaces(pkg_scout,pkg)){
45 +                      version_constraints_satisfied(possible_satisfier, pkg_scout) && !is_pkg_a_replaces(pkg_scout,pkg) && !is_pkg_a_provides(pkg_scout,pkg)){
46                         if (!is_pkg_in_pkg_vec(installed_conflicts, pkg_scout)){
47                             pkg_vec_insert(installed_conflicts, pkg_scout);
48                         }
49 @@ -428,7 +442,7 @@ static void __pkg_hash_fetch_conflictees(pkg_t *pkg, pkg_vec_t *installed_confli
50  
51      for (i = 0; i < available_pkgs->len; i++) {
52          pkg_t *cpkg = available_pkgs->pkgs[i];
53 -        if (pkg_conflicts(cpkg, pkg) && !is_pkg_in_pkg_vec(installed_conflicts, cpkg))
54 +        if (pkg_conflicts(cpkg, pkg) && !is_pkg_a_provides(cpkg, pkg) && !is_pkg_in_pkg_vec(installed_conflicts, cpkg))
55              pkg_vec_insert(installed_conflicts, cpkg);
56      }
57  
58 -- 
59 1.8.1.2
60