Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show git head sha in sysinfo output #279

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
sysinfo: Display git head sha1
Now Vinegar is built with head's latest commit sha, which is shown in sysinfo's output. 
If the sha can't be determined (for instance, if vinegar was built from a tarball with no git info), it's displayed as N/A
jrelvas-ipc committed Nov 22, 2023
commit 79f471a5d92866410dac6096235c176e27447168
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -9,9 +9,10 @@ FLATPAK = io.github.vinegarhq.Vinegar

GO = go
GO_LDFLAGS = -s -w
GIT_HEAD = $(shell git log -1 --pretty=format:"%H")

VINEGAR_ICONPATH = $(ICONPREFIX)/64x64/apps/$(FLATPAK).png
VINEGAR_LDFLAGS = $(GO_LDFLAGS) -X main.BinPrefix=$(BINPREFIX) -X main.Version=$(VERSION)
VINEGAR_LDFLAGS = $(GO_LDFLAGS) -X main.BinPrefix=$(BINPREFIX) -X main.Version=$(VERSION) -X main.GitHead=$(GIT_HEAD)
VINEGAR_GOFLAGS = --tags nowayland,novulkan

all: vinegar robloxmutexer.exe
11 changes: 9 additions & 2 deletions cmd/vinegar/vinegar.go
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ import (
var (
BinPrefix string
Version string
GitHead string
)

func usage() {
@@ -130,21 +131,27 @@ func Delete() {
}

func Sysinfo(pfx *wine.Prefix) {
fmtHead := GitHead

if fmtHead == "" {
fmtHead = "N/A"
}

cmd := pfx.Wine("--version")
cmd.Stdout = nil // required for Output()
ver, err := cmd.Output()
if err != nil {
log.Fatal(err)
}

info := `* Vinegar: %s
info := `* Vinegar: %s (%s)
* Distro: %s
* Processor: %s
* Supports AVX: %t
* Kernel: %s
* Wine: %s`

fmt.Printf(info, Version, sysinfo.Distro, sysinfo.CPU, sysinfo.HasAVX, sysinfo.Kernel, ver)
fmt.Printf(info, Version, fmtHead, sysinfo.Distro, sysinfo.CPU, sysinfo.HasAVX, sysinfo.Kernel, ver)
if sysinfo.InFlatpak {
fmt.Println("* Flatpak: [x]")
}