diff -r 7f45d0401e37 -r d8b7dd11813d razor.c --- a/razor.c Sat Apr 05 01:15:04 2008 -0400 +++ b/razor.c Sun Apr 06 19:24:07 2008 -0400 @@ -1716,6 +1716,51 @@ razor_package_iterator_destroy(pi2); } +struct razor_transaction; +struct razor_transaction_package; +struct razor_transaction_resolver; + +struct razor_transaction { + int package_count, errors; + struct razor_transaction_package *packages; + + struct razor_set *system, *upstream; +}; + +struct razor_transaction_package { + const char *name, *old_version, *new_version; + struct razor_package *old_package, *new_package; + enum razor_transaction_package_state state; + + /* dep_package is the name of the package that resulted in + * this entry being created (or NULL if the user requested the + * install/remove), with the other dep_ fields providing + * additional information. + * + * For INSTALL, if dep_type is REQUIRES, then dep_package + * required something that this package provides. If dep_type + * is CONFLICTS, then dep_package is a package that conflicted + * with an older version of this package, forcing an upgrade. + * + * For REMOVE, if dep_type is REQUIRES, then dep_package is a + * package that is being removed. If dep_type is OBSOLETES, + * then dep_package is a package that obsoletes this one. + * + * For OLD_CONFLICT or NEW_CONFLICT, dep_package is an + * existing package that conflicts with this one. The + * conflicting property comes from the already-installed + * package for OLD_CONFLICT, or the to-be-installed package + * for NEW_CONFLICT. + * + * For UNSATISFIABLE, the dep_ fields are as for an INSTALL, + * but the name field will be NULL. + */ + const char *dep_package; + enum razor_property_type dep_type; + const char *dep_property; + enum razor_version_relation dep_relation; + const char *dep_version; +}; struct razor_transaction_resolver { struct razor_set *system, *upstream; @@ -2637,7 +2682,7 @@ } } -void +int razor_transaction_describe(struct razor_transaction *trans) { struct razor_transaction_package *p, *pend, *tps; @@ -2769,6 +2814,31 @@ break; } } + + return trans->errors; +} + +int +razor_transaction_unsatisfied_property(struct razor_transaction *trans, + const char *name, + enum razor_version_relation rel, + const char *version) +{ + struct razor_transaction_package *p, *end; + + end = trans->packages + trans->package_count; + for (p = trans->packages; p < end; p++) { + if (p->state != RAZOR_PACKAGE_UNSATISFIABLE) + continue; + if (strcmp(name, p->dep_property) != 0 || + rel != p->dep_relation || + strcmp(version, p->dep_version) != 0) + continue; + + return 1; + } + + return 0; } struct razor_set *