mirror of
https://github.com/moparisthebest/pacman
synced 2024-11-12 04:15:06 -05:00
Rename pmdelta_t to alpm_delta_t
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
1fdbe79022
commit
bfe1771067
@ -145,7 +145,7 @@ typedef struct _alpm_group_t {
|
||||
} alpm_group_t;
|
||||
|
||||
/** Package upgrade delta */
|
||||
typedef struct _pmdelta_t {
|
||||
typedef struct _alpm_delta_t {
|
||||
/** filename of the delta patch */
|
||||
char *delta;
|
||||
/** md5sum of the delta file */
|
||||
@ -158,7 +158,7 @@ typedef struct _pmdelta_t {
|
||||
off_t delta_size;
|
||||
/** download filesize of the delta file */
|
||||
off_t download_size;
|
||||
} pmdelta_t;
|
||||
} alpm_delta_t;
|
||||
|
||||
/** Local package or package file backup entry */
|
||||
typedef struct _pmbackup_t {
|
||||
|
@ -45,7 +45,7 @@ static alpm_list_t *graph_init(alpm_list_t *deltas, int reverse)
|
||||
alpm_list_free(vertices);
|
||||
return NULL;
|
||||
}
|
||||
pmdelta_t *vdelta = i->data;
|
||||
alpm_delta_t *vdelta = i->data;
|
||||
vdelta->download_size = vdelta->delta_size;
|
||||
v->weight = LONG_MAX;
|
||||
v->data = vdelta;
|
||||
@ -55,11 +55,11 @@ static alpm_list_t *graph_init(alpm_list_t *deltas, int reverse)
|
||||
/* compute the edges */
|
||||
for(i = vertices; i; i = i->next) {
|
||||
pmgraph_t *v_i = i->data;
|
||||
pmdelta_t *d_i = v_i->data;
|
||||
alpm_delta_t *d_i = v_i->data;
|
||||
/* loop a second time so we make all possible comparisons */
|
||||
for(j = vertices; j; j = j->next) {
|
||||
pmgraph_t *v_j = j->data;
|
||||
pmdelta_t *d_j = v_j->data;
|
||||
alpm_delta_t *d_j = v_j->data;
|
||||
/* We want to create a delta tree like the following:
|
||||
* 1_to_2
|
||||
* |
|
||||
@ -85,7 +85,7 @@ static void graph_init_size(alpm_handle_t *handle, alpm_list_t *vertices)
|
||||
for(i = vertices; i; i = i->next) {
|
||||
char *fpath, *md5sum;
|
||||
pmgraph_t *v = i->data;
|
||||
pmdelta_t *vdelta = v->data;
|
||||
alpm_delta_t *vdelta = v->data;
|
||||
|
||||
/* determine whether the delta file already exists */
|
||||
fpath = _alpm_filecache_find(handle, vdelta->delta);
|
||||
@ -133,7 +133,7 @@ static void dijkstra(alpm_list_t *vertices)
|
||||
v->childptr = v->children;
|
||||
while(v->childptr) {
|
||||
pmgraph_t *v_c = v->childptr->data;
|
||||
pmdelta_t *d_c = v_c->data;
|
||||
alpm_delta_t *d_c = v_c->data;
|
||||
if(v_c->weight > v->weight + d_c->download_size) {
|
||||
v_c->weight = v->weight + d_c->download_size;
|
||||
v_c->parent = v;
|
||||
@ -154,7 +154,7 @@ static off_t shortest_path(alpm_list_t *vertices, const char *to, alpm_list_t **
|
||||
|
||||
for(i = vertices; i; i = i->next) {
|
||||
pmgraph_t *v_i = i->data;
|
||||
pmdelta_t *d_i = v_i->data;
|
||||
alpm_delta_t *d_i = v_i->data;
|
||||
|
||||
if(strcmp(d_i->to, to) == 0) {
|
||||
if(v == NULL || v_i->weight < v->weight) {
|
||||
@ -165,7 +165,7 @@ static off_t shortest_path(alpm_list_t *vertices, const char *to, alpm_list_t **
|
||||
}
|
||||
|
||||
while(v != NULL) {
|
||||
pmdelta_t *vdelta = v->data;
|
||||
alpm_delta_t *vdelta = v->data;
|
||||
rpath = alpm_list_add(rpath, vdelta);
|
||||
v = v->parent;
|
||||
}
|
||||
@ -179,9 +179,9 @@ static off_t shortest_path(alpm_list_t *vertices, const char *to, alpm_list_t **
|
||||
* The shortest path is defined as the path with the smallest combined
|
||||
* size, not the length of the path.
|
||||
* @param handle the context handle
|
||||
* @param deltas the list of pmdelta_t * objects that a file has
|
||||
* @param deltas the list of alpm_delta_t * objects that a file has
|
||||
* @param to the file to start the search at
|
||||
* @param path the pointer to a list location where pmdelta_t * objects that
|
||||
* @param path the pointer to a list location where alpm_delta_t * objects that
|
||||
* have the smallest size are placed. NULL is set if there is no path
|
||||
* possible with the files available.
|
||||
* @return the size of the path stored, or LONG_MAX if path is unfindable
|
||||
@ -223,7 +223,7 @@ static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota
|
||||
|
||||
for(i = vertices; i; i = i->next) {
|
||||
pmgraph_t *v = i->data;
|
||||
pmdelta_t *vdelta = v->data;
|
||||
alpm_delta_t *vdelta = v->data;
|
||||
if(strcmp(vdelta->to, to) == 0)
|
||||
{
|
||||
v->weight = vdelta->download_size;
|
||||
@ -232,7 +232,7 @@ static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota
|
||||
dijkstra(vertices);
|
||||
for(i = vertices; i; i = i->next) {
|
||||
pmgraph_t *v = i->data;
|
||||
pmdelta_t *vdelta = v->data;
|
||||
alpm_delta_t *vdelta = v->data;
|
||||
if(v->weight > quota) {
|
||||
unused = alpm_list_add(unused, vdelta->delta);
|
||||
}
|
||||
@ -259,17 +259,17 @@ alpm_list_t SYMEXPORT *alpm_pkg_unused_deltas(alpm_pkg_t *pkg)
|
||||
|
||||
/** @} */
|
||||
|
||||
/** Parses the string representation of a pmdelta_t object.
|
||||
/** Parses the string representation of a alpm_delta_t object.
|
||||
* This function assumes that the string is in the correct format.
|
||||
* This format is as follows:
|
||||
* $deltafile $deltamd5 $deltasize $oldfile $newfile
|
||||
* @param line the string to parse
|
||||
* @return A pointer to the new pmdelta_t object
|
||||
* @return A pointer to the new alpm_delta_t object
|
||||
*/
|
||||
/* TODO this does not really belong here, but in a parsing lib */
|
||||
pmdelta_t *_alpm_delta_parse(char *line)
|
||||
alpm_delta_t *_alpm_delta_parse(char *line)
|
||||
{
|
||||
pmdelta_t *delta;
|
||||
alpm_delta_t *delta;
|
||||
char *tmp = line, *tmp2;
|
||||
regex_t reg;
|
||||
|
||||
@ -284,7 +284,7 @@ pmdelta_t *_alpm_delta_parse(char *line)
|
||||
}
|
||||
regfree(®);
|
||||
|
||||
CALLOC(delta, 1, sizeof(pmdelta_t), return NULL);
|
||||
CALLOC(delta, 1, sizeof(alpm_delta_t), return NULL);
|
||||
|
||||
tmp2 = tmp;
|
||||
tmp = strchr(tmp, ' ');
|
||||
@ -312,7 +312,7 @@ pmdelta_t *_alpm_delta_parse(char *line)
|
||||
return delta;
|
||||
}
|
||||
|
||||
void _alpm_delta_free(pmdelta_t *delta)
|
||||
void _alpm_delta_free(alpm_delta_t *delta)
|
||||
{
|
||||
FREE(delta->delta);
|
||||
FREE(delta->delta_md5);
|
||||
@ -321,10 +321,10 @@ void _alpm_delta_free(pmdelta_t *delta)
|
||||
FREE(delta);
|
||||
}
|
||||
|
||||
pmdelta_t *_alpm_delta_dup(const pmdelta_t *delta)
|
||||
alpm_delta_t *_alpm_delta_dup(const alpm_delta_t *delta)
|
||||
{
|
||||
pmdelta_t *newdelta;
|
||||
CALLOC(newdelta, 1, sizeof(pmdelta_t), return NULL);
|
||||
alpm_delta_t *newdelta;
|
||||
CALLOC(newdelta, 1, sizeof(alpm_delta_t), return NULL);
|
||||
STRDUP(newdelta->delta, delta->delta, return NULL);
|
||||
STRDUP(newdelta->delta_md5, delta->delta_md5, return NULL);
|
||||
STRDUP(newdelta->from, delta->from, return NULL);
|
||||
|
@ -26,9 +26,9 @@
|
||||
|
||||
#include "alpm.h"
|
||||
|
||||
pmdelta_t *_alpm_delta_parse(char *line);
|
||||
void _alpm_delta_free(pmdelta_t *delta);
|
||||
pmdelta_t *_alpm_delta_dup(const pmdelta_t *delta);
|
||||
alpm_delta_t *_alpm_delta_parse(char *line);
|
||||
void _alpm_delta_free(alpm_delta_t *delta);
|
||||
alpm_delta_t *_alpm_delta_dup(const alpm_delta_t *delta);
|
||||
off_t _alpm_shortest_delta_path(alpm_handle_t *handle, alpm_list_t *deltas,
|
||||
const char *to, alpm_list_t **path);
|
||||
|
||||
|
@ -600,7 +600,7 @@ static int apply_deltas(alpm_handle_t *handle)
|
||||
}
|
||||
|
||||
for(dlts = delta_path; dlts; dlts = dlts->next) {
|
||||
pmdelta_t *d = dlts->data;
|
||||
alpm_delta_t *d = dlts->data;
|
||||
char *delta, *from, *to;
|
||||
char command[PATH_MAX];
|
||||
size_t len = 0;
|
||||
@ -704,7 +704,7 @@ static int validate_deltas(alpm_handle_t *handle, alpm_list_t *deltas,
|
||||
EVENT(trans, PM_TRANS_EVT_DELTA_INTEGRITY_START, NULL, NULL);
|
||||
|
||||
for(i = deltas; i; i = i->next) {
|
||||
pmdelta_t *d = alpm_list_getdata(i);
|
||||
alpm_delta_t *d = alpm_list_getdata(i);
|
||||
char *filepath = _alpm_filecache_find(handle, d->delta);
|
||||
|
||||
if(test_md5sum(trans, filepath, d->delta_md5) != 0) {
|
||||
@ -766,7 +766,7 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
|
||||
/* using deltas */
|
||||
alpm_list_t *dlts;
|
||||
for(dlts = delta_path; dlts; dlts = dlts->next) {
|
||||
pmdelta_t *delta = dlts->data;
|
||||
alpm_delta_t *delta = dlts->data;
|
||||
if(delta->download_size != 0) {
|
||||
files = alpm_list_add(files, strdup(delta->delta));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user