~emersion/drmdb

f599e467f3de219543cb6434314c1c5e0ce24f46 — Simon Ser 8 days ago 20b7e23
Fix driverLess comparison
1 files changed, 11 insertions(+), 5 deletions(-)

M walk.go
M walk.go => walk.go +11 -5
@@ 38,12 38,18 @@ func walkNodeProps(n *drmtree.Node, f func(drm.AnyID, string, *drmtree.Property)
}

func driverLess(a *drmtree.Driver, b *drmtree.Driver) bool {
	if a.Version.Less(&b.Version) {
		return true
	if a.Version != b.Version {
		return a.Version.Less(&b.Version)
	}
	// Linux is the upstream
	if b.Kernel.SysName == "Linux" && a.Kernel.SysName != "Linux" {
		return true
	if a.Kernel.SysName != b.Kernel.SysName {
		// Linux is the upstream
		if a.Kernel.SysName == "Linux" {
			return false
		}
		if b.Kernel.SysName == "Linux" {
			return true
		}
		return a.Kernel.SysName < b.Kernel.SysName
	}
	return version.Compare(a.Kernel.Release, b.Kernel.Release, "<")
}