X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=ext%2Frepo_rpmmd.c;h=21dd9130768e775adf6661ac25b1f732e66b4a85;hb=refs%2Ftags%2Fupstream%2F0.6.6;hp=81790a84ff0264f5a45d78d143b433f09f1dea6e;hpb=9eb59bbb93038fce3233052d93f7f50521ebfef5;p=platform%2Fupstream%2Flibsolv.git diff --git a/ext/repo_rpmmd.c b/ext/repo_rpmmd.c index 81790a8..21dd913 100644 --- a/ext/repo_rpmmd.c +++ b/ext/repo_rpmmd.c @@ -78,11 +78,6 @@ enum state { STATE_INSTALL_TIME, /* product */ - STATE_SHORTNAME, - STATE_DISTNAME, /* obsolete */ - STATE_DISTEDITION, /* obsolete */ - STATE_SOURCE, - STATE_TYPE, STATE_RELNOTESURL, STATE_UPDATEURL, STATE_OPTIONALURL, @@ -114,6 +109,8 @@ enum state { STATE_FILE, + STATE_CHANGELOG, + /* general */ NUMSTATES }; @@ -182,27 +179,28 @@ static struct stateswitch stateswitches[] = { /* product attributes */ /* note the product type is an attribute */ { STATE_SOLVABLE, "release-notes-url", STATE_RELNOTESURL, 1 }, - { STATE_SOLVABLE, "update-url", STATE_UPDATEURL, 1 }, - { STATE_SOLVABLE, "optional-url", STATE_OPTIONALURL, 1 }, - { STATE_SOLVABLE, "flag", STATE_FLAG, 1 }, + { STATE_SOLVABLE, "update-url", STATE_UPDATEURL, 1 }, + { STATE_SOLVABLE, "optional-url", STATE_OPTIONALURL, 1 }, + { STATE_SOLVABLE, "flag", STATE_FLAG, 1 }, - { STATE_SOLVABLE, "rpm:vendor", STATE_VENDOR, 1 }, - { STATE_SOLVABLE, "rpm:group", STATE_RPM_GROUP, 1 }, - { STATE_SOLVABLE, "rpm:license", STATE_RPM_LICENSE, 1 }, + { STATE_SOLVABLE, "rpm:vendor", STATE_VENDOR, 1 }, + { STATE_SOLVABLE, "rpm:group", STATE_RPM_GROUP, 1 }, + { STATE_SOLVABLE, "rpm:license", STATE_RPM_LICENSE, 1 }, /* rpm-md dependencies */ - { STATE_SOLVABLE, "rpm:provides", STATE_PROVIDES, 0 }, - { STATE_SOLVABLE, "rpm:requires", STATE_REQUIRES, 0 }, - { STATE_SOLVABLE, "rpm:obsoletes", STATE_OBSOLETES, 0 }, - { STATE_SOLVABLE, "rpm:conflicts", STATE_CONFLICTS, 0 }, - { STATE_SOLVABLE, "rpm:recommends", STATE_RECOMMENDS , 0 }, - { STATE_SOLVABLE, "rpm:supplements", STATE_SUPPLEMENTS, 0 }, - { STATE_SOLVABLE, "rpm:suggests", STATE_SUGGESTS, 0 }, - { STATE_SOLVABLE, "rpm:enhances", STATE_ENHANCES, 0 }, - { STATE_SOLVABLE, "rpm:freshens", STATE_FRESHENS, 0 }, - { STATE_SOLVABLE, "rpm:sourcerpm", STATE_SOURCERPM, 1 }, - { STATE_SOLVABLE, "rpm:header-range", STATE_HEADERRANGE, 0 }, - { STATE_SOLVABLE, "file", STATE_FILE, 1 }, + { STATE_SOLVABLE, "rpm:provides", STATE_PROVIDES, 0 }, + { STATE_SOLVABLE, "rpm:requires", STATE_REQUIRES, 0 }, + { STATE_SOLVABLE, "rpm:obsoletes", STATE_OBSOLETES, 0 }, + { STATE_SOLVABLE, "rpm:conflicts", STATE_CONFLICTS, 0 }, + { STATE_SOLVABLE, "rpm:recommends", STATE_RECOMMENDS , 0 }, + { STATE_SOLVABLE, "rpm:supplements", STATE_SUPPLEMENTS, 0 }, + { STATE_SOLVABLE, "rpm:suggests", STATE_SUGGESTS, 0 }, + { STATE_SOLVABLE, "rpm:enhances", STATE_ENHANCES, 0 }, + { STATE_SOLVABLE, "rpm:freshens", STATE_FRESHENS, 0 }, + { STATE_SOLVABLE, "rpm:sourcerpm", STATE_SOURCERPM, 1 }, + { STATE_SOLVABLE, "rpm:header-range", STATE_HEADERRANGE, 0 }, + { STATE_SOLVABLE, "file", STATE_FILE, 1 }, + { STATE_SOLVABLE, "changelog", STATE_CHANGELOG, 1 }, /* extended Novell/SUSE diskusage attributes (susedata.xml) */ { STATE_DISKUSAGE, "dirs", STATE_DIRS, 0 }, @@ -256,6 +254,8 @@ struct parsedata { char *lastdirstr; int lastdirstrl; + Id changelog_handle; + /** Hash to maps checksums to solv */ Stringpool cspool; /** Cache of known checksums to solvable id */ @@ -373,7 +373,7 @@ makeevr_atts(Pool *pool, struct parsedata *pd, const char **atts) else if (!strcmp(*atts, "rel")) r = atts[1]; } - if (e && !strcmp(e, "0")) + if (e && (!*e || !strcmp(e, "0"))) e = 0; if (v && !e) { @@ -513,7 +513,7 @@ adddep(Pool *pool, struct parsedata *pd, unsigned int olddeps, const char **atts else id = name; #if 0 - fprintf(stderr, "new dep %s%s%s\n", pool_id2str(pool, d), id2rel(pool, d), id2evr(pool, d)); + fprintf(stderr, "new dep %s\n", pool_dep2str(pool, id)); #endif return repo_addid_dep(pd->repo, olddeps, id, marker); } @@ -669,13 +669,20 @@ startElement(void *userData, const char *name, const char **atts) } pd->solvable = pool_id2solvable(pool, pd->cscache[index]); } - else + else { /* this is a new package */ pd->solvable = pool_id2solvable(pool, repo_add_solvable(pd->repo)); pd->freshens = 0; } - pd->handle = pd->solvable - pool->solvables; + pd->handle = handle = pd->solvable - pool->solvables; + if (pd->kind && pd->kind[1] == 'r') + { + /* products can have a type */ + const char *type = find_attr("type", atts); + if (type && *type) + repodata_set_str(pd->data, handle, PRODUCT_TYPE, type); + } #if 0 fprintf(stderr, "package #%d\n", pd->solvable - pool->solvables); #endif @@ -750,17 +757,22 @@ startElement(void *userData, const char *name, const char **atts) case STATE_INCLUDESENTRY: str = find_attr("pattern", atts); if (str) - repodata_add_poolstr_array(pd->data, pd->handle, SOLVABLE_INCLUDES, join2(&pd->jd, "pattern", ":", str)); + repodata_add_poolstr_array(pd->data, handle, SOLVABLE_INCLUDES, join2(&pd->jd, "pattern", ":", str)); break; case STATE_EXTENDSENTRY: str = find_attr("pattern", atts); if (str) - repodata_add_poolstr_array(pd->data, pd->handle, SOLVABLE_EXTENDS, join2(&pd->jd, "pattern", ":", str)); + repodata_add_poolstr_array(pd->data, handle, SOLVABLE_EXTENDS, join2(&pd->jd, "pattern", ":", str)); break; case STATE_LOCATION: str = find_attr("href", atts); if (str) - repodata_set_location(pd->data, handle, 0, 0, str); + { + repodata_set_location(pd->data, handle, 0, 0, str); + str = find_attr("xml:base", atts); + if (str) + repodata_set_poolstr(pd->data, handle, SOLVABLE_MEDIABASE, str); + } break; case STATE_CHECKSUM: str = find_attr("type", atts); @@ -817,6 +829,8 @@ startElement(void *userData, const char *name, const char **atts) pd->ret = pool_error(pool, -1, "