FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 02-16-2008, 04:22 PM
Nathan Jones
 
Default Rework delta struct and modify code accordingly

On Fri, Feb 15, 2008 at 08:27:18PM -0600, Dan McGee wrote:
> Note both my comments above in the commit message, as well as taking a look
> at how not trying to even worry about the filename simplifies the code in
> sync.c a good amount.

The simplification is very nice. This will allow us to completely get
rid of the patches list, which I always thought was a bit hacky.

The main reason I wanted to keep the old version in addition to the
filename is for the function pkg_upgrade_delta_path:

static alpm_list_t *pkg_upgrade_delta_path(pmpkg_t *newpkg, pmdb_t *db_local)
{
pmpkg_t *oldpkg = alpm_db_get_pkg(db_local, newpkg->name);
alpm_list_t *ret = NULL;

if(oldpkg) {
const char *oldname = alpm_pkg_get_filename(oldpkg);
char *oldpath = _alpm_filecache_find(oldname);

if(oldpath) {
// delta stuff
}
}

return(ret);
}

The line
const char *oldname = alpm_pkg_get_filename(oldpkg);
would change to
const char *oldname = alpm_deltas_find_old_filename(pkg->deltas, oldpkg->version);
and everything would work as before.

> @@ -246,19 +227,32 @@ pmdelta_t *_alpm_delta_parse(char *line)
> tmp2 = tmp;
> tmp = strchr(tmp, ' ');
> *(tmp++) = '';
> + STRDUP(delta->from_md5, tmp2, RET_ERR(PM_ERR_MEMORY, NULL));
> +
> + tmp2 = tmp;
> + tmp = strchr(tmp, ' ');
> + *(tmp++) = '';
> STRDUP(delta->to, tmp2, RET_ERR(PM_ERR_MEMORY, NULL));
>
> tmp2 = tmp;
> tmp = strchr(tmp, ' ');
> *(tmp++) = '';
> - delta->size = atol(tmp2);
> + STRDUP(delta->to_md5, tmp2, RET_ERR(PM_ERR_MEMORY, NULL));
>
> tmp2 = tmp;
> tmp = strchr(tmp, ' ');
> *(tmp++) = '';
> - STRDUP(delta->filename, tmp2, RET_ERR(PM_ERR_MEMORY, NULL));
> + STRDUP(delta->delta, tmp2, RET_ERR(PM_ERR_MEMORY, NULL));
>
> - STRDUP(delta->md5sum, tmp, RET_ERR(PM_ERR_MEMORY, NULL));
> + tmp2 = tmp;
> + tmp = strchr(tmp, ' ');
> + *(tmp++) = '';
> + STRDUP(delta->delta_md5, tmp2, RET_ERR(PM_ERR_MEMORY, NULL));
> +
> + tmp2 = tmp;
> + tmp = strchr(tmp, ' ');
> + *(tmp++) = '';
> + delta->delta_size = atol(tmp2);
>
> return(delta);
> }

So you want a space added to the end of every delta line? Because this
is going to crash if not. Just making sure it's not a copy/paste
problem.

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 

Thread Tools




All times are GMT. The time now is 07:20 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org