main.c
changeset 140 017f92f7039a
parent 129 d221757574c1
child 151 ae6ceb604f54
     1.1 --- a/main.c	Thu Feb 21 12:09:13 2008 -0500
     1.2 +++ b/main.c	Mon Mar 03 14:55:16 2008 -0500
     1.3 @@ -14,10 +14,6 @@
     1.4  static const char *rawhide_repo_filename = "rawhide.repo";
     1.5  static const char *updated_repo_filename = "system-updated.repo";
     1.6  
     1.7 -static const char *relations[] = {
     1.8 -	"<", "<=", "=", ">=", ">"
     1.9 -};
    1.10 -
    1.11  static int
    1.12  command_list(int argc, const char *argv[])
    1.13  {
    1.14 @@ -67,8 +63,8 @@
    1.15  		if (version[0] == '\0')
    1.16  			printf("%s\n", name);
    1.17  		else
    1.18 -			printf("%s %s %s\n", name, relations[relation],
    1.19 -			       version);
    1.20 +			printf("%s %s %s\n", name,
    1.21 +			       razor_version_relations[relation], version);
    1.22  	}
    1.23  	razor_property_iterator_destroy(pi);
    1.24  
    1.25 @@ -325,12 +321,19 @@
    1.26  command_update(int argc, const char *argv[])
    1.27  {
    1.28  	struct razor_set *set, *upstream;
    1.29 +	struct razor_transaction *trans;
    1.30  
    1.31  	set = razor_set_open(repo_filename);
    1.32  	upstream = razor_set_open(rawhide_repo_filename);
    1.33  	if (set == NULL || upstream == NULL)
    1.34  		return 1;
    1.35 -	set = razor_set_update(set, upstream, argc, argv);
    1.36 +	trans = razor_transaction_create(set, upstream, argc, argv, 0, NULL);
    1.37 +	razor_transaction_describe(trans);
    1.38 +	if (trans->errors)
    1.39 +		return 1;
    1.40 +
    1.41 +	set = razor_transaction_run(trans);
    1.42 +	razor_transaction_destroy(trans);
    1.43  	razor_set_write(set, updated_repo_filename);
    1.44  	razor_set_destroy(set);
    1.45  	razor_set_destroy(upstream);
    1.46 @@ -343,11 +346,18 @@
    1.47  command_remove(int argc, const char *argv[])
    1.48  {
    1.49  	struct razor_set *set;
    1.50 +	struct razor_transaction *trans;
    1.51  
    1.52  	set = razor_set_open(repo_filename);
    1.53  	if (set == NULL)
    1.54  		return 1;
    1.55 -	set = razor_set_remove(set, argc, argv);
    1.56 +	trans = razor_transaction_create(set, NULL, 0, NULL, argc, argv);
    1.57 +	razor_transaction_describe(trans);
    1.58 +	if (trans->errors)
    1.59 +		return 1;
    1.60 +
    1.61 +	set = razor_transaction_run(trans);
    1.62 +	razor_transaction_destroy(trans);
    1.63  	razor_set_write(set, updated_repo_filename);
    1.64  	razor_set_destroy(set);
    1.65  	printf("wrote system-updated.repo\n");