diff options
author | Kristian Høgsberg <krh@redhat.com> | 2008-06-20 21:38:29 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2008-06-20 21:38:29 -0400 |
commit | 4d070f05b5e5616c238302e0e49877e7bff2c2fe (patch) | |
tree | e8c53033f7d550aecc5ae87dcf3be97ad5c1c276 /src | |
parent | fbdf16df80f78f67aea0e3ce682507c90e49c81c (diff) |
Fix the razor_set_diff() callback prototype.
The old proto type didn't let us pass the razor_package.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 43 | ||||
-rw-r--r-- | src/rpm.c | 39 |
2 files changed, 36 insertions, 46 deletions
@@ -489,14 +489,17 @@ command_remove(int argc, const char *argv[]) } static void -print_diff(const char *name, - const char *old_version, const char *new_version, const char *arch, +print_diff(enum razor_diff_action action, + struct razor_package *package, + const char *name, + const char *version, + const char *arch, void *data) { - if (old_version) - printf("removing %s %s\n", name, old_version); - else - printf("install %s %s\n", name, new_version); + if (action == RAZOR_DIFF_ACTION_ADD) + printf("install %s-%s.%s\n", name, version, arch); + if (action == RAZOR_DIFF_ACTION_REMOVE) + printf("remove %s-%s.%s\n", name, version, arch); } static int @@ -576,9 +579,10 @@ command_import_rpms(int argc, const char *argv[]) } static void -download_package(const char *name, - const char *old_version, - const char *new_version, +download_package(enum razor_diff_action action, + struct razor_package *package, + const char *name, + const char *version, const char *arch, void *data) { @@ -586,15 +590,15 @@ download_package(const char *name, const char *v; int *errors = data; - if (old_version) + if (action != RAZOR_DIFF_ACTION_ADD) return; /* Skip epoch */ - v = strchr(new_version, ':'); + v = strchr(version, ':'); if (v != NULL) v = v + 1; else - v = new_version; + v = version; snprintf(url, sizeof url, "%s/Packages/%s-%s.%s.rpm", yum_url, name, v, arch); @@ -605,9 +609,10 @@ download_package(const char *name, } static void -install_package(const char *name, - const char *old_version, - const char *new_version, +install_package(enum razor_diff_action action, + struct razor_package *package, + const char *name, + const char *version, const char *arch, void *data) { @@ -615,17 +620,17 @@ install_package(const char *name, char file[PATH_MAX]; struct razor_rpm *rpm; - if (old_version) { - printf("removing %s %s not handled\n", name, old_version); + if (action == RAZOR_DIFF_ACTION_REMOVE) { + printf("removing %s %s not handled\n", name, version); return; } /* Skip epoch */ - v = strchr(new_version, ':'); + v = strchr(version, ':'); if (v != NULL) v = v + 1; else - v = new_version; + v = version; printf("install %s %s\n", name, v); snprintf(file, sizeof file, "rpms/%s-%s.%s.rpm", name, v, arch); @@ -507,12 +507,17 @@ command_verify(int argc, const char *argv[]) } static void -remove_package(const char *name, - const char *old_version, const char *new_version, - const char *arch, void *data) +update_package(enum razor_diff_action action, + struct razor_package *package, + const char *name, + const char *version, + const char *arch, + void *data) { - if (old_version) - printf("remove %s-%s.%s\n", name, old_version, arch); + if (action == RAZOR_DIFF_ACTION_ADD) + printf("install %s-%s.%s\n", name, version, arch); + if (action == RAZOR_DIFF_ACTION_REMOVE) + printf("remove %s-%s.%s\n", name, version, arch); } static void @@ -555,7 +560,7 @@ command_erase(int argc, const char *argv[]) next = razor_transaction_finish(trans); if (!option_justdb) - razor_set_diff(set, next, remove_package, NULL); + razor_set_diff(set, next, update_package, NULL); razor_set_destroy(set); razor_set_destroy(upstream); @@ -564,15 +569,6 @@ command_erase(int argc, const char *argv[]) } static void -install_package(const char *name, - const char *old_version, const char *new_version, - const char *arch, void *data) -{ - if (new_version) - printf("install %s-%s.%s\n", name, new_version, arch); -} - -static void command_install(int argc, const char *argv[]) { struct razor_set *set, *upstream, *next; @@ -608,7 +604,7 @@ command_install(int argc, const char *argv[]) next = razor_transaction_finish(trans); if (!option_justdb) - razor_set_diff(set, next, install_package, NULL); + razor_set_diff(set, next, update_package, NULL); razor_set_destroy(set); razor_set_destroy(upstream); @@ -617,17 +613,6 @@ command_install(int argc, const char *argv[]) } static void -update_package(const char *name, - const char *old_version, const char *new_version, - const char *arch, void *data) -{ - if (old_version) - printf("remove %s-%s.%s\n", name, old_version, arch); - if (new_version) - printf("install %s-%s.%s\n", name, new_version, arch); -} - -static void command_update(int argc, const char *argv[]) { struct razor_set *set, *upstream, *next; |