diff options
author | Michael Schroeder <mls@suse.de> | 2012-10-08 15:16:42 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2012-10-08 15:16:42 +0200 |
commit | 6af0f8f8cc46636f39552d5a0e9a3f708a04ddb2 (patch) | |
tree | 9216a98422cf64ac7e84d3c991cd5e23c7f1d740 /ext/repo_mdk.c | |
parent | dc2c6fe76bc1231dd8be56eca5b92273e24fca89 (diff) | |
download | libsolv-6af0f8f8cc46636f39552d5a0e9a3f708a04ddb2.tar.gz libsolv-6af0f8f8cc46636f39552d5a0e9a3f708a04ddb2.tar.bz2 libsolv-6af0f8f8cc46636f39552d5a0e9a3f708a04ddb2.zip |
add repodata_set_sourcepkg and solvable_lookup_sourcepkg, fix solvable_get_location return type
Diffstat (limited to 'ext/repo_mdk.c')
-rw-r--r-- | ext/repo_mdk.c | 47 |
1 files changed, 1 insertions, 46 deletions
diff --git a/ext/repo_mdk.c b/ext/repo_mdk.c index 7fa0abd..82d3265 100644 --- a/ext/repo_mdk.c +++ b/ext/repo_mdk.c @@ -391,51 +391,6 @@ joinhash_lookup(Repo *repo, Hashtable ht, Hashmask hm, const char *fn, const cha return 0; } -static void -set_sourcerpm(Repodata *data, Solvable *s, Id handle, const char *sourcerpm) -{ - const char *p, *sevr, *sarch, *name, *evr; - Pool *pool; - - p = strrchr(sourcerpm, '.'); - if (!p || strcmp(p, ".rpm") != 0) - return; - p--; - while (p > sourcerpm && *p != '.') - p--; - if (*p != '.' || p == sourcerpm) - return; - sarch = p-- + 1; - while (p > sourcerpm && *p != '-') - p--; - if (*p != '-' || p == sourcerpm) - return; - p--; - while (p > sourcerpm && *p != '-') - p--; - if (*p != '-' || p == sourcerpm) - return; - sevr = p + 1; - pool = s->repo->pool; - if (!strcmp(sarch, "src.rpm")) - repodata_set_constantid(data, handle, SOLVABLE_SOURCEARCH, ARCH_SRC); - else if (!strcmp(sarch, "nosrc.rpm")) - repodata_set_constantid(data, handle, SOLVABLE_SOURCEARCH, ARCH_NOSRC); - else - repodata_set_constantid(data, handle, SOLVABLE_SOURCEARCH, pool_strn2id(pool, sarch, strlen(sarch) - 4, 1)); - evr = pool_id2str(pool, s->evr); - if (evr && !strncmp(sevr, evr, sarch - sevr - 1) && evr[sarch - sevr - 1] == 0) - repodata_set_void(data, handle, SOLVABLE_SOURCEEVR); - else - repodata_set_id(data, handle, SOLVABLE_SOURCEEVR, pool_strn2id(pool, sevr, sarch - sevr - 1, 1)); - name = pool_id2str(pool, s->name); - if (name && !strncmp(sourcerpm, name, sevr - sourcerpm - 1) && name[sevr - sourcerpm - 1] == 0) - repodata_set_void(data, handle, SOLVABLE_SOURCENAME); - else - repodata_set_id(data, handle, SOLVABLE_SOURCENAME, pool_strn2id(pool, sourcerpm, sevr - sourcerpm - 1, 1)); -} - - static void XMLCALL startElement(void *userData, const char *name, const char **atts) { @@ -479,7 +434,7 @@ startElement(void *userData, const char *name, const char **atts) repodata_set_poolstr(pd->data, pd->solvable - pool->solvables, SOLVABLE_LICENSE, str); str = find_attr("sourcerpm", atts); if (str && *str) - set_sourcerpm(pd->data, pd->solvable, pd->solvable - pool->solvables, str); + repodata_set_sourcepkg(pd->data, pd->solvable - pool->solvables, str); break; } case STATE_FILES: |