fix generated provides of files provided by more than one package
authorDan Winship <danw@gnome.org>
Tue Mar 11 16:48:20 2008 -0400 (2008-03-11)
changeset 163978c98ddb8aa
parent 162 9170be6cebf0
child 164 ed154b422dc0
fix generated provides of files provided by more than one package

(uniqueify_properties() assumes that each property only belongs to a
single package, so our previous strategy of generating a single property
with an indirect package list wouldn't work.)
razor.c
     1.1 --- a/razor.c	Tue Mar 11 15:45:53 2008 -0400
     1.2 +++ b/razor.c	Tue Mar 11 16:48:20 2008 -0400
     1.3 @@ -753,9 +753,10 @@
     1.4  	struct razor_property *prop;
     1.5  	struct razor_entry *top, *entry;
     1.6  	struct razor_package *packages;
     1.7 -	struct array pkgarray, pkgprops;
     1.8 -	uint32_t *req, *req_start, *req_end, *pkg, *pkg_end;
     1.9 -	uint32_t *map, newprop_id, *newprop;
    1.10 +	struct array pkgprops;
    1.11 +	struct list *pkg;
    1.12 +	uint32_t *req, *req_start, *req_end;
    1.13 +	uint32_t *map, *newprop;
    1.14  	char *pool;
    1.15  
    1.16  	pool = importer->set->string_pool.data;
    1.17 @@ -772,31 +773,24 @@
    1.18  		if (req > req_start && req[0] == req[-1])
    1.19  			continue;
    1.20  		entry = find_entry(importer->set, top, &pool[*req]);
    1.21 -		if (entry) {
    1.22 +		if (!entry)
    1.23 +			continue;
    1.24 +
    1.25 +		for (pkg = list_first(&entry->packages, &importer->set->package_pool); pkg; pkg = list_next(pkg)) {
    1.26  			prop = array_add(&importer->set->properties, sizeof *prop);
    1.27  			prop->name = *req;
    1.28  			prop->type = RAZOR_PROPERTY_PROVIDES;
    1.29  			prop->relation = RAZOR_VERSION_EQUAL;
    1.30  			prop->version = hashtable_tokenize(&importer->table, "");
    1.31 -
    1.32 -			/* Copy package list from entry to property */
    1.33 -			array_init(&pkgarray);
    1.34 -			list_to_array(list_first(&entry->packages, &importer->set->package_pool), &pkgarray);
    1.35 -			list_set_array(&prop->packages, &importer->set->package_pool, &pkgarray, 0);
    1.36 -
    1.37 -			/* Update property list of each providing package */
    1.38 -			pkg_end = pkgarray.data + pkgarray.size;
    1.39 -			newprop_id = prop - (struct razor_property *)importer->set->properties.data;
    1.40 -
    1.41 -			for (pkg = pkgarray.data; pkg < pkg_end; pkg++) {
    1.42 -				array_init(&pkgprops);
    1.43 -				list_to_array(list_first(&packages[*pkg].properties, &importer->set->property_pool), &pkgprops);
    1.44 -				newprop = array_add(&pkgprops, sizeof *newprop);
    1.45 -				*newprop = newprop_id;
    1.46 -				list_set_array(&packages[*pkg].properties, &importer->set->property_pool, &pkgprops, 1);
    1.47 -				array_release(&pkgprops);
    1.48 -			}
    1.49 -			array_release(&pkgarray);
    1.50 +			list_set_ptr(&prop->packages, pkg->data);
    1.51 +
    1.52 +			/* Update property list of pkg */
    1.53 +			array_init(&pkgprops);
    1.54 +			list_to_array(list_first(&packages[pkg->data].properties, &importer->set->property_pool), &pkgprops);
    1.55 +			newprop = array_add(&pkgprops, sizeof *newprop);
    1.56 +			*newprop = prop - (struct razor_property *)importer->set->properties.data;
    1.57 +			list_set_array(&packages[pkg->data].properties, &importer->set->property_pool, &pkgprops, 1);
    1.58 +			array_release(&pkgprops);
    1.59  		}
    1.60  	}
    1.61