Fix pkgin query_package for certain package names

The current implementation returns "false positives" for packages with names that other packages' names start with.

E.g.: when ``gcc47-libs`` is already installed and ``gcc47`` is to be installed, the later's installation is skipped because it is considered to be also already installed.

Search for available or installed packages by package name:

    $ pkgin search gcc47
    gcc47-libs-4.7.2nb4 = The GNU Compiler Collection (GCC) support shared libraries.
    gcc47-4.7.2nb3       The GNU Compiler Collection (GCC) - 4.7 Release Series

The current implementation only checks for the return code being 0, which results in reporting ``gcc47`` to be installed, even when it's not (but ``gcc47-libs`` is):

    $ pkgin list | grep gcc47
    gcc47-libs-4.7.2nb4  The GNU Compiler Collection (GCC) support shared libraries.

The fix proposed in this PR fixes this behavior with an additional check that compares the *complete* package name (minus the version appendix).