Split download and extract into separate steps
This splits apk_db_install_pkg into two steps: APK_INSTALL_DOWNLOAD and APK_INSTALL_COMMIT, and accepts a bitfield of steps to perform. apk_solver_commit_changeset performs these steps as one if the cache is disabled. Otherwise, it downloads everything, then commits everything, in two steps.
By downloading everything upfront, we reduce the risk of leaving the system in a half-installed state should network issues come up partway through the upgrade. Additionally, this makes it safe to interrupt apk during the download step without a similar partially-updated-system problem.