fink/fink — pull request #25 by dustinac (2012-02-18 10:15:17+00:00)
Title: Checksums during fetch

Currently, fink checks for missing files during the fetch phase, but it doesn't verify the checksums of existing files until the unpack phase. This branch changes the behavior to verify the checksums and prompt the user about what to do during the fetch phase.

I've tested the code and it works fine as is, but I have 3 points/uncertainties for anyone who understands fink's inner workings better: First, in the old version of phase_unpack, a redownloaded archive file would have its checksum verified. However, my read of fetch_url_to_file indicates that if it returns, then the archive exists and has the correct checksum, so I removed this redundant check.

Second, the behavior of "fink fetch --dry-run" is unchanged because I wasn't sure of its purpose and thus what its behavior should be when the archive exists but its checksum doesn't match.

Third, if a file already exists but has the wrong checksum, then the user is given the option of using it anyways. On the other hand, if the checksum verification fails after downloading, then this option is not given. Also, with these changes, this will have to be chosen twice: during fetch and during unpack. Maybe this option should just be removed, since I can't imagine when it would actually be useful.