1.1 --- a/main.c Sun Jun 08 17:11:41 2008 -0400
1.2 +++ b/main.c Sun Jun 08 18:29:24 2008 -0400
1.3 @@ -817,6 +817,7 @@
1.4 struct razor_package_iterator *pi;
1.5 struct razor_package *package;
1.6 const char *pattern = argv[0], *name, *version, *arch;
1.7 + const char *summary, *description, *url, *license;
1.8
1.9 set = razor_set_open(repo_filename);
1.10 pi = razor_package_iterator_create(set);
1.11 @@ -825,12 +826,17 @@
1.12 if (pattern && fnmatch(pattern, name, 0) != 0)
1.13 continue;
1.14
1.15 + razor_package_get_details (set, package, &summary, &description,
1.16 + &url, &license);
1.17 +
1.18 printf ("Name: %s\n", name);
1.19 printf ("Arch: %s\n", arch);
1.20 printf ("Version: %s\n", version);
1.21 - printf ("Summary: %s\n", razor_package_get_summary (set, package));
1.22 + printf ("URL: %s\n", url);
1.23 + printf ("License: %s\n", license);
1.24 + printf ("Summary: %s\n", summary);
1.25 printf ("Description:\n");
1.26 - printf ("%s\n", razor_package_get_description (set, package));
1.27 + printf ("%s\n", description);
1.28 printf ("\n");
1.29 }
1.30 razor_package_iterator_destroy(pi);
2.1 --- a/razor.c Sun Jun 08 17:11:41 2008 -0400
2.2 +++ b/razor.c Sun Jun 08 18:29:24 2008 -0400
2.3 @@ -63,10 +63,12 @@
2.4 struct razor_package {
2.5 uint name : 24;
2.6 uint flags : 8;
2.7 + uint32_t version;
2.8 + uint32_t arch;
2.9 uint32_t summary;
2.10 uint32_t description;
2.11 - uint32_t version;
2.12 - uint32_t arch;
2.13 + uint32_t url;
2.14 + uint32_t license;
2.15 struct list_head properties;
2.16 struct list_head files;
2.17 };
2.18 @@ -332,10 +334,15 @@
2.19 void
2.20 razor_importer_add_details(struct razor_importer *importer,
2.21 const char *summary,
2.22 - const char *description)
2.23 + const char *description,
2.24 + const char *url,
2.25 + const char *license)
2.26 {
2.27 importer->package->summary = hashtable_tokenize(&importer->table, summary);
2.28 importer->package->description = hashtable_tokenize(&importer->table, description);
2.29 + importer->package->url = hashtable_tokenize(&importer->table, url);
2.30 + importer->package->license = hashtable_tokenize(&importer->table, license);
2.31 +
2.32 }
2.33
2.34 void
2.35 @@ -921,18 +928,17 @@
2.36 return p;
2.37 }
2.38
2.39 -const char *
2.40 -razor_package_get_summary(struct razor_set *set, struct razor_package *package)
2.41 +void
2.42 +razor_package_get_details(struct razor_set *set, struct razor_package *package,
2.43 + const char **summary, const char **description,
2.44 + const char **url, const char **license)
2.45 {
2.46 const char *pool = set->string_pool.data;
2.47 - return &pool[package->summary];
2.48 -}
2.49 -
2.50 -const char *
2.51 -razor_package_get_description(struct razor_set *set, struct razor_package *package)
2.52 -{
2.53 - const char *pool = set->string_pool.data;
2.54 - return &pool[package->description];
2.55 +
2.56 + *summary = &pool[package->summary];
2.57 + *description = &pool[package->description];
2.58 + *url = &pool[package->url];
2.59 + *license = &pool[package->license];
2.60 }
2.61
2.62 struct razor_property_iterator {
3.1 --- a/razor.h Sun Jun 08 17:11:41 2008 -0400
3.2 +++ b/razor.h Sun Jun 08 18:29:24 2008 -0400
3.3 @@ -51,10 +51,10 @@
3.4 struct razor_package *
3.5 razor_set_get_package(struct razor_set *set, const char *package);
3.6
3.7 -const char *
3.8 -razor_package_get_summary(struct razor_set *set, struct razor_package *package);
3.9 -const char *
3.10 -razor_package_get_description(struct razor_set *set, struct razor_package *package);
3.11 +void
3.12 +razor_package_get_details(struct razor_set *set, struct razor_package *package,
3.13 + const char **summary, const char **description,
3.14 + const char **url, const char **license);
3.15
3.16 struct razor_package_iterator;
3.17 struct razor_package_iterator *
3.18 @@ -177,7 +177,9 @@
3.19 const char *arch);
3.20 void razor_importer_add_details(struct razor_importer *importer,
3.21 const char *summary,
3.22 - const char *description);
3.23 + const char *description,
3.24 + const char *url,
3.25 + const char *license);
3.26 void razor_importer_add_property(struct razor_importer *importer,
3.27 const char *name,
3.28 enum razor_version_relation relation,
4.1 --- a/rpm.c Sun Jun 08 17:11:41 2008 -0400
4.2 +++ b/rpm.c Sun Jun 08 18:29:24 2008 -0400
4.3 @@ -673,7 +673,8 @@
4.4 rpmdbMatchIterator iter;
4.5 Header h;
4.6 int_32 type, count, i;
4.7 - union rpm_entry name, epoch, version, release, arch, summary, description;
4.8 + union rpm_entry name, epoch, version, release, arch;
4.9 + union rpm_entry summary, description, url, license;
4.10 union rpm_entry basenames, dirnames, dirindexes;
4.11 char filename[PATH_MAX], evr[128], buf[16];
4.12 rpmdb db;
4.13 @@ -696,6 +697,8 @@
4.14 headerGetEntry(h, RPMTAG_ARCH, &type, &arch.p, &count);
4.15 headerGetEntry(h, RPMTAG_SUMMARY, &type, &summary.p, &count);
4.16 headerGetEntry(h, RPMTAG_DESCRIPTION, &type, &description.p, &count);
4.17 + headerGetEntry(h, RPMTAG_URL, &type, &url.p, &count);
4.18 + headerGetEntry(h, RPMTAG_LICENSE, &type, &license.p, &count);
4.19
4.20 if (epoch.flags != NULL) {
4.21 snprintf(buf, sizeof buf, "%u", *epoch.flags);
4.22 @@ -708,7 +711,9 @@
4.23
4.24 razor_importer_begin_package(importer,
4.25 name.string, evr, arch.string);
4.26 - razor_importer_add_details(importer, summary.string, description.string);
4.27 + razor_importer_add_details(importer, summary.string,
4.28 + description.string, url.string,
4.29 + license.string);
4.30
4.31 add_properties(importer, RAZOR_PROPERTY_REQUIRES, h,
4.32 RPMTAG_REQUIRENAME,
5.1 --- a/yum.c Sun Jun 08 17:11:41 2008 -0400
5.2 +++ b/yum.c Sun Jun 08 18:29:24 2008 -0400
5.3 @@ -39,6 +39,8 @@
5.4 YUM_STATE_PACKAGE_ARCH,
5.5 YUM_STATE_SUMMARY,
5.6 YUM_STATE_DESCRIPTION,
5.7 + YUM_STATE_URL,
5.8 + YUM_STATE_LICENSE,
5.9 YUM_STATE_CHECKSUM,
5.10 YUM_STATE_REQUIRES,
5.11 YUM_STATE_PROVIDES,
5.12 @@ -54,7 +56,8 @@
5.13
5.14 struct razor_importer *importer;
5.15 struct import_property_context *current_property_context;
5.16 - char name[256], arch[64], summary[512], description[4096], buffer[512], *p;
5.17 + char name[256], arch[64], summary[512], description[4096];
5.18 + char url[256], license[64], buffer[512], *p;
5.19 char pkgid[128];
5.20 int state;
5.21 };
5.22 @@ -121,9 +124,15 @@
5.23 } else if (strcmp(name, "description") == 0) {
5.24 ctx->p = ctx->description;
5.25 ctx->state = YUM_STATE_DESCRIPTION;
5.26 + } else if (strcmp(name, "url") == 0) {
5.27 + ctx->p = ctx->url;
5.28 + ctx->state = YUM_STATE_URL;
5.29 } else if (strcmp(name, "checksum") == 0) {
5.30 ctx->p = ctx->pkgid;
5.31 ctx->state = YUM_STATE_CHECKSUM;
5.32 + } else if (strcmp(name, "rpm:license") == 0) {
5.33 + ctx->p = ctx->license;
5.34 + ctx->state = YUM_STATE_LICENSE;
5.35 } else if (strcmp(name, "rpm:requires") == 0) {
5.36 ctx->state = YUM_STATE_REQUIRES;
5.37 } else if (strcmp(name, "rpm:provides") == 0) {
5.38 @@ -198,6 +207,8 @@
5.39 case YUM_STATE_PACKAGE_ARCH:
5.40 case YUM_STATE_SUMMARY:
5.41 case YUM_STATE_DESCRIPTION:
5.42 + case YUM_STATE_URL:
5.43 + case YUM_STATE_LICENSE:
5.44 case YUM_STATE_CHECKSUM:
5.45 case YUM_STATE_FILE:
5.46 ctx->state = YUM_STATE_BEGIN;
5.47 @@ -205,7 +216,9 @@
5.48 }
5.49
5.50 if (strcmp(name, "package") == 0) {
5.51 - razor_importer_add_details(ctx->importer, ctx->summary, ctx->description);
5.52 + razor_importer_add_details(ctx->importer, ctx->summary,
5.53 + ctx->description, ctx->url,
5.54 + ctx->license);
5.55
5.56 XML_StopParser(ctx->current_parser, XML_TRUE);
5.57 ctx->current_parser = ctx->filelists_parser;
5.58 @@ -222,6 +235,8 @@
5.59 case YUM_STATE_PACKAGE_ARCH:
5.60 case YUM_STATE_SUMMARY:
5.61 case YUM_STATE_DESCRIPTION:
5.62 + case YUM_STATE_URL:
5.63 + case YUM_STATE_LICENSE:
5.64 case YUM_STATE_CHECKSUM:
5.65 case YUM_STATE_FILE:
5.66 memcpy(ctx->p, s, len);