distro/fedora: implementation cleanups for newer releases

Clean up some implementation aspects of the Fedora distro definition:
 - Do not have default Fedora distro version and use `fedora` as the
   package name in all places that use it, instead of `fedora33`.
 - Fix bugs when wrong (Fedora 33) values were returned by `OSTreeRef()`
   and `Releasever()` for newer Fedora releases.
 - Test Fedora 35 in package unit tests.
 - Add unit test for `OSTreeRef()` method.
 - Use architecture name constants from `distro` package, instead of
   string literals.

Fix #1802

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2022-02-02 14:25:08 +01:00 committed by Tomáš Hozza
parent 8b8c7bbbbe
commit b9efe82bd7
5 changed files with 138 additions and 117 deletions

View file

@ -11,7 +11,7 @@ import (
"github.com/osbuild/osbuild-composer/internal/blueprint"
"github.com/osbuild/osbuild-composer/internal/distro"
"github.com/osbuild/osbuild-composer/internal/distro/fedora33"
fedora "github.com/osbuild/osbuild-composer/internal/distro/fedora33"
"github.com/osbuild/osbuild-composer/internal/rpmmd"
"github.com/osbuild/osbuild-composer/internal/store"
"github.com/osbuild/osbuild-composer/internal/target"
@ -116,8 +116,8 @@ func main() {
awsTarget.ImageName = "My Image"
awsTarget.Created = time.Now()
d := fedora33.New()
a, err := d.GetArch("x86_64")
d := fedora.NewF35()
a, err := d.GetArch(distro.X86_64ArchName)
if err != nil {
panic(err)
}
@ -129,11 +129,11 @@ func main() {
if err != nil {
panic(err)
}
allRepos, err := rpmmd.LoadRepositories([]string{cwd}, "fedora-33")
allRepos, err := rpmmd.LoadRepositories([]string{cwd}, "fedora-35")
if err != nil {
panic(err)
}
repos := allRepos["x86_64"]
repos := allRepos[distro.X86_64ArchName]
homeDir, err := os.UserHomeDir()
if err != nil {
panic("os.UserHomeDir(): " + err.Error())