Update the osbuild/images to the version which introduces "dot notation" for distro release versions. - Replace all uses of distroregistry by distrofactory. - Delete local version of reporegistry and use the one from the osbuild/images. - Weldr: unify `createWeldrAPI()` and `createWeldrAPI2()` into a single `createTestWeldrAPI()` function`. - store/fixture: rework fixtures to allow overriding the host distro name and host architecture name. A cleanup function to restore the host distro and arch names is always part of the fixture struct. - Delete `distro_mock` package, since it is no longer used. - Bump the required version of osbuild to 98, because the OSCAP customization is using the 'compress_results' stage option, which is not available in older versions of osbuild. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
28 lines
681 B
Go
28 lines
681 B
Go
package common
|
|
|
|
import (
|
|
"github.com/hashicorp/go-version"
|
|
)
|
|
|
|
// Returns true if the version represented by the first argument is
|
|
// semantically older than the second.
|
|
//
|
|
// Meant to be used for comparing distro versions for differences between minor
|
|
// releases.
|
|
//
|
|
// Provided version strings are of any characters which are not
|
|
// digits or periods, and then split on periods.
|
|
// Assumes any missing components are 0, so 8 < 8.1.
|
|
// Evaluates to false if a and b are equal.
|
|
func VersionLessThan(a, b string) bool {
|
|
aV, err := version.NewVersion(a)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
bV, err := version.NewVersion(b)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
return aV.LessThan(bV)
|
|
}
|