Improvements for xbps_fetch_file and xbps_repository_sync_index.

xbps_fetch_file:
	- A temp file is created with .part extension to improve resuming.
	- Files are downloaded in cwd.
	- Switch to futimens(2) and fsync(2).

xbps_repository_sync_index:
	- Do not create local repodir in metadir if it already exists.
	- Simplify the code thanks to new xbps_fetch_file().
This commit is contained in:
Juan RP
2012-11-11 11:29:49 +01:00
parent f81d8ac1f0
commit a77727887d
7 changed files with 129 additions and 142 deletions

View File

@@ -56,7 +56,7 @@
*/
#define XBPS_PKGINDEX_VERSION "1.5"
#define XBPS_API_VERSION "20121111"
#define XBPS_API_VERSION "20121111-1"
#ifndef XBPS_VERSION
#define XBPS_VERSION "UNSET"
@@ -641,22 +641,16 @@ int xbps_configure_packages(struct xbps_handle *xhp, bool flush);
/**
* Download a file from a remote URL.
* Download a file from a remote URL to current working directory.
*
* @param[in] xhp Pointer to an xbps_handle struct.
* @param[in] uri Remote URI string.
* @param[in] outputdir Directory string to store downloaded file.
* @param[in] refetch If true and local/remote size/mtime do not match,
* fetch the file from scratch.
* @param[in] flags Flags passed to libfetch's fetchXget().
*
* @return -1 on error, 0 if not downloaded (because local/remote size/mtime
* do not match) and 1 if downloaded successfully.
**/
int xbps_fetch_file(struct xbps_handle *xhp,
const char *uri,
const char *outputdir,
bool refetch,
int xbps_fetch_file(struct xbps_handle *xhp, const char *uri,
const char *flags);
/**