Clean up stale journal entries and temporaries. #2057

This is a fix for #2057: Clean up journal entries and temporaries for files that are no longer relevant.

* Downloadinfo entries for files that no longer need to be downloaded
  are useless and can be removed. In particular, the temporary files
  holding partially retrieved files are now deleted when no longer
  necessary.
* The same is true for blacklist entries for paths that are no longer
  being discovered.
* Same for uploadinfos for files that no longer need to be uploaded.