implement file dependencies for installs
authorDan Winship <danw@gnome.org>
Fri, 29 Feb 2008 17:45:08 +0000 (12:45 -0500)
committerDan Winship <danw@gnome.org>
Fri, 29 Feb 2008 17:45:08 +0000 (12:45 -0500)
removes are trickier because there are no backlinks from the files array
the properties array, so there's currently no way to efficiently determine
what packages are affected by the removal of a particular file

razor.c

diff --git a/razor.c b/razor.c
index 97c88b2..d7cace6 100644 (file)
--- a/razor.c
+++ b/razor.c
@@ -1785,8 +1785,9 @@ provider_satisfies_requirement(struct razor_property *provider,
 }
 
 static int
-find_provider(struct razor_set *set, struct razor_property *requirement,
-             const char *requirement_strings)
+find_property_provider(struct razor_set *set,
+                      struct razor_property *requirement,
+                      const char *requirement_strings)
 {
        struct razor_property *props = set->properties.data;
        int p, hi, lo, cmp;
@@ -1842,6 +1843,29 @@ find_provider(struct razor_set *set, struct razor_property *requirement,
        return -1;
 }
 
+static int
+find_file_provider(struct razor_set *set, const char *filename)
+{
+       struct razor_entry *entry;
+
+       entry = find_entry(set, set->files.data, filename);
+       if (entry)
+               return list_first(&entry->packages, &set->package_pool)->data;
+       else
+               return -1;
+}
+
+static int
+find_provider(struct razor_set *set, struct razor_property *requirement,
+             const char *requirement_strings)
+{
+       const char *name = &requirement_strings[requirement->name];
+       if (*name == '/')
+               return find_file_provider(set, name);
+       else
+               return find_property_provider(set, requirement, requirement_strings);
+}
+
 static void
 gather_new_requires(struct razor_set *system, struct razor_set *upstream,
                    struct razor_package *pkg, struct array *new_requires)
@@ -1894,10 +1918,6 @@ razor_transaction_satisfy_installs(struct razor_transaction *trans,
 
                new_end = new_requires.data + new_requires.size;
                for (new = new_requires.data; new < new_end; new++) {
-                       /* FIXME */
-                       if (pool[props[*new].name] == '/')
-                               continue;
-
                        provider = find_provider(trans->upstream,
                                                 &props[*new], pool);
                        already = find_transaction_package(package_array,