~emersion/drmdb

651ca3aa14de2a167e4c28411d029253c14b412d — Simon Ser 2 years ago 5a9c2c9
Print kernel version
5 files changed, 26 insertions(+), 2 deletions(-)

M db.go
M go.mod
M go.sum
M public/drivers.html
M server.go
M db.go => db.go +4 -0
@@ 27,6 27,10 @@ func generateKey(n *drmtree.Node) (string, error) {
	b.WriteByte(0)
	fmt.Fprintf(&b, "%v.%v.%v-%v", ver.Major, ver.Minor, ver.Patch, ver.Date)
	b.WriteByte(0)
	b.WriteString(n.Driver.Kernel.SysName)
	b.WriteByte(0)
	b.WriteString(n.Driver.Kernel.Release)
	b.WriteByte(0)
	switch dev := n.Device.DeviceData.(type) {
	case *drmtree.DevicePCI:
		b.WriteString("pci")

M go.mod => go.mod +1 -0
@@ 6,6 6,7 @@ require (
	git.sr.ht/~emersion/go-drm v0.0.0-20190517194428-bdd0a2b572cc
	git.sr.ht/~emersion/go-hwids v0.0.0-20190518090256-f59e5efa82bd
	github.com/labstack/echo/v4 v4.1.5
	github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75
	golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c // indirect
	golang.org/x/sys v0.0.0-20190506115046-ca7f33d4116e // indirect
	golang.org/x/text v0.3.2 // indirect

M go.sum => go.sum +2 -0
@@ 15,6 15,8 @@ github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcncea
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.7 h1:UvyT9uN+3r7yLEYSlJsbQGdsaB/a0DlgWP3pql6iwOc=
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75 h1:Pijfgr7ZuvX7QIQiEwLdRVr3RoMG+i0SbBO1Qu+7yVk=
github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75/go.mod h1:76rfSfYPWj01Z85hUf/ituArm797mNKcvINh1OlsZKo=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

M public/drivers.html => public/drivers.html +6 -0
@@ 10,6 10,7 @@
            <th>Name</th>
            <th>Description</th>
            <th>Latest version</th>
            <th>Latest kernel</th>
        </tr>
    </thead>
    <tbody>


@@ 18,6 19,11 @@
            <td class="pre">{{.Name}}</td>
            <td>{{.Desc}}</td>
            <td>{{.Version.String}}</td>
            {{if .Kernel.SysName}}
            <td>{{.Kernel.SysName}} {{.Kernel.Release}}</td>
            {{else}}
            <td class="status-unknown">?</td>
            {{end}}
        </tr>
        {{end}}
    </tbody>

M server.go => server.go +13 -2
@@ 13,6 13,7 @@ import (
	"git.sr.ht/~emersion/go-drm"
	"github.com/labstack/echo/v4"
	"git.sr.ht/~emersion/go-hwids"
	"github.com/mcuadros/go-version"
)

type Template struct {


@@ 79,8 80,18 @@ func walkNodeProps(n *drmtree.Node, f func(drm.AnyID, string, *drmtree.Property)
func walkLatestDriver(fn func(n *drmtree.Node) error) error {
	latest := make(map[string]*drmtree.Node)
	err := walk(func(n *drmtree.Node) error {
		if other, ok := latest[n.Driver.Name]; ok && n.Driver.Version.Less(&other.Driver.Version) {
			return nil
		other, ok := latest[n.Driver.Name]
		if ok {
			if n.Driver.Version.Less(&other.Driver.Version) {
				return nil
			}
			// Linux is the upstream
			if other.Driver.Kernel.SysName == "Linux" && n.Driver.Kernel.SysName != "Linux" {
				return nil
			}
			if version.Compare(n.Driver.Kernel.Release, other.Driver.Kernel.Release, "<=") {
				return nil
			}
		}
		latest[n.Driver.Name] = n
		return nil