[pacman-dev] [PATCH] get_filename : use the FILENAME field from the db.

Nathan Jones nathanj at insightbb.com
Fri Feb 15 19:54:53 EST 2008


On Fri, Feb 15, 2008 at 05:29:38PM -0600, Dan McGee wrote:
> So how about a delta file in the sync dbs like the following:
> 
> %DELTAS%
> oldfile.pkg.tar.gz 000md5sum000 newfile.pkg.tar.gz 000md5sum000
> deltafile.delta 000md5sum000 23423
> # or in bash format
> $oldfile $oldmd5 $newfile $newmd5 $deltafile $deltamd5 $deltasize
> 
> I think you have an existing algorithm in place that we can adapt to
> this. I'll psuedocode it:
> 
> read in delta lines
> build a tree of possible delta paths from $syncfilename back to each
> $oldfile until we can't go further, or until we find an $oldfile that
> we can lstat and the md5sum matches.
> find shortest path of our possible paths
> use this delta path (and since we have md5sums to verify the whole
> way, we can be more sure before we start downloading that it will
> work)
> 
> Note that this whole process never worries about parsing the filename
> into parts, or for that matter, even opening the package file and
> looking at PKGINFO.
> 
> -Dan

I was going to keep the old and new version numbers and continue to use
the existing algorithm. Adding a few functions should be all that is
needed to fix the filename issue:

alpm_delta_find_old_filename(delta_list, old_version)
alpm_delta_get_old_filename(delta)
alpm_delta_get_new_filename(delta)

Your algorithm is more flexible since it can use any file in the cache
directory even if the package is not installed. However, I don't think
that flexibility would be needed in the majority of cases.




More information about the pacman-dev mailing list