From: Michael Schroeder Date: Tue, 9 Feb 2016 12:41:13 +0000 (+0100) Subject: Parse media number from baseurl X-Git-Tag: 0.6.19~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b31e4779515f8251121b6dba5afa411b5c54146;p=thirdparty%2Flibsolv.git Parse media number from baseurl Use 'createrepo -u media:// --split dir1 dir2...' to create a multi-volume repository. --- diff --git a/ext/repo_rpmmd.c b/ext/repo_rpmmd.c index 4272b6f1..a45d491e 100644 --- a/ext/repo_rpmmd.c +++ b/ext/repo_rpmmd.c @@ -776,10 +776,20 @@ startElement(void *userData, const char *name, const char **atts) str = find_attr("href", atts); if (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); + int medianr = 0; + const char *base = find_attr("xml:base", atts); + if (base && !strncmp(base, "media:", 6)) + { + /* check for the media number in the fragment */ + int l = strlen(base); + while (l && base[l - 1] >= '0' && base[l - 1] <= '9') + l--; + if (l && base[l - 1] == '#' && base[l]) + medianr = atoi(base + l); + } + repodata_set_location(pd->data, handle, medianr, 0, str); + if (base) + repodata_set_poolstr(pd->data, handle, SOLVABLE_MEDIABASE, base); } break; case STATE_CHECKSUM: