src/rpm.c
changeset 258 29d5002bd17f
parent 241 c3eb520e2219
child 249 061a5b815727
     1.1 --- a/src/rpm.c	Mon Jun 16 15:40:30 2008 -0400
     1.2 +++ b/src/rpm.c	Fri Jun 20 19:04:47 2008 -0400
     1.3 @@ -20,6 +20,7 @@
     1.4  #include <stdlib.h>
     1.5  #include <string.h>
     1.6  #include <stdio.h>
     1.7 +#include <stdint.h>
     1.8  #include <dirent.h>
     1.9  #include "razor.h"
    1.10  
    1.11 @@ -257,24 +258,24 @@
    1.12  		      struct razor_package_query *query,
    1.13  		      const char *ref_name,
    1.14  		      const char *ref_version,
    1.15 -		      enum razor_property_type ref_type)
    1.16 +		      uint32_t ref_type)
    1.17  {
    1.18  	struct razor_property *property;
    1.19  	struct razor_property_iterator *pi;
    1.20  	struct razor_package_iterator *pkgi;
    1.21  	const char *name, *version;
    1.22 -	enum razor_property_type type;
    1.23 -	enum razor_version_relation relation;
    1.24 +	uint32_t flags;
    1.25  
    1.26  	pi = razor_property_iterator_create(set, NULL);
    1.27  	while (razor_property_iterator_next(pi, &property, &name,
    1.28 -					    &relation, &version, &type)) {
    1.29 +					    &flags, &version)) {
    1.30  		if (strcmp(ref_name, name) != 0)
    1.31  			continue;
    1.32 -		if (ref_version && relation == RAZOR_VERSION_EQUAL &&
    1.33 +		if (ref_version &&
    1.34 +		    (flags & RAZOR_PROPERTY_RELATION_MASK) == RAZOR_PROPERTY_EQUAL &&
    1.35  		    strcmp(ref_version, version) != 0)
    1.36  			continue;
    1.37 -		if (ref_type != type)
    1.38 +		if ((flags & RAZOR_PROPERTY_TYPE_MASK) != ref_type)
    1.39  			continue;
    1.40  
    1.41  		pkgi = razor_package_iterator_create_for_property(set,
    1.42 @@ -369,30 +370,27 @@
    1.43  	return razor_package_query_finish(query);
    1.44  }
    1.45  
    1.46 -static const char *relation_string[] = { "<", "<=", "=", ">=", ">" };
    1.47 -
    1.48  static void
    1.49  print_package_properties(struct razor_set *set,
    1.50  			 struct razor_package *package,
    1.51 -			 enum razor_property_type ref_type)
    1.52 +			 uint32_t ref_type)
    1.53  {
    1.54  	struct razor_property *property;
    1.55  	struct razor_property_iterator *pi;
    1.56  	const char *name, *version;
    1.57 -	enum razor_property_type type;
    1.58 -	enum razor_version_relation relation;
    1.59 +	uint32_t flags;
    1.60  
    1.61  	pi = razor_property_iterator_create(set, package);
    1.62  	while (razor_property_iterator_next(pi, &property,
    1.63 -					    &name, &relation, &version,
    1.64 -					    &type)) {
    1.65 -		if (type != ref_type)
    1.66 +					    &name, &flags, &version)) {
    1.67 +		if ((flags & RAZOR_PROPERTY_TYPE_MASK) != ref_type)
    1.68  			continue;
    1.69  		if (version[0] == '\0')
    1.70  			printf("%s\n", name);
    1.71  		else
    1.72  			printf("%s %s %s\n", name,
    1.73 -			       relation_string[relation], version);
    1.74 +			       razor_property_relation_to_string(property),
    1.75 +			       version);
    1.76  	}
    1.77  	razor_property_iterator_destroy(pi);
    1.78  }