tzdata: update bbappend for 2013i
[opendreambox.git] / meta-opendreambox / recipes-devtools / opkg / opkg / 0018-libopkg-opkg_install.c-Fix-for-virtual-packages.patch
1 From 1e5aac9485b2efa841cbbebaabd1deb7782de6b2 Mon Sep 17 00:00:00 2001
2 From: Carl Cospel <ccospel@gmail.com>
3 Date: Mon, 24 Mar 2014 23:28:28 -0400
4 Subject: [PATCH 18/19] libopkg/opkg_install.c - Fix for virtual packages
5 To: opkg-devel@googlegroups.com
6 Cc: paul@paulbarker.me.uk
7
8 Replace providers of virtual packages that are conflict/provide/replace by another package
9
10 This fixes issue 89.
11
12 Signed-off-by: Carl Cospel <ccospel@gmail.com>
13 Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
14 (cherry picked from commit 1b9a0d61137eaf475187fe9366e8d3bf705404bf)
15 Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
16 ---
17  libopkg/opkg_install.c | 25 +++++++++++++++++++++++++
18  libopkg/pkg_depends.c  |  5 ++++-
19  2 files changed, 29 insertions(+), 1 deletion(-)
20
21 diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c
22 index 6d0ff1f..0be8200 100644
23 --- a/libopkg/opkg_install.c
24 +++ b/libopkg/opkg_install.c
25 @@ -422,6 +422,25 @@ pkg_remove_orphan_dependent(pkg_t *pkg, pkg_t *old_pkg)
26         return err;
27  }
28  
29 +/* adds the list of providers of the package being replaced */
30 +static void
31 +pkg_get_provider_replacees(pkg_t *pkg, abstract_pkg_vec_t *provided_by, pkg_vec_t *replacees)
32 +{
33 +     int i,j;
34 +
35 +     for (i=0; i<provided_by->len; i++) {
36 +         abstract_pkg_t *ap = provided_by->pkgs[i];
37 +         if (!ap->pkgs)
38 +              continue;
39 +          for (j=0; j<ap->pkgs->len; j++) {
40 +              pkg_t *replacee = ap->pkgs->pkgs[j];
41 +              if (replacee->state_status == SS_INSTALLED ||
42 +                  replacee->state_status == SS_UNPACKED)
43 +                      pkg_vec_insert(replacees, replacee);
44 +          }
45 +     }
46 +}
47 +
48  /* returns number of installed replacees */
49  static int
50  pkg_get_installed_replacees(pkg_t *pkg, pkg_vec_t *installed_replacees)
51 @@ -431,6 +450,12 @@ pkg_get_installed_replacees(pkg_t *pkg, pkg_vec_t *installed_replacees)
52       int i, j;
53       for (i = 0; i < replaces_count; i++) {
54           abstract_pkg_t *ab_pkg = replaces[i];
55 +         /* If any package listed in the replacement field is a virtual (provided)
56 +          * package, check to see if it conflicts with any abstract package that pkg
57 +          * provides
58 +          */
59 +         if (ab_pkg->provided_by && pkg_conflicts_abstract(pkg, ab_pkg))
60 +              pkg_get_provider_replacees(pkg, ab_pkg->provided_by, installed_replacees);
61           pkg_vec_t *pkg_vec = ab_pkg->pkgs;
62           if (pkg_vec) {
63                for (j = 0; j < pkg_vec->len; j++) {
64 diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c
65 index b23caf6..5337e6c 100644
66 --- a/libopkg/pkg_depends.c
67 +++ b/libopkg/pkg_depends.c
68 @@ -437,7 +437,10 @@ static void __pkg_hash_fetch_conflictees(pkg_t *pkg, pkg_vec_t *installed_confli
69  
70      for (i = 0; i < available_pkgs->len; i++) {
71          pkg_t *cpkg = available_pkgs->pkgs[i];
72 -        if (pkg_conflicts(cpkg, pkg) && !is_pkg_a_provides(cpkg, pkg) && !is_pkg_in_pkg_vec(installed_conflicts, cpkg))
73 +        if (pkg_conflicts(cpkg, pkg)
74 +                && !is_pkg_a_provides(cpkg, pkg)
75 +                && !is_pkg_in_pkg_vec(installed_conflicts, cpkg)
76 +                && !pkg_replaces(pkg, cpkg))
77              pkg_vec_insert(installed_conflicts, cpkg);
78      }
79  
80 -- 
81 1.9.1
82