diff options
-rw-r--r-- | data/bash-completion.sh | 4 | ||||
-rw-r--r-- | librazor/importer.c | 17 | ||||
-rw-r--r-- | librazor/razor-internal.h | 37 | ||||
-rw-r--r-- | librazor/razor.c | 153 | ||||
-rw-r--r-- | librazor/razor.h | 25 | ||||
-rw-r--r-- | librazor/root.c | 4 | ||||
-rw-r--r-- | librazor/rpm.c | 3 | ||||
-rw-r--r-- | src/import-rpmdb.c | 9 | ||||
-rw-r--r-- | src/import-yum.c | 31 | ||||
-rw-r--r-- | src/main.c | 56 | ||||
-rw-r--r-- | src/test-driver.c | 7 |
11 files changed, 307 insertions, 39 deletions
diff --git a/data/bash-completion.sh b/data/bash-completion.sh index a4e9f4e..a9c4221 100644 --- a/data/bash-completion.sh +++ b/data/bash-completion.sh @@ -1,6 +1,6 @@ __razor_commands () { local IFS=$'\n' - COMPREPLY=($(IFS=: compgen -S' ' -W "list-requires:list-provides:list-files:list-file-packages:list-package-files:what-requires:what-provides:import-yum:import-rpmdb:validate:update:diff:install:init:download" -- $1)) + COMPREPLY=($(IFS=: compgen -S' ' -W "info:list-requires:list-provides:list-files:list-file-packages:list-package-files:what-requires:what-provides:import-yum:import-rpmdb:validate:update:diff:install:init:download" -- $1)) } __razor_packages () { @@ -34,7 +34,7 @@ __razor() { __razor_commands $cur else case "${COMP_WORDS[1]}" in - list-requires|list-provides|list-package-files) + info|list-requires|list-provides|list-package-files) __razor_packages $cur ;; list-files|list-file-packages) __razor_files $cur ;; what-requires) __razor_requires $cur ;; diff --git a/librazor/importer.c b/librazor/importer.c index eb75605..e2da1b7 100644 --- a/librazor/importer.c +++ b/librazor/importer.c @@ -54,6 +54,19 @@ razor_importer_finish_package(struct razor_importer *importer) } void +razor_importer_add_details(struct razor_importer *importer, + const char *summary, + const char *description, + const char *url, + const char *license) +{ + importer->package->summary = hashtable_tokenize(&importer->details_table, summary); + importer->package->description = hashtable_tokenize(&importer->details_table, description); + importer->package->url = hashtable_tokenize(&importer->details_table, url); + importer->package->license = hashtable_tokenize(&importer->details_table, license); +} + +void razor_importer_add_property(struct razor_importer *importer, const char *name, uint32_t flags, @@ -99,6 +112,10 @@ razor_importer_create(void) importer = zalloc(sizeof *importer); importer->set = razor_set_create(); hashtable_init(&importer->table, &importer->set->string_pool); + hashtable_init(&importer->details_table, + &importer->set->details_string_pool); + hashtable_init(&importer->file_table, + &importer->set->file_string_pool); return importer; } diff --git a/librazor/razor-internal.h b/librazor/razor-internal.h index bcc5e11..94eac41 100644 --- a/librazor/razor-internal.h +++ b/librazor/razor-internal.h @@ -61,26 +61,37 @@ struct razor_set_header { struct razor_set_section sections[0]; }; -#define RAZOR_MAGIC 0x7a7a7a7a +#define RAZOR_MAGIC 0x7a7a7a7a +#define RAZOR_DETAILS_MAGIC 0x7a7a7a7b +#define RAZOR_FILES_MAGIC 0x7a7a7a7c #define RAZOR_VERSION 1 -#define RAZOR_STRING_POOL 0 -#define RAZOR_PACKAGES 1 -#define RAZOR_PROPERTIES 2 -#define RAZOR_FILES 3 -#define RAZOR_PACKAGE_POOL 4 -#define RAZOR_PROPERTY_POOL 5 -#define RAZOR_FILE_POOL 6 +#define RAZOR_STRING_POOL 0 +#define RAZOR_PACKAGES 1 +#define RAZOR_PROPERTIES 2 +#define RAZOR_PACKAGE_POOL 3 +#define RAZOR_PROPERTY_POOL 4 + +#define RAZOR_DETAILS_STRING_POOL 0 + +#define RAZOR_FILES 0 +#define RAZOR_FILE_POOL 1 +#define RAZOR_FILE_STRING_POOL 2 struct razor_package { - uint32_t name : 24; - uint32_t flags : 8; + uint name : 24; + uint flags : 8; uint32_t version; uint32_t arch; + uint32_t summary; + uint32_t description; + uint32_t url; + uint32_t license; struct list_head properties; struct list_head files; }; + struct razor_property { uint32_t name; uint32_t flags; @@ -105,7 +116,11 @@ struct razor_set { struct array package_pool; struct array property_pool; struct array file_pool; + struct array file_string_pool; + struct array details_string_pool; struct razor_set_header *header; + struct razor_set_header *details_header; + struct razor_set_header *files_header; }; struct import_entry { @@ -123,6 +138,8 @@ struct import_directory { struct razor_importer { struct razor_set *set; struct hashtable table; + struct hashtable file_table; + struct hashtable details_table; struct razor_package *package; struct array properties; struct array files; diff --git a/librazor/razor.c b/librazor/razor.c index bb05700..53187a6 100644 --- a/librazor/razor.c +++ b/librazor/razor.c @@ -51,12 +51,19 @@ struct razor_set_section razor_sections[] = { { RAZOR_STRING_POOL, offsetof(struct razor_set, string_pool) }, { RAZOR_PACKAGES, offsetof(struct razor_set, packages) }, { RAZOR_PROPERTIES, offsetof(struct razor_set, properties) }, - { RAZOR_FILES, offsetof(struct razor_set, files) }, { RAZOR_PACKAGE_POOL, offsetof(struct razor_set, package_pool) }, { RAZOR_PROPERTY_POOL, offsetof(struct razor_set, property_pool) }, - { RAZOR_FILE_POOL, offsetof(struct razor_set, file_pool) }, }; +struct razor_set_section razor_files_sections[] = { + { RAZOR_FILES, offsetof(struct razor_set, files) }, + { RAZOR_FILE_POOL, offsetof(struct razor_set, file_pool) }, + { RAZOR_FILE_STRING_POOL, offsetof(struct razor_set, file_string_pool) }, +}; + +struct razor_set_section razor_details_sections[] = { + { RAZOR_DETAILS_STRING_POOL, offsetof(struct razor_set, details_string_pool) }, +}; struct razor_set * razor_set_create(void) { @@ -112,6 +119,62 @@ razor_set_open(const char *filename) } void +razor_set_open_details(struct razor_set *set, const char *filename) +{ + struct razor_set_section *s; + struct stat stat; + struct array *array; + int fd; + + fd = open(filename, O_RDONLY); + if (fstat(fd, &stat) < 0) + return; + set->details_header = mmap(NULL, stat.st_size, PROT_READ, MAP_PRIVATE, fd, 0); + if (set->details_header == MAP_FAILED) + return; + + for (s = set->details_header->sections; ~s->type; s++) { + if (s->type >= ARRAY_SIZE(razor_details_sections)) + continue; + if (s->type != razor_details_sections[s->type].type) + continue; + array = (void *) set + razor_details_sections[s->type].offset; + array->data = (void *) set->details_header + s->offset; + array->size = s->size; + array->alloc = s->size; + } + close(fd); +} + +void +razor_set_open_files(struct razor_set *set, const char *filename) +{ + struct razor_set_section *s; + struct stat stat; + struct array *array; + int fd; + + fd = open(filename, O_RDONLY); + if (fstat(fd, &stat) < 0) + return; + set->files_header = mmap(NULL, stat.st_size, PROT_READ, MAP_PRIVATE, fd, 0); + if (set->files_header == MAP_FAILED) + return; + + for (s = set->files_header->sections; ~s->type; s++) { + if (s->type >= ARRAY_SIZE(razor_files_sections)) + continue; + if (s->type != razor_files_sections[s->type].type) + continue; + array = (void *) set + razor_files_sections[s->type].offset; + array->data = (void *) set->files_header + s->offset; + array->size = s->size; + array->alloc = s->size; + } + close(fd); +} + +void razor_set_destroy(struct razor_set *set) { unsigned int size; @@ -130,11 +193,37 @@ razor_set_destroy(struct razor_set *set) } } + if (set->details_header) { + for (i = 0; set->details_header->sections[i].type; i++) + ; + size = set->details_header->sections[i].type; + munmap(set->details_header, size); + } else { + for (i = 0; i < ARRAY_SIZE(razor_details_sections); i++) { + a = (void *) set + razor_details_sections[i].offset; + free(a->data); + } + } + + if (set->files_header) { + for (i = 0; set->files_header->sections[i].type; i++) + ; + size = set->files_header->sections[i].type; + munmap(set->files_header, size); + } else { + for (i = 0; i < ARRAY_SIZE(razor_files_sections); i++) { + a = (void *) set + razor_files_sections[i].offset; + free(a->data); + } + } + free(set); } -int -razor_set_write_to_fd(struct razor_set *set, int fd) +static int +razor_set_write_sections_to_fd(struct razor_set *set, int fd, int magic, + struct razor_set_section *sections, + size_t array_size) { char data[4096]; struct razor_set_header *header = (struct razor_set_header *) data; @@ -143,14 +232,14 @@ razor_set_write_to_fd(struct razor_set *set, int fd) int i; memset(data, 0, sizeof data); - header->magic = RAZOR_MAGIC; + header->magic = magic; header->version = RAZOR_VERSION; offset = sizeof data; - for (i = 0; i < ARRAY_SIZE(razor_sections); i++) { - if (razor_sections[i].type != i) + for (i = 0; i < array_size; i++) { + if (sections[i].type != i) continue; - a = (void *) set + razor_sections[i].offset; + a = (void *) set + sections[i].offset; header->sections[i].type = i; header->sections[i].offset = offset; header->sections[i].size = a->size; @@ -163,10 +252,10 @@ razor_set_write_to_fd(struct razor_set *set, int fd) razor_write(fd, data, sizeof data); memset(data, 0, sizeof data); - for (i = 0; i < ARRAY_SIZE(razor_sections); i++) { - if (razor_sections[i].type != i) + for (i = 0; i < array_size; i++) { + if (sections[i].type != i) continue; - a = (void *) set + razor_sections[i].offset; + a = (void *) set + sections[i].offset; razor_write(fd, a->data, a->size); razor_write(fd, data, ALIGN(a->size, 4096) - a->size); } @@ -175,7 +264,31 @@ razor_set_write_to_fd(struct razor_set *set, int fd) } int -razor_set_write(struct razor_set *set, const char *filename) +razor_set_write_to_fd(struct razor_set *set, int fd, + enum razor_repo_file_type type) +{ + switch (type) { + case RAZOR_REPO_FILE_MAIN: + return razor_set_write_sections_to_fd(set, fd, RAZOR_MAGIC, + razor_sections, + ARRAY_SIZE(razor_sections)); + + case RAZOR_REPO_FILE_DETAILS: + return razor_set_write_sections_to_fd(set, fd, RAZOR_DETAILS_MAGIC, + razor_details_sections, + ARRAY_SIZE(razor_details_sections)); + case RAZOR_REPO_FILE_FILES: + return razor_set_write_sections_to_fd(set, fd, RAZOR_FILES_MAGIC, + razor_files_sections, + ARRAY_SIZE(razor_files_sections)); + default: + return -1; + } +} + +int +razor_set_write(struct razor_set *set, const char *filename, + enum razor_repo_file_type type) { int fd, status; @@ -183,7 +296,7 @@ razor_set_write(struct razor_set *set, const char *filename) if (fd < 0) return -1; - status = razor_set_write_to_fd(set, fd); + status = razor_set_write_to_fd(set, fd, type); if (status) { close(fd); return status; @@ -191,7 +304,6 @@ razor_set_write(struct razor_set *set, const char *filename) return close(fd); } - void razor_build_evr(char *evr_buf, int size, const char *epoch, const char *version, const char *release) @@ -269,6 +381,19 @@ razor_set_get_package(struct razor_set *set, const char *package) return p; } +void +razor_package_get_details(struct razor_set *set, struct razor_package *package, + const char **summary, const char **description, + const char **url, const char **license) +{ + const char *pool = set->details_string_pool.data; + + *summary = &pool[package->summary]; + *description = &pool[package->description]; + *url = &pool[package->url]; + *license = &pool[package->license]; +} + struct razor_entry * razor_set_find_entry(struct razor_set *set, struct razor_entry *dir, const char *pattern) diff --git a/librazor/razor.h b/librazor/razor.h index d8da00b..5040dc0 100644 --- a/librazor/razor.h +++ b/librazor/razor.h @@ -26,6 +26,12 @@ struct razor_set; struct razor_package; struct razor_property; +enum razor_repo_file_type { + RAZOR_REPO_FILE_MAIN, + RAZOR_REPO_FILE_DETAILS, + RAZOR_REPO_FILE_FILES +}; + enum razor_property_flags { RAZOR_PROPERTY_LESS = 1 << 0, RAZOR_PROPERTY_GREATER = 1 << 1, @@ -55,12 +61,22 @@ razor_property_type_to_string(struct razor_property *p); struct razor_set *razor_set_create(void); struct razor_set *razor_set_open(const char *filename); void razor_set_destroy(struct razor_set *set); -int razor_set_write_to_fd(struct razor_set *set, int fd); -int razor_set_write(struct razor_set *set, const char *filename); +int razor_set_write_to_fd(struct razor_set *set, int fd, + enum razor_repo_file_type type); +int razor_set_write(struct razor_set *set, const char *filename, + enum razor_repo_file_type type); + +void razor_set_open_details(struct razor_set *set, const char *filename); +void razor_set_open_files(struct razor_set *set, const char *filename); struct razor_package * razor_set_get_package(struct razor_set *set, const char *package); +void +razor_package_get_details(struct razor_set *set, struct razor_package *package, + const char **summary, const char **description, + const char **url, const char **license); + struct razor_package_iterator; struct razor_package_iterator * razor_package_iterator_create(struct razor_set *set); @@ -162,6 +178,11 @@ void razor_importer_begin_package(struct razor_importer *importer, const char *name, const char *version, const char *arch); +void razor_importer_add_details(struct razor_importer *importer, + const char *summary, + const char *description, + const char *url, + const char *license); void razor_importer_add_property(struct razor_importer *importer, const char *name, uint32_t flags, diff --git a/librazor/root.c b/librazor/root.c index 9e0ae26..6cef276 100644 --- a/librazor/root.c +++ b/librazor/root.c @@ -58,7 +58,7 @@ razor_root_create(const char *root) "a razor install root is already initialized\n"); return -1; } - if (razor_set_write(set, path) < 0) { + if (razor_set_write(set, path, RAZOR_REPO_FILE_MAIN) < 0) { fprintf(stderr, "could not write initial package set\n"); return -1; } @@ -138,7 +138,7 @@ razor_root_close(struct razor_root *root) void razor_root_update(struct razor_root *root, struct razor_set *next) { - razor_set_write_to_fd(next, root->fd); + razor_set_write_to_fd(next, root->fd, RAZOR_REPO_FILE_MAIN); root->next = next; /* Sync the new repo file so the new package set is on disk diff --git a/librazor/rpm.c b/librazor/rpm.c index 21fde8d..8bd5289 100644 --- a/librazor/rpm.c +++ b/librazor/rpm.c @@ -781,7 +781,7 @@ razor_rpm_close(struct razor_rpm *rpm) int razor_importer_add_rpm(struct razor_importer *importer, struct razor_rpm *rpm) { - const char *name, *version, *release, *arch; + const char *name, *version, *release, *arch, *summary; const uint32_t *epoch; char evr[128], buf[16]; @@ -790,6 +790,7 @@ razor_importer_add_rpm(struct razor_importer *importer, struct razor_rpm *rpm) version = razor_rpm_get_indirect(rpm, RPMTAG_VERSION, NULL); release = razor_rpm_get_indirect(rpm, RPMTAG_RELEASE, NULL); arch = razor_rpm_get_indirect(rpm, RPMTAG_ARCH, NULL); + summary = razor_rpm_get_indirect(rpm, RPMTAG_SUMMARY, NULL); if (epoch) { snprintf(buf, sizeof buf, "%u", ntohl(*epoch)); diff --git a/src/import-rpmdb.c b/src/import-rpmdb.c index 916ca27..3b4851c 100644 --- a/src/import-rpmdb.c +++ b/src/import-rpmdb.c @@ -86,6 +86,7 @@ razor_set_create_from_rpmdb(void) Header h; int_32 type, count, i; union rpm_entry name, epoch, version, release, arch; + union rpm_entry summary, description, url, license; union rpm_entry basenames, dirnames, dirindexes; char filename[PATH_MAX], evr[128], buf[16]; rpmdb db; @@ -106,6 +107,11 @@ razor_set_create_from_rpmdb(void) headerGetEntry(h, RPMTAG_VERSION, &type, &version.p, &count); headerGetEntry(h, RPMTAG_RELEASE, &type, &release.p, &count); headerGetEntry(h, RPMTAG_ARCH, &type, &arch.p, &count); + headerGetEntry(h, RPMTAG_SUMMARY, &type, &summary.p, &count); + headerGetEntry(h, RPMTAG_DESCRIPTION, &type, &description.p, + &count); + headerGetEntry(h, RPMTAG_URL, &type, &url.p, &count); + headerGetEntry(h, RPMTAG_LICENSE, &type, &license.p, &count); if (epoch.flags != NULL) { snprintf(buf, sizeof buf, "%u", *epoch.flags); @@ -118,6 +124,9 @@ razor_set_create_from_rpmdb(void) razor_importer_begin_package(importer, name.string, evr, arch.string); + razor_importer_add_details(importer, summary.string, + description.string, url.string, + license.string); add_properties(importer, RAZOR_PROPERTY_REQUIRES, h, RPMTAG_REQUIRENAME, diff --git a/src/import-yum.c b/src/import-yum.c index f70c71d..cb4ea7a 100644 --- a/src/import-yum.c +++ b/src/import-yum.c @@ -38,6 +38,10 @@ enum { YUM_STATE_BEGIN, YUM_STATE_PACKAGE_NAME, YUM_STATE_PACKAGE_ARCH, + YUM_STATE_SUMMARY, + YUM_STATE_DESCRIPTION, + YUM_STATE_URL, + YUM_STATE_LICENSE, YUM_STATE_CHECKSUM, YUM_STATE_REQUIRES, YUM_STATE_PROVIDES, @@ -53,7 +57,8 @@ struct yum_context { struct razor_importer *importer; struct import_property_context *current_property_context; - char name[256], arch[64], buffer[512], *p; + char name[256], arch[64], summary[512], description[4096]; + char url[256], license[64], buffer[512], *p; char pkgid[128]; uint32_t property_type; int state; @@ -112,9 +117,21 @@ yum_primary_start_element(void *data, const char *name, const char **atts) razor_build_evr(buffer, sizeof buffer, epoch, version, release); razor_importer_begin_package(ctx->importer, ctx->name, buffer, ctx->arch); + } else if (strcmp(name, "summary") == 0) { + ctx->p = ctx->summary; + ctx->state = YUM_STATE_SUMMARY; + } else if (strcmp(name, "description") == 0) { + ctx->p = ctx->description; + ctx->state = YUM_STATE_DESCRIPTION; + } else if (strcmp(name, "url") == 0) { + ctx->p = ctx->url; + ctx->state = YUM_STATE_URL; } else if (strcmp(name, "checksum") == 0) { ctx->p = ctx->pkgid; ctx->state = YUM_STATE_CHECKSUM; + } else if (strcmp(name, "rpm:license") == 0) { + ctx->p = ctx->license; + ctx->state = YUM_STATE_LICENSE; } else if (strcmp(name, "rpm:requires") == 0) { ctx->state = YUM_STATE_REQUIRES; ctx->property_type = RAZOR_PROPERTY_REQUIRES; @@ -174,6 +191,10 @@ yum_primary_end_element (void *data, const char *name) switch (ctx->state) { case YUM_STATE_PACKAGE_NAME: case YUM_STATE_PACKAGE_ARCH: + case YUM_STATE_SUMMARY: + case YUM_STATE_DESCRIPTION: + case YUM_STATE_URL: + case YUM_STATE_LICENSE: case YUM_STATE_CHECKSUM: case YUM_STATE_FILE: ctx->state = YUM_STATE_BEGIN; @@ -181,6 +202,10 @@ yum_primary_end_element (void *data, const char *name) } if (strcmp(name, "package") == 0) { + razor_importer_add_details(ctx->importer, ctx->summary, + ctx->description, ctx->url, + ctx->license); + XML_StopParser(ctx->current_parser, XML_TRUE); ctx->current_parser = ctx->filelists_parser; } @@ -194,6 +219,10 @@ yum_character_data (void *data, const XML_Char *s, int len) switch (ctx->state) { case YUM_STATE_PACKAGE_NAME: case YUM_STATE_PACKAGE_ARCH: + case YUM_STATE_SUMMARY: + case YUM_STATE_DESCRIPTION: + case YUM_STATE_URL: + case YUM_STATE_LICENSE: case YUM_STATE_CHECKSUM: case YUM_STATE_FILE: memcpy(ctx->p, s, len); @@ -150,6 +150,7 @@ command_list_files(int argc, const char *argv[]) struct razor_set *set; set = razor_set_open(repo_filename); + razor_set_open_files(set, "system-files.repo"); if (set == NULL) return 1; razor_set_list_files(set, argv[0]); @@ -167,6 +168,7 @@ command_list_file_packages(int argc, const char *argv[]) const char *name, *version, *arch; set = razor_set_open(repo_filename); + razor_set_open_files(set, "system-files.repo"); if (set == NULL) return 1; @@ -187,6 +189,7 @@ command_list_package_files(int argc, const char *argv[]) struct razor_set *set; set = razor_set_open(repo_filename); + razor_set_open_files(set, "system-files.repo"); if (set == NULL) return 1; razor_set_list_package_files(set, argv[0]); @@ -351,7 +354,9 @@ command_import_yum(int argc, const char *argv[]) set = razor_set_create_from_yum(); if (set == NULL) return 1; - razor_set_write(set, rawhide_repo_filename); + razor_set_write(set, rawhide_repo_filename, RAZOR_REPO_FILE_MAIN); + razor_set_write(set, "rawhide-details.repo", RAZOR_REPO_FILE_DETAILS); + razor_set_write(set, "rawhide-files.repo", RAZOR_REPO_FILE_FILES); razor_set_destroy(set); printf("wrote %s\n", rawhide_repo_filename); @@ -366,7 +371,9 @@ command_import_rpmdb(int argc, const char *argv[]) set = razor_set_create_from_rpmdb(); if (set == NULL) return 1; - razor_set_write(set, repo_filename); + razor_set_write(set, repo_filename, RAZOR_REPO_FILE_MAIN); + razor_set_write(set, "system-details.repo", RAZOR_REPO_FILE_DETAILS); + razor_set_write(set, "system-files.repo", RAZOR_REPO_FILE_FILES); razor_set_destroy(set); printf("wrote %s\n", repo_filename); @@ -447,7 +454,7 @@ command_update(int argc, const char *argv[]) } set = razor_transaction_finish(trans); - razor_set_write(set, updated_repo_filename); + razor_set_write(set, updated_repo_filename, RAZOR_REPO_FILE_MAIN); razor_set_destroy(set); razor_set_destroy(upstream); printf("wrote system-updated.repo\n"); @@ -480,7 +487,7 @@ command_remove(int argc, const char *argv[]) return 1; set = razor_transaction_finish(trans); - razor_set_write(set, updated_repo_filename); + razor_set_write(set, updated_repo_filename, RAZOR_REPO_FILE_MAIN); razor_set_destroy(set); razor_set_destroy(upstream); printf("wrote system-updated.repo\n"); @@ -571,7 +578,7 @@ command_import_rpms(int argc, const char *argv[]) set = razor_importer_finish(importer); - razor_set_write(set, repo_filename); + razor_set_write(set, repo_filename, RAZOR_REPO_FILE_MAIN); razor_set_destroy(set); printf("wrote %s\n", repo_filename); @@ -769,6 +776,42 @@ command_download(int argc, const char *argv[]) return 0; } +static int +command_info(int argc, const char *argv[]) +{ + struct razor_set *set; + struct razor_package_iterator *pi; + struct razor_package *package; + const char *pattern = argv[0], *name, *version, *arch; + const char *summary, *description, *url, *license; + + set = razor_set_open(repo_filename); + razor_set_open_details(set, "system-details.repo"); + pi = razor_package_iterator_create(set); + while (razor_package_iterator_next(pi, &package, + &name, &version, &arch)) { + if (pattern && fnmatch(pattern, name, 0) != 0) + continue; + + razor_package_get_details (set, package, &summary, &description, + &url, &license); + + printf ("Name: %s\n", name); + printf ("Arch: %s\n", arch); + printf ("Version: %s\n", version); + printf ("URL: %s\n", url); + printf ("License: %s\n", license); + printf ("Summary: %s\n", summary); + printf ("Description:\n"); + printf ("%s\n", description); + printf ("\n"); + } + razor_package_iterator_destroy(pi); + razor_set_destroy(set); + + return 0; +} + static struct { const char *name; const char *description; @@ -792,7 +835,8 @@ static struct { { "diff", "show diff between two package sets", command_diff }, { "install", "install rpm", command_install }, { "init", "init razor root", command_init }, - { "download", "download packages", command_download } + { "download", "download packages", command_download }, + { "info", "display package details", command_info } }; static int diff --git a/src/test-driver.c b/src/test-driver.c index 876d248..91bc62c 100644 --- a/src/test-driver.c +++ b/src/test-driver.c @@ -264,8 +264,12 @@ end_transaction(struct test_context *ctx) razor_transaction_install_package(ctx->trans, pkg); } for (i = 0; i < ctx->n_remove_pkgs; i++) { - pkg = razor_set_get_package(ctx->repo_set, + pkg = razor_set_get_package(ctx->system_set, ctx->remove_pkgs[i]); + if (!pkg) + pkg = razor_set_get_package(ctx->repo_set, + ctx->remove_pkgs[i]); + razor_transaction_remove_package(ctx->trans, pkg); } @@ -280,6 +284,7 @@ end_transaction(struct test_context *ctx) if (!errors) { struct razor_set *new; new = razor_transaction_finish(ctx->trans); + ctx->trans = NULL; ctx->system_set = new; } } |