razor.c
changeset 240 edd5fe0a00ba
parent 238 d19dc7950c76
     1.1 --- a/razor.c	Mon Jun 09 23:51:52 2008 -0400
     1.2 +++ b/razor.c	Sun Jun 15 23:15:59 2008 -0400
     1.3 @@ -2391,39 +2391,54 @@
     1.4  	const char *name, *version, *arch, *pool;
     1.5  
     1.6  	pool = set->string_pool.data;
     1.7 -	fprintf(stderr, "could not satisfy %s %s %s, required by",
     1.8 -		&pool[rp->name],
     1.9 -		relation_string[rp->relation],
    1.10 -		&pool[rp->version]);
    1.11 -
    1.12 -	razor_package_iterator_init_for_property(&pi, set, rp);
    1.13 -	while (razor_package_iterator_next(&pi, &pkg, &name, &version, &arch))
    1.14 -		fprintf(stderr, " %s-%s", name, version);
    1.15 -
    1.16 -	fprintf(stderr, "\n");
    1.17 +	if (pool[rp->version] == '\0') {
    1.18 +		razor_package_iterator_init_for_property(&pi, set, rp);
    1.19 +		while (razor_package_iterator_next(&pi, &pkg,
    1.20 +						   &name, &version, &arch))
    1.21 +			fprintf(stderr, "%s is needed by %s-%s.%s\n",
    1.22 +				&pool[rp->name],
    1.23 +				name, version, arch);
    1.24 +	} else {
    1.25 +		razor_package_iterator_init_for_property(&pi, set, rp);
    1.26 +		while (razor_package_iterator_next(&pi, &pkg,
    1.27 +						   &name, &version, &arch))
    1.28 +			fprintf(stderr, "%s %s %s is needed by %s-%s.%s\n",
    1.29 +				&pool[rp->name],
    1.30 +				relation_string[rp->relation],
    1.31 +				&pool[rp->version],
    1.32 +				name, version, arch);
    1.33 +	}
    1.34  }
    1.35  
    1.36 -void
    1.37 +int
    1.38  razor_transaction_describe(struct razor_transaction *trans)
    1.39  {
    1.40  	struct prop_iter rpi;
    1.41  	struct razor_property *rp;
    1.42 +	int unsatisfied;
    1.43  
    1.44  	flush_scheduled_system_updates(trans);
    1.45  	flush_scheduled_upstream_updates(trans);
    1.46  	mark_all_satisfied_requires(trans);
    1.47  
    1.48 +	unsatisfied = 0;
    1.49  	prop_iter_init(&rpi, &trans->system);
    1.50  	while (prop_iter_next(&rpi, RAZOR_PROPERTY_REQUIRES, &rp)) {
    1.51 -		if (!(rpi.present[rp - rpi.start] & TRANS_PROPERTY_SATISFIED))
    1.52 +		if (!(rpi.present[rp - rpi.start] & TRANS_PROPERTY_SATISFIED)) {
    1.53  			describe_unsatisfied(trans->system.set, rp);
    1.54 +		        unsatisfied++;
    1.55 +		}
    1.56  	}
    1.57  
    1.58  	prop_iter_init(&rpi, &trans->upstream);
    1.59  	while (prop_iter_next(&rpi, RAZOR_PROPERTY_REQUIRES, &rp)) {
    1.60 -		if (!(rpi.present[rp - rpi.start] & TRANS_PROPERTY_SATISFIED))
    1.61 +		if (!(rpi.present[rp - rpi.start] & TRANS_PROPERTY_SATISFIED)) {
    1.62  			describe_unsatisfied(trans->upstream.set, rp);
    1.63 +			unsatisfied++;
    1.64 +		}
    1.65  	}
    1.66 +
    1.67 +	return unsatisfied;
    1.68  }
    1.69  
    1.70  int
    1.71 @@ -2518,8 +2533,6 @@
    1.72  	transaction_set_release(&trans->system);
    1.73  	transaction_set_release(&trans->upstream);
    1.74  	free(trans);
    1.75 -
    1.76 -	/* FIXME: free upstream if it was created as an empty set */
    1.77  }
    1.78  
    1.79  struct razor_package_query {