# HG changeset patch # User Kristian H?gsberg # Date 1194124529 14400 # Node ID cfe57117efeede2f9fbd25031a3bdcce9dc99463 # Parent bb4ca4a47f66305d85f8987c14c97ead990052d3 Import obsoletes and conflicts; add commands to list them. diff -r bb4ca4a47f66 -r cfe57117efee import.c --- a/import.c Wed Oct 31 22:41:27 2007 -0400 +++ b/import.c Sat Nov 03 17:15:29 2007 -0400 @@ -159,6 +159,8 @@ YUM_STATE_PACKAGE_NAME, YUM_STATE_REQUIRES, YUM_STATE_PROVIDES, + YUM_STATE_OBSOLETES, + YUM_STATE_CONFLICTS, YUM_STATE_FILE }; @@ -201,6 +203,10 @@ ctx->state = YUM_STATE_REQUIRES; } else if (strcmp(name, "rpm:provides") == 0) { ctx->state = YUM_STATE_PROVIDES; + } else if (strcmp(name, "rpm:obsoletes") == 0) { + ctx->state = YUM_STATE_OBSOLETES; + } else if (strcmp(name, "rpm:conflicts") == 0) { + ctx->state = YUM_STATE_CONFLICTS; } else if (strcmp(name, "rpm:entry") == 0 && ctx->state != YUM_STATE_BEGIN) { n = NULL; @@ -238,6 +244,14 @@ razor_importer_add_property(ctx->importer, n, buffer, RAZOR_PROPERTY_PROVIDES); break; + case YUM_STATE_OBSOLETES: + razor_importer_add_property(ctx->importer, n, buffer, + RAZOR_PROPERTY_OBSOLETES); + break; + case YUM_STATE_CONFLICTS: + razor_importer_add_property(ctx->importer, n, buffer, + RAZOR_PROPERTY_CONFLICTS); + break; } } else if (strcmp(name, "file") == 0) { ctx->state = YUM_STATE_FILE; @@ -365,12 +379,38 @@ &property_names.p, &count); headerGetEntry(h, RPMTAG_PROVIDEVERSION, &type, &property_versions.p, &count); + headerGetEntry(h, RPMTAG_PROVIDEFLAGS, &type, + &property_flags.p, &count); for (i = 0; i < count; i++) razor_importer_add_property(importer, property_names.list[i], property_versions.list[i], RAZOR_PROPERTY_PROVIDES); + headerGetEntry(h, RPMTAG_OBSOLETENAME, &type, + &property_names.p, &count); + headerGetEntry(h, RPMTAG_OBSOLETEVERSION, &type, + &property_versions.p, &count); + headerGetEntry(h, RPMTAG_OBSOLETEFLAGS, &type, + &property_flags.p, &count); + for (i = 0; i < count; i++) + razor_importer_add_property(importer, + property_names.list[i], + property_versions.list[i], + RAZOR_PROPERTY_OBSOLETES); + + headerGetEntry(h, RPMTAG_CONFLICTNAME, &type, + &property_names.p, &count); + headerGetEntry(h, RPMTAG_CONFLICTVERSION, &type, + &property_versions.p, &count); + headerGetEntry(h, RPMTAG_CONFLICTFLAGS, &type, + &property_flags.p, &count); + for (i = 0; i < count; i++) + razor_importer_add_property(importer, + property_names.list[i], + property_versions.list[i], + RAZOR_PROPERTY_CONFLICTS); + headerGetEntry(h, RPMTAG_BASENAMES, &type, &basenames.p, &count); headerGetEntry(h, RPMTAG_DIRNAMES, &type, diff -r bb4ca4a47f66 -r cfe57117efee main.c --- a/main.c Wed Oct 31 22:41:27 2007 -0400 +++ b/main.c Sat Nov 03 17:15:29 2007 -0400 @@ -47,6 +47,30 @@ } static int +command_list_obsoletes(int argc, const char *argv[]) +{ + struct razor_set *set; + + set = razor_set_open(repo_filename); + razor_set_list_properties(set, argv[0], RAZOR_PROPERTY_OBSOLETES); + razor_set_destroy(set); + + return 0; +} + +static int +command_list_conflicts(int argc, const char *argv[]) +{ + struct razor_set *set; + + set = razor_set_open(repo_filename); + razor_set_list_properties(set, argv[0], RAZOR_PROPERTY_CONFLICTS); + razor_set_destroy(set); + + return 0; +} + +static int command_list_files(int argc, const char *argv[]) { struct razor_set *set; @@ -210,8 +234,10 @@ int (*func)(int argc, const char *argv[]); } razor_commands[] = { { "list", "list all packages", command_list }, - { "list-requires", "list all requires or requires for the given package", command_list_requires }, - { "list-provides", "list all provides or provides for the give package", command_list_provides }, + { "list-requires", "list all requires for the given package", command_list_requires }, + { "list-provides", "list all provides for the give package", command_list_provides }, + { "list-obsoletes", "list all obsoletes for the give package", command_list_obsoletes }, + { "list-conflicts", "list all conflicts for the give package", command_list_conflicts }, { "list-files", "list files for package set", command_list_files }, { "list-file-packages", "list packages owning file", command_list_file_packages }, { "list-package-files", "list files in package", command_list_package_files },