[PORT] forward port from v 7.0 to handle installing dependencies during migration

Forward port of commits 4647 and 4651 (in launchpad https://code.launchpad.net/~openupgrade-committers/openupgrade-server/7.0), in order to install correctly the dependencies (new modules and auto installable modules) of modules.