Rewrite packaging logic

In Emacs 24.4+ we can use package-pinned-packages to determine
pinning. If that variable isn't available we have to download/install
Melpa do some advice in order to replicate the new behaviour.