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:
parent
b618829d45
commit
77556973cc
19 changed files with 206 additions and 339 deletions
|
|
@ -84,7 +84,7 @@ func main() {
|
|||
|
||||
rpm := rpmmd.NewRPMMD(path.Join(cacheDirectory, "rpmmd"))
|
||||
|
||||
distros, err := distro.NewDefaultRegistry([]string{"/etc/osbuild-composer", "/usr/share/osbuild-composer"})
|
||||
distros, err := distro.NewDefaultRegistry()
|
||||
if err != nil {
|
||||
log.Fatalf("Error loading distros: %v", err)
|
||||
}
|
||||
|
|
@ -94,6 +94,11 @@ func main() {
|
|||
log.Fatalf("Could not determine distro from host: " + err.Error())
|
||||
}
|
||||
|
||||
repoMap, err := rpmmd.LoadRepositories([]string{"/etc/osbuild-composer", "/usr/share/osbuild-composer"}, distribution.Name())
|
||||
if err != nil {
|
||||
log.Fatalf("Could not load repositories for %s: %v", distribution.Name(), err)
|
||||
}
|
||||
|
||||
var logger *log.Logger
|
||||
if verbose {
|
||||
logger = log.New(os.Stdout, "", 0)
|
||||
|
|
@ -102,7 +107,7 @@ func main() {
|
|||
store := store.New(&stateDir, *distros)
|
||||
|
||||
jobAPI := jobqueue.New(logger, store)
|
||||
weldrAPI := weldr.New(rpm, common.CurrentArch(), distribution, logger, store)
|
||||
weldrAPI := weldr.New(rpm, common.CurrentArch(), distribution, repoMap[common.CurrentArch()], logger, store)
|
||||
|
||||
go func() {
|
||||
err := jobAPI.Serve(jobListener)
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
distros, err := distro.NewDefaultRegistry([]string{"."})
|
||||
distros, err := distro.NewDefaultRegistry()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
@ -88,6 +88,11 @@ func main() {
|
|||
return
|
||||
}
|
||||
|
||||
repos, err := rpmmd.LoadRepositories([]string{"."}, distroArg)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
packages := make([]string, len(blueprint.Packages))
|
||||
for i, pkg := range blueprint.Packages {
|
||||
packages[i] = pkg.Name
|
||||
|
|
@ -112,7 +117,7 @@ func main() {
|
|||
}
|
||||
|
||||
rpmmd := rpmmd.NewRPMMD(path.Join(home, ".cache/osbuild-composer/rpmmd"))
|
||||
packageSpecs, checksums, err := rpmmd.Depsolve(packages, exclude_pkgs, d.Repositories(archArg), d.ModulePlatformID())
|
||||
packageSpecs, checksums, err := rpmmd.Depsolve(packages, exclude_pkgs, repos[archArg], d.ModulePlatformID())
|
||||
if err != nil {
|
||||
panic("Could not depsolve: " + err.Error())
|
||||
}
|
||||
|
|
@ -121,7 +126,7 @@ func main() {
|
|||
if err != nil {
|
||||
panic("Could not get build packages: " + err.Error())
|
||||
}
|
||||
buildPackageSpecs, _, err := rpmmd.Depsolve(buildPkgs, nil, d.Repositories(archArg), d.ModulePlatformID())
|
||||
buildPackageSpecs, _, err := rpmmd.Depsolve(buildPkgs, nil, repos[archArg], d.ModulePlatformID())
|
||||
if err != nil {
|
||||
panic("Could not depsolve build packages: " + err.Error())
|
||||
}
|
||||
|
|
@ -139,7 +144,7 @@ func main() {
|
|||
}
|
||||
} else {
|
||||
size := d.GetSizeForOutputType(imageType, 0)
|
||||
manifest, err := d.Manifest(blueprint.Customizations, nil, packageSpecs, buildPackageSpecs, archArg, imageType, size)
|
||||
manifest, err := d.Manifest(blueprint.Customizations, repos[archArg], packageSpecs, buildPackageSpecs, archArg, imageType, size)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue