1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-23 08:18:51 -05:00
pacman/lib/libalpm
Dan McGee d2dbb04a9a download: major refactor to address lingering issues
Sorry for this being such a huge patch, but I believe it is necessary for
quite a few reasons which I will attempt to explain herein. I've been
mulling this over for a while, but wasn't super happy with making the
download interface more complex. Instead, if we carefully order things in
the internal download code, we can actually make the interface simpler.

1. FS#15657 - This involves `name.db.tar.gz.part` files being left around the
filesystem, and then causing all sorts of issues when someone attempts to
rerun the operation they canceled. We need to ensure that if we resume a
download, we are resuming it on exactly the same file; if we cannot be
almost postive of that then we need to start over.

2. http://www.mail-archive.com/pacman-dev@archlinux.org/msg03536.html - Here
we have a lighttpd bug to ruin the day. If we send both a Range: header and
If-Modified-Since: header across the wire in a GET request, lighttpd doesn't
do what we want in several cases. If the file hadn't been modified, it
returns a '304 Not Modified' instead of a '206 Partial Content'. We need to
do a stat (e.g. HEAD in HTTP terms) operation here, and the proceed
accordingly based off the values we get back from it.

3. The mtime stuff was rather ugly, and relied on the called function to
write back to a passed in reference, which isn't the greatest. Instead, use
the power of the filesystem to contain this info. Every file downloaded
internally is now carefully timestamped with the remote file time. This
should allow the resume logic to work. In order to guarantee this, we need
to implement a signal handler that catches interrupts, notifies the running
code, and causes it to set the mtimes on the file. It then rethrows the
signal so the pacman signal handler (or any frontend) works as expected.

4. We did a lot of funky stuff in trying to track the DB last modified time.
It is a lot easier to just keep the downloaded DB file around and track the
time on that rather than in a funky dot file. It also kills a lot of code.

5. For GPG verification of the databases down the road, we are going to need
the DB file around for at least a short bit of time anyway, so this gets us
closer to that.

Signed-off-by: Dan McGee <dan@archlinux.org>
[Xav: fixed printf with off_t]
Signed-off-by: Xavier Chantry <shiningxc@gmail.com>
2009-11-15 19:47:30 -06:00
..
po Add Catalan translation 2009-11-15 19:09:58 -06:00
.gitignore Remove unnecessary entries from .gitignore files 2007-07-16 16:49:28 -04:00
add.c typing: a few more fixes for special int types 2009-10-11 14:41:59 -05:00
add.h Change the interface for target loading 2009-09-12 13:06:43 +02:00
alpm_list.c Fix a small typo in alpm_list.c 2009-10-24 10:27:48 -05:00
alpm_list.h alpm_list : add new alpm_list_diff_sorted function 2009-10-11 15:28:10 -05:00
alpm.c Update copyright headers and messages 2009-07-01 02:08:33 -05:00
alpm.h download: major refactor to address lingering issues 2009-11-15 19:47:30 -06:00
backup.c typing: a few more fixes for special int types 2009-10-11 14:41:59 -05:00
backup.h Update copyright headers and messages 2009-07-01 02:08:33 -05:00
be_files.c download: major refactor to address lingering issues 2009-11-15 19:47:30 -06:00
be_package.c cygwin fix : use unsigned char for ctype function 2009-10-11 15:12:20 -05:00
cache.c Update copyright headers and messages 2009-07-01 02:08:33 -05:00
cache.h Update copyright headers and messages 2009-07-01 02:08:33 -05:00
conflict.c Remove transaction type 2009-09-08 22:17:41 -05:00
conflict.h Add a new reason field to pmconflict_t struct 2009-09-08 21:58:52 -05:00
db.c int typing: s/unsigned short/int/ in libalpm 2009-10-11 13:51:47 -05:00
db.h use bitwise shift operator in enum "bit field" 2009-10-11 22:13:49 -05:00
delta.c delta : simple code refactoring 2009-09-20 11:57:12 -05:00
delta.h Update copyright headers and messages 2009-07-01 02:08:33 -05:00
deps.c Use sync.c for upgrade transaction prepare and commit 2009-09-08 22:04:14 -05:00
deps.h Update copyright headers and messages 2009-07-01 02:08:33 -05:00
dload.c download: major refactor to address lingering issues 2009-11-15 19:47:30 -06:00
dload.h download: major refactor to address lingering issues 2009-11-15 19:47:30 -06:00
error.c sync.c : duplicate the target before modifying it 2009-09-20 11:56:46 -05:00
graph.h Update copyright headers and messages 2009-07-01 02:08:33 -05:00
group.c Update copyright headers and messages 2009-07-01 02:08:33 -05:00
group.h Update copyright headers and messages 2009-07-01 02:08:33 -05:00
handle.c Add missing get_usedelta() method 2009-10-11 14:42:04 -05:00
handle.h int typing: s/unsigned short/int/ in libalpm 2009-10-11 13:51:47 -05:00
log.c Update copyright headers and messages 2009-07-01 02:08:33 -05:00
log.h Update copyright headers and messages 2009-07-01 02:08:33 -05:00
Makefile.am Refactor pkg_load/parse_descfile into a new backend file 2008-05-11 20:07:55 -05:00
md5.c Fix compile warning fail on older versions of GCC 2009-06-30 23:14:18 -05:00
md5.h libalpm/md5: Fix license header 2008-06-03 21:31:31 -05:00
package.c Reduce unnecessary get_name() function calls 2009-10-24 10:10:12 -05:00
package.h int typing: s/unsigned short/int/ in libalpm 2009-10-11 13:51:47 -05:00
remove.c Reduce calls to list_count() in removing package 2009-10-11 14:42:04 -05:00
remove.h Change the interface for target loading 2009-09-12 13:06:43 +02:00
sync.c Fix "-Sd conflict_pkg" bug 2009-10-11 15:30:52 -05:00
sync.h Change the interface for target loading 2009-09-12 13:06:43 +02:00
trans.c Refactor do/while cycle and multiple while cycles 2009-11-15 19:40:56 -06:00
trans.h Remove transaction type 2009-09-08 22:17:41 -05:00
util.c Refactor do/while cycle and multiple while cycles 2009-11-15 19:40:56 -06:00
util.h Rework the alpm_unpack functions 2009-10-11 15:18:47 -05:00