This replaces Packages() and BuildPackages() by returning a map of package sets, the semantics of which is up to the distro to define. They are meant to be depsolved and the result returned back as a map to Manifest(), with the same keys. No functional change. Signed-off-by: Tom Gundersen <teg@jklm.no>
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package rpmmd_mock
|
|
|
|
import (
|
|
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
|
"github.com/osbuild/osbuild-composer/internal/store"
|
|
"github.com/osbuild/osbuild-composer/internal/worker"
|
|
)
|
|
|
|
type fetchPackageList struct {
|
|
ret rpmmd.PackageList
|
|
checksums map[string]string
|
|
err error
|
|
}
|
|
type depsolve struct {
|
|
ret []rpmmd.PackageSpec
|
|
checksums map[string]string
|
|
err error
|
|
}
|
|
|
|
type Fixture struct {
|
|
fetchPackageList
|
|
depsolve
|
|
*store.Store
|
|
Workers *worker.Server
|
|
}
|
|
|
|
type rpmmdMock struct {
|
|
Fixture Fixture
|
|
}
|
|
|
|
func NewRPMMDMock(fixture Fixture) rpmmd.RPMMD {
|
|
return &rpmmdMock{Fixture: fixture}
|
|
}
|
|
|
|
func (r *rpmmdMock) FetchMetadata(repos []rpmmd.RepoConfig, modulePlatformID string, arch string) (rpmmd.PackageList, map[string]string, error) {
|
|
return r.Fixture.fetchPackageList.ret, r.Fixture.fetchPackageList.checksums, r.Fixture.fetchPackageList.err
|
|
}
|
|
|
|
func (r *rpmmdMock) Depsolve(packageSet rpmmd.PackageSet, repos []rpmmd.RepoConfig, modulePlatformID, arch string) ([]rpmmd.PackageSpec, map[string]string, error) {
|
|
return r.Fixture.depsolve.ret, r.Fixture.fetchPackageList.checksums, r.Fixture.depsolve.err
|
|
}
|