Librepo library
1.7.13
C library for downloading linux repository metadata and packages
|
Data Structures | |
struct | LrPackageTarget |
Macros | |
#define | lr_download_simple(handle, relative_url, err) |
Enumerations | |
enum | LrPackageDownloadFlag { LR_PACKAGEDOWNLOAD_FAILFAST = 1 << 0 } |
enum | LrPackageCheckFlag { LR_PACKAGECHECK_FAILFAST = 1 << 0 } |
Functions | |
gboolean | lr_download_package (LrHandle *handle, const char *relative_url, const char *dest, LrChecksumType checksum_type, const char *checksum, gint64 expectedsize, const char *base_url, gboolean resume, GError **err) |
LrPackageTarget * | lr_packagetarget_new (LrHandle *handle, const char *relative_url, const char *dest, LrChecksumType checksum_type, const char *checksum, gint64 expectedsize, const char *base_url, gboolean resume, LrProgressCb progresscb, void *cbdata, GError **err) |
LrPackageTarget * | lr_packagetarget_new_v2 (LrHandle *handle, const char *relative_url, const char *dest, LrChecksumType checksum_type, const char *checksum, gint64 expectedsize, const char *base_url, gboolean resume, LrProgressCb progresscb, void *cbdata, LrEndCb endcb, LrMirrorFailureCb mirrorfailurecb, GError **err) |
LrPackageTarget * | lr_packagetarget_new_v3 (LrHandle *handle, const char *relative_url, const char *dest, LrChecksumType checksum_type, const char *checksum, gint64 expectedsize, const char *base_url, gboolean resume, LrProgressCb progresscb, void *cbdata, LrEndCb endcb, LrMirrorFailureCb mirrorfailurecb, gint64 byterangestart, gint64 byterangeend, GError **err) |
void | lr_packagetarget_free (LrPackageTarget *target) |
gboolean | lr_download_packages (GSList *targets, LrPackageDownloadFlag flags, GError **err) |
gboolean | lr_check_packages (GSList *targets, LrPackageCheckFlag flags, GError **err) |
#define lr_download_simple | ( | handle, | |
relative_url, | |||
err | |||
) |
Download package from repository.
handle | Librepo handle. |
relative_url | Relative part of url. |
err | GError ** |
Definition at line 43 of file package_downloader.h.
enum LrPackageCheckFlag |
Definition at line 277 of file package_downloader.h.
Available flags for package downloader
Definition at line 254 of file package_downloader.h.
gboolean lr_check_packages | ( | GSList * | targets, |
LrPackageCheckFlag | flags, | ||
GError ** | err | ||
) |
Check if targets locally exist and checksums match. If target locally exists, then its err is NULL, if it doesn't exists, or checksum is differ. Then target->err is an error message.
gboolean lr_download_package | ( | LrHandle * | handle, |
const char * | relative_url, | ||
const char * | dest, | ||
LrChecksumType | checksum_type, | ||
const char * | checksum, | ||
gint64 | expectedsize, | ||
const char * | base_url, | ||
gboolean | resume, | ||
GError ** | err | ||
) |
Download package from repository or base_url. Note: If resume, checksum and checksum_type are specified and the downloaded package alredy exists and checksum matches, then no downloading is done and LRE_ALREADYDOWNLOADED return code is returned.
handle | Librepo handle. |
relative_url | Relative part of url. |
dest | Destination file, directory or NULL (current working dir is used). |
checksum_type | Type of checksum. |
checksum | Checksum value or NULL. |
expectedsize | Expected size of target. If >0 and server reports different size, then no download is performed. |
base_url | If specified, mirrors from handle are ignored and this base_url is used for downloading. |
resume | If TRUE try to resume downloading if dest file already exists. |
err | GError ** |
gboolean lr_download_packages | ( | GSList * | targets, |
LrPackageDownloadFlag | flags, | ||
GError ** | err | ||
) |
Download all LrPackageTargets at the targets GSList.
targets | GSList where each element is a LrPackageTarget object |
flags | Bitfield with flags to download |
err | GError ** |
void lr_packagetarget_free | ( | LrPackageTarget * | target | ) |
Free LrPackageTarget object.
target | LrPackageTarget object |
LrPackageTarget* lr_packagetarget_new | ( | LrHandle * | handle, |
const char * | relative_url, | ||
const char * | dest, | ||
LrChecksumType | checksum_type, | ||
const char * | checksum, | ||
gint64 | expectedsize, | ||
const char * | base_url, | ||
gboolean | resume, | ||
LrProgressCb | progresscb, | ||
void * | cbdata, | ||
GError ** | err | ||
) |
Create new LrPackageTarget object.
handle | Handle related to this download or NULL. |
relative_url | Relative part of URL to download. First part of URL will be picked from the LrHandle (LRO_URL or mirror) during download proccess or base_url will be used if it is specified. |
dest | Destination filename or just directory (filename itself will be derived from the relative_url) or NULL (current working directory + filename derived from relative_url will be used). |
checksum_type | Type of checksum or LR_CHECKSUM_UNKNOWN. |
checksum | Expected checksum value or NULL. |
base_url | Base URL or NULL |
expectedsize | Expected size of the target. If server reports different size, then download won't be performed. |
resume | If TRUE, then downloader will try to resume download if the destination file exists. If the file doesn't exist it will be downloaded. |
progresscb | Progress callback for this transfer. |
cbdata | User data for the callback |
err | GError ** |
LrPackageTarget* lr_packagetarget_new_v2 | ( | LrHandle * | handle, |
const char * | relative_url, | ||
const char * | dest, | ||
LrChecksumType | checksum_type, | ||
const char * | checksum, | ||
gint64 | expectedsize, | ||
const char * | base_url, | ||
gboolean | resume, | ||
LrProgressCb | progresscb, | ||
void * | cbdata, | ||
LrEndCb | endcb, | ||
LrMirrorFailureCb | mirrorfailurecb, | ||
GError ** | err | ||
) |
Create new LrPackageTarget object. Almost same as lr_packagetarget_new() except this function could set more callbacks.
handle | Handle related to this download or NULL. |
relative_url | Relative part of URL to download. First part of URL will be picked from the LrHandle (LRO_URL or mirror) during download proccess or base_url will be used if it is specified. |
dest | Destination filename or just directory (filename itself will be derived from the relative_url) or NULL (current working directory + filename derived from relative_url will be used). |
checksum_type | Type of checksum or LR_CHECKSUM_UNKNOWN. |
checksum | Expected checksum value or NULL. |
base_url | Base URL or NULL |
expectedsize | Expected size of the target. If server reports different size, then no download is performed. If 0 then size check is ignored. |
resume | If TRUE, then downloader try to resume download if destination file exists. If the file doesn't exists, it will be normally downloaded again. |
progresscb | Progress callback for this transfer. |
cbdata | User data for the callbacks |
endcb | Callback called when target transfer is done. (Use status to check if successfully |
mirrorfailurecb | Called when download from a mirror failed. |
err | GError ** |
LrPackageTarget* lr_packagetarget_new_v3 | ( | LrHandle * | handle, |
const char * | relative_url, | ||
const char * | dest, | ||
LrChecksumType | checksum_type, | ||
const char * | checksum, | ||
gint64 | expectedsize, | ||
const char * | base_url, | ||
gboolean | resume, | ||
LrProgressCb | progresscb, | ||
void * | cbdata, | ||
LrEndCb | endcb, | ||
LrMirrorFailureCb | mirrorfailurecb, | ||
gint64 | byterangestart, | ||
gint64 | byterangeend, | ||
GError ** | err | ||
) |
Create new LrPackageTarget object. Almost same as lr_packagetarget_new_v2() except this function could set a required byte range of the package. For params see lr_packagetarget_new_v2().
byterangestart | Download only specified range of bytes. This param specifies the begin. 0 is default. Note: When this options is != 0 then resume must be disabled - resume param must be FALSE. |
byterangeend | Download only specified range of bytes. This param specifies the end. 0 is default. If this value is less or equal to byterangestart, then it is ignored. |