diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/alpm.h | 27 | ||||
-rw-r--r-- | lib/libalpm/delta.c | 43 | ||||
-rw-r--r-- | lib/libalpm/delta.h | 15 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 8 |
4 files changed, 25 insertions, 68 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 08a7a1f3..17194f0d 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -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 */ @@ -667,16 +682,6 @@ 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 */ const char *alpm_grp_get_name(const pmgrp_t *grp); diff --git a/lib/libalpm/delta.c b/lib/libalpm/delta.c index aa76b492..fed84f45 100644 --- a/lib/libalpm/delta.c +++ b/lib/libalpm/delta.c @@ -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. diff --git a/lib/libalpm/delta.h b/lib/libalpm/delta.h index d7725f5a..87869256 100644 --- a/lib/libalpm/delta.h +++ b/lib/libalpm/delta.h @@ -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, diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 05735730..6b3ddfe8 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -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); } |