distro: don't expose repositories in distro objects

Mixing the way to build a distribution with where to get the source
packages from is wrong: it breaks pre-release repos, local mirrors, and
other use cases. To accommodate those, we introduced
`/etc/osbuild-composer/repositories`.

However, that doesn't work for the RCM API, which receives repository
URLs to use from outside requests. This API has been wrongly using the
`additionalRepos` parameter to inject those repos. That's broken,
because the resulting manifests contained both the installed repos and
the repos from the request.

To fix this, stop exposing repositories from the distros, but require
passing them on every call to `Manifest()`. This makes `additionalRepos`
redundant.

Fixes #341
This commit is contained in:
Lars Karlitski 2020-03-18 16:09:36 +01:00 committed by Tom Gundersen
parent b618829d45
commit 77556973cc
19 changed files with 206 additions and 339 deletions

View file

@ -15,6 +15,7 @@ import (
test_distro "github.com/osbuild/osbuild-composer/internal/distro/fedoratest"
rpmmd_mock "github.com/osbuild/osbuild-composer/internal/mocks/rpmmd"
"github.com/osbuild/osbuild-composer/internal/rpmmd"
"github.com/osbuild/osbuild-composer/internal/weldr"
"github.com/google/go-cmp/cmp"
@ -209,8 +210,9 @@ func TestMain(m *testing.M) {
fixture := rpmmd_mock.BaseFixture()
rpm := rpmmd_mock.NewRPMMDMock(fixture)
distro := test_distro.New()
repos := []rpmmd.RepoConfig{{Id: "test-id", BaseURL: "http://example.com/test/os/test_arch"}}
logger := log.New(os.Stdout, "", 0)
api := weldr.New(rpm, "test_arch", distro, logger, fixture.Store)
api := weldr.New(rpm, "test_arch", distro, repos, logger, fixture.Store)
server := http.Server{Handler: api}
defer server.Close()