lib/repo_sync.c: use xbps_fetch_delta instead of xbps_fetch_file

This commit is contained in:
Enno Boland 2014-08-11 20:01:24 +02:00
parent b0c090c39e
commit 8a992372ed

View File

@ -75,7 +75,7 @@ int HIDDEN
xbps_repo_sync(struct xbps_handle *xhp, const char *uri) xbps_repo_sync(struct xbps_handle *xhp, const char *uri)
{ {
const char *arch, *fetchstr = NULL; const char *arch, *fetchstr = NULL;
char *repodata, *lrepodir, *uri_fixedp; char *repodata, *repofile, *lrepodir, *uri_fixedp;
int rv = 0; int rv = 0;
assert(uri != NULL); assert(uri != NULL);
@ -124,14 +124,15 @@ xbps_repo_sync(struct xbps_handle *xhp, const char *uri)
/* /*
* Remote repository plist index full URL. * Remote repository plist index full URL.
*/ */
repodata = xbps_xasprintf("%s/%s-repodata", uri, arch); repofile = xbps_xasprintf("%s-repodata", arch);
repodata = xbps_xasprintf("%s/%s", uri, repofile);
/* reposync start cb */ /* reposync start cb */
xbps_set_cb_state(xhp, XBPS_STATE_REPOSYNC, 0, repodata, NULL); xbps_set_cb_state(xhp, XBPS_STATE_REPOSYNC, 0, repodata, NULL);
/* /*
* Download plist index file from repository. * Download plist index file from repository.
*/ */
if ((rv = xbps_fetch_file(xhp, repodata, NULL)) == -1) { if ((rv = xbps_fetch_delta(xhp, repofile, repodata, repofile, NULL)) == -1) {
/* reposync error cb */ /* reposync error cb */
fetchstr = xbps_fetch_error_string(); fetchstr = xbps_fetch_error_string();
xbps_set_cb_state(xhp, XBPS_STATE_REPOSYNC_FAIL, xbps_set_cb_state(xhp, XBPS_STATE_REPOSYNC_FAIL,
@ -142,6 +143,7 @@ xbps_repo_sync(struct xbps_handle *xhp, const char *uri)
rv = 0; rv = 0;
free(repodata); free(repodata);
free(repofile);
return rv; return rv;
} }