repositories: distinguish between RHEL8 beta and GA

We need the same RPMs to work equally well on a host running a beta
release (pulling beta content) as on a machine running GA (pulling GA
content). Detect this at run-time and point at the right repository.

Testing this is a bit hairy as we are building 8.3 images, but obviously
there is currently no 8.3 content at the GA URLs.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-08-17 19:46:01 +02:00 committed by Ondřej Budai
parent a2f8a06e79
commit cc677dea3c
5 changed files with 95 additions and 20 deletions

View file

@ -93,7 +93,7 @@ func main() {
log.Fatalf("Error loading distros: %v", err)
}
distribution, err := distros.FromHost()
distribution, beta, err := distros.FromHost()
if err != nil {
log.Fatalf("Could not determine distro from host: " + err.Error())
}
@ -103,7 +103,13 @@ func main() {
log.Fatalf("Host distro does not support host architecture: " + err.Error())
}
repoMap, err := rpmmd.LoadRepositories([]string{"/etc/osbuild-composer", "/usr/share/osbuild-composer"}, distribution.Name())
// TODO: refactor to be more generic
name := distribution.Name()
if beta {
name += "-beta"
}
repoMap, err := rpmmd.LoadRepositories([]string{"/etc/osbuild-composer", "/usr/share/osbuild-composer"}, name)
if err != nil {
log.Fatalf("Could not load repositories for %s: %v", distribution.Name(), err)
}

View file

@ -115,7 +115,7 @@ func withBootedQemuImage(image string, ns netNS, f func() error) error {
var qemuCmd *exec.Cmd
if common.CurrentArch() == "x86_64" {
hostDistroName, err := distro.GetHostDistroName()
hostDistroName, _, err := distro.GetHostDistroName()
if err != nil {
return fmt.Errorf("cannot determing the current distro: %v", err)
}