Factor index creation from repo collections

Move index generation from OpamRepositoryCommand and OpamState into OpamRepository
Merge pull request #855 from dsheets/repos_index

Factor index creation from repo collections