implement file dependencies for installs
authorDan Winship <danw@gnome.org>
Fri Feb 29 12:45:08 2008 -0500 (2008-02-29)
changeset 13849deac048d07
parent 137 4722cd3437cb
child 139 a416240614e3
implement file dependencies for installs

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
     1.1 --- a/razor.c	Fri Feb 29 11:53:15 2008 -0500
     1.2 +++ b/razor.c	Fri Feb 29 12:45:08 2008 -0500
     1.3 @@ -1785,8 +1785,9 @@
     1.4  }
     1.5  
     1.6  static int
     1.7 -find_provider(struct razor_set *set, struct razor_property *requirement,
     1.8 -	      const char *requirement_strings)
     1.9 +find_property_provider(struct razor_set *set,
    1.10 +		       struct razor_property *requirement,
    1.11 +		       const char *requirement_strings)
    1.12  {
    1.13  	struct razor_property *props = set->properties.data;
    1.14  	int p, hi, lo, cmp;
    1.15 @@ -1842,6 +1843,29 @@
    1.16  	return -1;
    1.17  }
    1.18  
    1.19 +static int
    1.20 +find_file_provider(struct razor_set *set, const char *filename)
    1.21 +{
    1.22 +	struct razor_entry *entry;
    1.23 +
    1.24 +	entry = find_entry(set, set->files.data, filename);
    1.25 +	if (entry)
    1.26 +		return list_first(&entry->packages, &set->package_pool)->data;
    1.27 +	else
    1.28 +		return -1;
    1.29 +}
    1.30 +
    1.31 +static int
    1.32 +find_provider(struct razor_set *set, struct razor_property *requirement,
    1.33 +	      const char *requirement_strings)
    1.34 +{
    1.35 +	const char *name = &requirement_strings[requirement->name];
    1.36 +	if (*name == '/')
    1.37 +		return find_file_provider(set, name);
    1.38 +	else
    1.39 +		return find_property_provider(set, requirement, requirement_strings);
    1.40 +}
    1.41 +
    1.42  static void
    1.43  gather_new_requires(struct razor_set *system, struct razor_set *upstream,
    1.44  		    struct razor_package *pkg, struct array *new_requires)
    1.45 @@ -1894,10 +1918,6 @@
    1.46  
    1.47  		new_end = new_requires.data + new_requires.size;
    1.48  		for (new = new_requires.data; new < new_end; new++) {
    1.49 -			/* FIXME */
    1.50 -			if (pool[props[*new].name] == '/')
    1.51 -				continue;
    1.52 -
    1.53  			provider = find_provider(trans->upstream,
    1.54  						 &props[*new], pool);
    1.55  			already = find_transaction_package(package_array,