Add multiple pkg support to pkg.latest (pacman)

Also tweaked the changes made to the pkg state in 306cc74, and fixed a
logic bug I introduced into apt.py in the same commit.
Merge pull request #3164 from archtaku/issue2906

Add multiple pkg support to pkg.latest (pacman)