summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-17 00:58:41 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-17 00:58:41 (EST)
commit0f2a3b2ae317952ea4edf5a0004c698b41b0020e (patch)
tree5a690d174aa260a95a589bacbeefe6a5dd2d1b27
parent6d6c9232a3225b0d5b2e53b087af8f0122db3853 (diff)
Fix depended_upon_by to only contain pre_depends and depends.
Partially fixes Issue 23. Allows removal of suggested/recommended packages. git-svn-id: http://opkg.googlecode.com/svn/trunk@328 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
-rw-r--r--libopkg/pkg_depends.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c
index d93ea0c..10a8ab5 100644
--- a/libopkg/pkg_depends.c
+++ b/libopkg/pkg_depends.c
@@ -642,6 +642,11 @@ void buildDepends(hash_table_t * hash, pkg_t * pkg)
depends++;
}
+ for(i = 0; i < pkg->depends_count; i++){
+ parseDepends(depends, hash, pkg->depends_str[i]);
+ depends++;
+ }
+
for(i = 0; i < pkg->recommends_count; i++){
parseDepends(depends, hash, pkg->recommends_str[i]);
depends->type = RECOMMEND;
@@ -653,11 +658,6 @@ void buildDepends(hash_table_t * hash, pkg_t * pkg)
depends->type = SUGGEST;
depends++;
}
-
- for(i = 0; i < pkg->depends_count; i++){
- parseDepends(depends, hash, pkg->depends_str[i]);
- depends++;
- }
}
/*
@@ -675,6 +675,11 @@ char *pkg_depend_str(pkg_t *pkg, int index)
}
index -= pkg->pre_depends_count;
+ if (index < pkg->depends_count) {
+ return pkg->depends_str[index];
+ }
+ index -= pkg->depends_count;
+
if (index < pkg->recommends_count) {
return pkg->recommends_str[index];
}
@@ -683,15 +688,15 @@ char *pkg_depend_str(pkg_t *pkg, int index)
if (index < pkg->suggests_count) {
return pkg->suggests_str[index];
}
- index -= pkg->suggests_count;
- if (index < pkg->depends_count) {
- return pkg->depends_str[index];
- }
fprintf(stderr, "pkg_depend_str: index %d out of range for pkg=%s\n", index, pkg->name);
return NULL;
}
+/*
+ * WARNING: This function assumes pre_depends and depends are at the
+ * start of the pkg->depends array.
+ */
void buildDependedUponBy(pkg_t * pkg, abstract_pkg_t * ab_pkg)
{
compound_depend_t * depends;