Make xbps_fetch_file accept a callback to update its progress.

This also makes xbps_unpack_binary_pkg follow this convention by avoiding
static variables.

--HG--
branch : progress_callback
rename : bin/xbps-repo/util.c => bin/xbps-bin/util.c
This commit is contained in:
Juan RP
2011-01-22 12:40:19 +01:00
parent 8c2ccea435
commit 984eae1578
22 changed files with 354 additions and 365 deletions

View File

@@ -82,7 +82,9 @@ xbps_get_remote_repo_string(const char *uri)
* size and/or mtime match) and 1 if downloaded successfully.
*/
int
xbps_repository_sync_pkg_index(const char *uri)
xbps_repository_sync_pkg_index(const char *uri,
void (*progress_cb)(void *),
struct xbps_fetch_progress_data *xfpd)
{
struct url *url = NULL;
struct utsname un;
@@ -160,8 +162,9 @@ xbps_repository_sync_pkg_index(const char *uri)
/*
* Download pkg-index.plist file from repository.
*/
if ((rv = xbps_fetch_file(rpidx, fetch_outputdir,
true, NULL)) == -1) {
rv = xbps_fetch_file(rpidx, fetch_outputdir, true, NULL,
progress_cb, xfpd);
if (rv == -1) {
(void)remove(tmp_metafile);
goto out;
}