repos: Factor out and reuse DependenciesSource
Created by: tsenart
Context
This PR factors out a repos.DependenciesSource
that all different dependency repo sources now use to share code. This is similar to what we have done in gitserver with #34289.
This paves the way to store valid versions in repo.metadata
and avoid redundant API calls in gitserver.
Part of #34350
Test plan
- Existing integration and unit tests
- New integration test
- Manual testing