1.1 --- a/rpm-razor.c Sun Jun 15 22:33:15 2008 -0400
1.2 +++ b/rpm-razor.c Sun Jun 15 23:15:59 2008 -0400
1.3 @@ -546,11 +546,9 @@
1.4 razor_transaction_remove_package(trans, package);
1.5 razor_package_iterator_destroy(pi);
1.6
1.7 - if (!option_nodeps) {
1.8 - if (razor_transaction_describe(trans) > 0) {
1.9 - printf("unsatisfied dependencies.\n");
1.10 - exit(1);
1.11 - }
1.12 + if (!option_nodeps && razor_transaction_describe(trans) > 0) {
1.13 + printf("unsatisfied dependencies.\n");
1.14 + exit(1);
1.15 }
1.16
1.17 if (option_test)
1.18 @@ -568,6 +566,15 @@
1.19 }
1.20
1.21 static void
1.22 +install_package(const char *name,
1.23 + const char *old_version, const char *new_version,
1.24 + const char *arch, void *data)
1.25 +{
1.26 + if (new_version)
1.27 + printf("install %s-%s.%s\n", name, new_version, arch);
1.28 +}
1.29 +
1.30 +static void
1.31 command_install(int argc, const char *argv[])
1.32 {
1.33 struct razor_set *set, *upstream, *next;
1.34 @@ -592,8 +599,19 @@
1.35 razor_transaction_install_package(trans, package);
1.36 razor_package_iterator_destroy(pi);
1.37
1.38 - razor_transaction_describe(trans);
1.39 + if (!option_nodeps && razor_transaction_describe(trans) > 0) {
1.40 + printf("unsatisfied dependencies.\n");
1.41 + exit(1);
1.42 + }
1.43 +
1.44 + if (option_test)
1.45 + exit(0);
1.46 +
1.47 next = razor_transaction_finish(trans);
1.48 +
1.49 + if (!option_justdb)
1.50 + razor_set_diff(set, next, install_package, NULL);
1.51 +
1.52 razor_set_destroy(set);
1.53 razor_set_destroy(upstream);
1.54
1.55 @@ -601,6 +619,17 @@
1.56 }
1.57
1.58 static void
1.59 +update_package(const char *name,
1.60 + const char *old_version, const char *new_version,
1.61 + const char *arch, void *data)
1.62 +{
1.63 + if (old_version)
1.64 + printf("remove %s-%s.%s\n", name, old_version, arch);
1.65 + if (new_version)
1.66 + printf("install %s-%s.%s\n", name, new_version, arch);
1.67 +}
1.68 +
1.69 +static void
1.70 command_update(int argc, const char *argv[])
1.71 {
1.72 struct razor_set *set, *upstream, *next;
1.73 @@ -625,8 +654,19 @@
1.74 razor_transaction_update_package(trans, package);
1.75 razor_package_iterator_destroy(pi);
1.76
1.77 - razor_transaction_describe(trans);
1.78 + if (!option_nodeps && razor_transaction_describe(trans) > 0) {
1.79 + printf("unsatisfied dependencies.\n");
1.80 + exit(1);
1.81 + }
1.82 +
1.83 + if (option_test)
1.84 + exit(0);
1.85 +
1.86 next = razor_transaction_finish(trans);
1.87 +
1.88 + if (!option_justdb)
1.89 + razor_set_diff(set, next, update_package, NULL);
1.90 +
1.91 razor_set_destroy(set);
1.92 razor_set_destroy(upstream);
1.93