Commit Graph

7 Commits

Author SHA1 Message Date
Dan McGee 0669c9bfac Use correct C type for file sizes
We have been using unsigned long as a file size type for a while, which
works but isn't quite correct and could easily break. Worse was probably our
use of int in the download callback functions, which could be restrictive
for packages > 2GB in size.

Switch all file size variables to use off_t, which is the preferred type for
file sizes. Note that at least on Linux, all applications compiled against
libalpm must now be sure to use large file support, where _FILE_OFFSET_BITS
is defined to be 64 or there will be some weird issues that crop up.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-06-04 15:38:47 -05:00
Chantry Xavier 701a03dcdb Completely rework delta algorithm
Using the graph structures that Nagy set up for dependency sorting, we now
do a similar process for deltas. Load up all of the deltas into a graph
object on which we can then apply Dijkstra's algorithm, using the new weight
field of graph struct.
We initialize the nodes weight using the base files that we can use in our
filecache (both filename and md5sum must match). The algorithm then picks
the best path among those that can be resolved.

Note that this algorithm has a few advantages over the old one:
1. It is completely file agnostic. These delta chains do not have to consist
   of package files- this could be adopted to do delta-fied DBs.
2. It does not use the local_db anymore, or even care if a package or file
   is currently installed. Instead, it only looks in the filecache for files
   and packages that match delta chain entries.

Original-work-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-04-26 11:36:01 -05:00
Dan McGee 30bdf94c2b Rework delta struct and modify code accordingly
Start to move the delta struct away from an assumed package name scheme and
towards something that is package (or even filename) agnostic. This will
allow us much greater flexibility in the usage of deltas (maybe even sync
DBs some day) as well as allowing code outside of delta.h/delta.c to be much
cleaner with less of a need for snprintf() calls.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-26 11:30:12 -05:00
Dan McGee 927af790ee Convert deltas to dynamic allocation
Another elimination of a static length structure in libalpm. Should result
in a little more memory saved during execution of packages with lots of
deltas attached.

Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-21 19:33:32 -06:00
Dan McGee 9781d0d637 Update GNU GPL boilerplate and copyright dates
Update the GPL boilerplate to direct people to the GNU website for a copy of
the license, as well as bump all of Judd's copyrights to 2007.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-10 22:55:39 -06:00
Dan McGee 2322909703 War on whitespace
Run the kernel's cleanfile script on all of our source files.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-16 20:18:45 -06:00
Nathan Jones 0c2cc108d3 Add pmdelta_t structure and functions to libalpm.
Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-19 19:21:44 -05:00