On 1/9/2018 5:25 PM, Ken Brown wrote:
Also reorganize package validation.

Move the size-validation code in download.cc and the hash-validation
code in install.cc into new member functions of the packagesource
class.  Add a bool member 'validated' to the class to make sure that
the checking is done only once.

Change download.cc:check_for_cached() so that it offers to delete a
corrupt package file instead of throwing an exception.  The latter
previously caused a fatal error when check_for_cached() was called
from do_download_thread and download_one.  Now we get a fatal error
only if the user chooses not to delete the file.

Also make check_for_cached() check the hash of the file in addition to
the size.  Similarly, check the hash in addition to the size after
downloading a file.

I missed 'pkgsource.set_cached ("")' in a couple places.  v3 is on the way.

Ken

Reply via email to