Split repo parsing code out of addpkg, rmpkg

Create functions for this common code in bootstrap.sh .