apt: fixed pkg=<name>=<version> fails if package is not yet installed.

Reported and patch provided by https://github.com/msolo. Closes GH-5625.
Merge pull request #5645 from resmo/fix/apt_pkg_version

apt: fixed pkg=<name>=<version> fails if package is not yet installed.

Tested and it fixes the problem on more recent versions of apt.