xbps-repo: fixed issue 24 (xbps-src make-repoidx is doing something wrong).

This commit is contained in:
Juan RP
2012-06-30 11:10:00 +02:00
parent 54bc92bd97
commit f1ad8a95de
3 changed files with 14 additions and 6 deletions

View File

@ -131,7 +131,7 @@ repoidx_get(struct xbps_handle *xhp, const char *pkgdir)
static int
add_binpkg_to_index(struct xbps_handle *xhp,
prop_array_t idx,
const char *filedir,
const char *repodir,
const char *file)
{
prop_dictionary_t newpkgd, curpkgd;
@ -186,7 +186,8 @@ add_binpkg_to_index(struct xbps_handle *xhp,
goto out;
} else if (ret == -1) {
/* idx version is greater, remove current binpkg */
oldfilepath = xbps_xasprintf("%s/%s", filedir, filen);
oldfilepath = xbps_xasprintf("%s/%s/%s",
repodir, arch, filen);
assert(oldfilepath != NULL);
if (remove(oldfilepath) == -1) {
rv = errno;
@ -219,7 +220,8 @@ add_binpkg_to_index(struct xbps_handle *xhp,
rv = ENOMEM;
goto out;
}
oldfilepath = xbps_xasprintf("%s/%s", filedir, oldfilen);
oldfilepath = xbps_xasprintf("%s/%s/%s",
repodir, oldarch, oldfilen);
if (oldfilepath == NULL) {
rv = errno;
prop_object_release(newpkgd);
@ -352,7 +354,7 @@ repo_genindex(struct xbps_handle *xhp, const char *pkgdir)
rv = errno;
goto out;
}
rv = add_binpkg_to_index(xhp, idx, curdir, binfile);
rv = add_binpkg_to_index(xhp, idx, pkgdir, binfile);
free(binfile);
if (rv == EEXIST) {
rv = 0;