Allow versions to be specified in "pkgs"

This implements #3278. It also properly enforces specified versions in
pkg.installed states, whether you are installing a single package or
many packages.