Currently, if a source file exists but has the wrong checksum, fink won't notice until the unpack phase. This means that it may require user interaction and/or network access in the middle of the build rather than the beginning. The patch factors out the checksum validation code into a new function fetch_source_if_needed and invokes it during the fetch phase. It also gets called during the unpack phase because it takes essentially no time and in the slight chance that the file has gotten corrupted between the two phases, it's the right thing to do.
The only thing I wasn't sure about was that the old phase_unpack had logic for repeating the download attempt if it failed. However, fetch_url_to_file has its own logic for doing that. As near as I could tell fetch_url_to_file will either download a file with the correct checksum or return failure, and in the latter case fetch_source will die. Thus, it doesn't seem possible for the redownload logic in phase_unpack to be invoked, so I removed this logic.
Log in to post a comment.