Pkg: refactor base/pkg.jl to just cd and calls an entry point.

This avoids all the annoying nonsense of having to avoid recursive
calls to Dir.cd and reasoning about if you are or are not in the
~/.julia directory yet.
Pkg: also refactor scaffold to cd in base/pkg.jl.

This is a bit weird – it's unclear why this should cd into ~/.julia
when dir is set to something else, but this works, so moving on.
Pkg: simplify check_metadata and call it after register or tag.
Pkg: move build and fixup code to the same region of pkg/entry.jl.
Pkg.status: handle lack of required or additional packages better.
Merge pull request #4386 from JuliaLang/sk/pkg

Pkg: refactor base/pkg.jl to just cd and calls an entry point.