Make pmdelta_t public

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2011-06-16 11:49:34 -05:00
parent 7f6c1a76c6
commit 51359e6d33
4 changed files with 25 additions and 68 deletions

View File

@ -103,7 +103,6 @@ typedef enum _pgp_verify_t {
typedef struct __pmhandle_t pmhandle_t;
typedef struct __pmdb_t pmdb_t;
typedef struct __pmpkg_t pmpkg_t;
typedef struct __pmdelta_t pmdelta_t;
typedef struct __pmgrp_t pmgrp_t;
typedef struct __pmtrans_t pmtrans_t;
@ -138,6 +137,22 @@ typedef struct _pmfileconflict_t {
char *ctarget;
} pmfileconflict_t;
/** Package upgrade delta */
typedef struct _pmdelta_t {
/** filename of the delta patch */
char *delta;
/** md5sum of the delta file */
char *delta_md5;
/** filename of the 'before' file */
char *from;
/** filename of the 'after' file */
char *to;
/** filesize of the delta file */
off_t delta_size;
/** download filesize of the delta file */
off_t download_size;
} pmdelta_t;
/*
* Logging facilities
*/
@ -666,16 +681,6 @@ int alpm_pkg_check_pgp_signature(pmpkg_t *pkg);
int alpm_db_check_pgp_signature(pmdb_t *db);
int alpm_db_set_pgp_verify(pmdb_t *db, pgp_verify_t verify);
/*
* Deltas
*/
const char *alpm_delta_get_from(pmdelta_t *delta);
const char *alpm_delta_get_to(pmdelta_t *delta);
const char *alpm_delta_get_filename(pmdelta_t *delta);
const char *alpm_delta_get_md5sum(pmdelta_t *delta);
off_t alpm_delta_get_size(pmdelta_t *delta);
/*
* Groups
*/

View File

@ -34,43 +34,6 @@
#include "log.h"
#include "graph.h"
/** \addtogroup alpm_deltas Delta Functions
* @brief Functions to manipulate libalpm deltas
* @{
*/
const char SYMEXPORT *alpm_delta_get_from(pmdelta_t *delta)
{
ASSERT(delta != NULL, return NULL);
return delta->from;
}
const char SYMEXPORT *alpm_delta_get_to(pmdelta_t *delta)
{
ASSERT(delta != NULL, return NULL);
return delta->to;
}
const char SYMEXPORT *alpm_delta_get_filename(pmdelta_t *delta)
{
ASSERT(delta != NULL, return NULL);
return delta->delta;
}
const char SYMEXPORT *alpm_delta_get_md5sum(pmdelta_t *delta)
{
ASSERT(delta != NULL, return NULL);
return delta->delta_md5;
}
off_t SYMEXPORT alpm_delta_get_size(pmdelta_t *delta)
{
ASSERT(delta != NULL, return -1);
return delta->delta_size;
}
/** @} */
static alpm_list_t *graph_init(alpm_list_t *deltas, int reverse)
{
alpm_list_t *i, *j;
@ -279,6 +242,11 @@ static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota
return unused;
}
/** \addtogroup alpm_deltas Delta Functions
* @brief Functions to manipulate libalpm deltas
* @{
*/
alpm_list_t SYMEXPORT *alpm_pkg_unused_deltas(pmpkg_t *pkg)
{
off_t pkgsize = alpm_pkg_get_size(pkg);
@ -289,6 +257,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_unused_deltas(pmpkg_t *pkg)
return unused;
}
/** @} */
/** Parses the string representation of a pmdelta_t object.
* This function assumes that the string is in the correct format.

View File

@ -26,21 +26,6 @@
#include "alpm.h"
struct __pmdelta_t {
/** filename of the delta patch */
char *delta;
/** md5sum of the delta file */
char *delta_md5;
/** filename of the 'before' file */
char *from;
/** filename of the 'after' file */
char *to;
/** filesize of the delta file */
off_t delta_size;
/** download filesize of the delta file */
off_t download_size;
};
pmdelta_t *_alpm_delta_parse(char *line);
void _alpm_delta_free(pmdelta_t *delta);
off_t _alpm_shortest_delta_path(pmhandle_t *handle, alpm_list_t *deltas,

View File

@ -705,13 +705,11 @@ static int validate_deltas(pmhandle_t *handle, alpm_list_t *deltas,
for(i = deltas; i; i = i->next) {
pmdelta_t *d = alpm_list_getdata(i);
const char *filename = alpm_delta_get_filename(d);
char *filepath = _alpm_filecache_find(handle, filename);
const char *md5sum = alpm_delta_get_md5sum(d);
char *filepath = _alpm_filecache_find(handle, d->delta);
if(test_md5sum(trans, filepath, md5sum) != 0) {
if(test_md5sum(trans, filepath, d->delta_md5) != 0) {
errors++;
*data = alpm_list_add(*data, strdup(filename));
*data = alpm_list_add(*data, strdup(d->delta));
}
FREE(filepath);
}