opkg: update patches, revert SVN r556
[opendreambox.git] / meta-opendreambox / recipes-devtools / opkg / opkg / 0009-Revert-Add-Recommended-packages-to-the-depended_upon.patch
1 From 70d10c10288da23755055c881bea01b61a2d4df7 Mon Sep 17 00:00:00 2001
2 From: Andreas Oberritter <obi@opendreambox.org>
3 Date: Thu, 17 May 2012 22:57:35 +0200
4 Subject: [PATCH 9/9] Revert "Add Recommended packages to the depended_upon_by
5  field."
6
7 This reverts commit ac2222f7d6514fb403ce0848f6812a22a48f75c7.
8 ---
9  libopkg/pkg_depends.c |   70 ++++++++++++++++++++++---------------------------
10  1 file changed, 32 insertions(+), 38 deletions(-)
11
12 diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c
13 index f237733..ec60b99 100644
14 --- a/libopkg/pkg_depends.c
15 +++ b/libopkg/pkg_depends.c
16 @@ -787,49 +787,43 @@ pkg_depend_str(pkg_t *pkg, int idx)
17         return str;
18  }
19  
20 +/*
21 + * WARNING: This function assumes pre_depends and depends are at the
22 + * start of the pkg->depends array.
23 + */
24  void buildDependedUponBy(pkg_t * pkg, abstract_pkg_t * ab_pkg)
25  {
26 -       compound_depend_t * depends;
27 -       int count, othercount;
28 -       int i, j;
29 -       abstract_pkg_t * ab_depend;
30 -       abstract_pkg_t ** temp;
31 -
32 -       count = pkg->pre_depends_count +
33 -                       pkg->depends_count +
34 -                       pkg->recommends_count +
35 -                       pkg->suggests_count;
36 -
37 -       for (i = 0; i < count; i++) {
38 -               depends = &pkg->depends[i];
39 -               if (depends->type != PREDEPEND
40 -                   && depends->type != DEPEND
41 -                   && depends->type != RECOMMEND)
42 -                       continue;
43 -               for (j = 0; j < depends->possibility_count; j++) {
44 -                       ab_depend = depends->possibilities[j]->pkg;
45 -                       if (!ab_depend->depended_upon_by) {
46 -                               ab_depend->depended_upon_by =
47 -                                       xcalloc(1, sizeof(abstract_pkg_t *));
48 -                       }
49 +     compound_depend_t * depends;
50 +     int count, othercount;
51 +     int i, j;
52 +     abstract_pkg_t * ab_depend;
53 +     abstract_pkg_t ** temp;
54  
55 -                       temp = ab_depend->depended_upon_by;
56 -                       othercount = 1;
57 -                       while (*temp) {
58 -                           temp++;
59 -                           othercount++;
60 -                       }
61 -                       *temp = ab_pkg;
62 +     count = pkg->pre_depends_count + pkg->depends_count;
63 +     depends = pkg->depends;
64  
65 -                       ab_depend->depended_upon_by =
66 -                               xrealloc(ab_depend->depended_upon_by,
67 -                               (othercount + 1) * sizeof(abstract_pkg_t *));
68 +     for (i = 0; i < count; i++) {
69 +         for (j = 0; j < depends->possibility_count; j++){
70 +              ab_depend = depends->possibilities[j]->pkg;
71 +              if(!ab_depend->depended_upon_by)
72 +                   ab_depend->depended_upon_by = xcalloc(1, sizeof(abstract_pkg_t *));
73 +
74 +              temp = ab_depend->depended_upon_by;
75 +              othercount = 1;
76 +              while(*temp){
77 +                   temp++;
78 +                   othercount++;
79 +              }
80 +              *temp = ab_pkg;
81  
82 -                       /* the array may have been moved by realloc */
83 -                       temp = ab_depend->depended_upon_by + othercount;
84 -                       *temp = NULL;
85 -               }
86 -       }
87 +              ab_depend->depended_upon_by = xrealloc(ab_depend->depended_upon_by,
88 +                                                                       (othercount + 1) * sizeof(abstract_pkg_t *));
89 +              /* the array may have moved */
90 +              temp = ab_depend->depended_upon_by + othercount;
91 +              *temp = NULL;
92 +         }
93 +         depends++;
94 +     }
95  }
96  
97  static depend_t * depend_init(void)
98 -- 
99 1.7.9.5
100