Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 912661 - dev-vcs/lazygit: builds without --version info
Summary: dev-vcs/lazygit: builds without --version info
Status: RESOLVED FIXED
Alias: None
Product: GURU
Classification: Unclassified
Component: Package issues (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Sergey Torokhov
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-20 08:22 UTC by yaogen
Modified: 2023-08-23 17:33 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description yaogen 2023-08-20 08:22:53 UTC
dev-vcs/lazygit-0.40.0 and probably previous version too builds without having --version information. 

Discovered this when I was filing a bug with lazygit and they're requesting this input, but my output is as follow:

$ lazygit --version                                                                                                                        
commit=, build date=, build source=unknown, version=unversioned, os=linux, arch=amd64, git version=2.41.0



Reproducible: Always
Comment 1 Sergey Torokhov 2023-08-21 19:24:39 UTC
Thank you for report.

The addition of version output info will be passed in "dev-vcs/lazygit-0.39.4-r1" and "dev-vcs/lazygit-0.40.2-r1"

But I don't see the reason to pass "date", "buildsource" and "commit" (but the last still maybe useful).

With the exception of very rare cases the lazygit version is equal release version for this package in GURU overlay. But it could differ with some patches and doesn't correspond any specific commit.
Comment 2 yaogen 2023-08-22 12:41:25 UTC
I'm not sure why they (lazygit folks) want this information in their issue reports.

Providing a few example outputs (that I found browsing their issues), if that would help explain the strings:

commit=367b0d331836c90c015bf0c45f88612f3d94d08a, build date=2022-07-20T09:27:56Z, build source=binaryRelease, version=0.35, os=windows, arch=amd64

commit=5e388e21c8ca6aa883dbcbe45c47f6fdd5116815, build date=2023-08-07T14:05:48Z, build source=binaryRelease, version=0.40.2, os=linux, arch=amd64, git version=2.39.2

commit=5e388e21c8ca6aa883dbcbe45c47f6fdd5116815, build date=2023-08-07T14:05:48Z, build source=binaryRelease, version=0.40.2, os=darwin, arch=amd64, git version=2.41.0

commit=v0.40.2, build date=2023-08-12T17:47:33Z, build source=binaryRelease, version=0.40.2, os=linux, arch=amd64, git version=2.41.0
Comment 3 yaogen 2023-08-22 12:57:15 UTC
I did a small experiement:

$ git clone https://github.com/jesseduffield/lazygit.git && cd lazygit
$ git checkout tags/v0.40.2
$ go build -o bin/lazygit
$ ./bin/lazygit --version
commit=5e388e21c8ca6aa883dbcbe45c47f6fdd5116815, build date=2023-08-07T14:03:45Z, build source=unknown, version=5e388e21, os=linux, arch=amd64, git version=2.41.0

Sets a lot more information, but messes up the version string.
Comment 4 yaogen 2023-08-22 13:38:09 UTC
Checked the code pgk/app/entry_point.go to see if there was any way to get the version information there. 

It should be possible to set the information through LDFLAGS, and the code will use that information instead: 
// if the version has already been set by build flags then we'll honour that.
// chances are it's something like v0.31.0 which is more informative than a
// commit hash.

The binary builds have the following -ldflags

-ldflags="-s -w -X main.version=0.40.2 -X main.commit=5e388e21c8ca6aa883dbcbe45c47f6fdd5116815 -X main.date=2023-08-07T14:05:48Z -X main.buildSource=source"

The version is known ${V}, the rest can be found with:
$ git show --no-patch --no-notes $(git reflog | head -n1 | cut -d' ' -f1)

Hope this helps, if wanting to go all the way :-)
Comment 5 Sergey Torokhov 2023-08-22 14:05:56 UTC
Please be patient ;)

The update already in dev branch:
https://gitweb.gentoo.org/repo/proj/guru.git/commit/?h=dev&id=8c55813225f3c49c6539c9f5763726dc9068cfe3
Comment 6 yaogen 2023-08-22 16:08:16 UTC
Oh, OK, thanks...
Didn't see any reference on this bug-report regarding the commit.
(or maybe I just don't understand where it is) ;)
Comment 7 Sergey Torokhov 2023-08-23 05:04:54 UTC
I assume the upstream request the `lazygit --version` info in case of using binary package  built by upstream.

So the `build date` of user system etc. could be confused.

Yes, I didn't mentioned link to guru gitweb here. I hope the merge from dev branch to master branch will be soon and updated revision will containt the version output.

But in case of any issues you could report it to upstream with mention of lazygit version of installed gento or gentoo guru package and report that origin of package is "Gentoo Guru repository". Or report it in gentoo bugzilla if it's a bug (not feature request) and I then report it to upstream. But the upstream also could ask some additional information. 

Yes, current issue is directly related to gentoo guru package and build process.
Comment 8 Larry the Git Cow gentoo-dev 2023-08-23 17:33:01 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=8c55813225f3c49c6539c9f5763726dc9068cfe3

commit 8c55813225f3c49c6539c9f5763726dc9068cfe3
Author:     Sergey Torokhov <torokhov-s-a@yandex.ru>
AuthorDate: 2023-08-21 19:19:53 +0000
Commit:     Sergey Torokhov <torokhov-s-a@yandex.ru>
CommitDate: 2023-08-21 19:19:53 +0000

    dev-vcs/lazygit: fix src_compile() and "--version" cmd output
    
    Closes: https://bugs.gentoo.org/912661
    
    Signed-off-by: Sergey Torokhov <torokhov-s-a@yandex.ru>

 dev-vcs/lazygit/{lazygit-0.39.4.ebuild => lazygit-0.39.4-r1.ebuild} | 3 ++-
 dev-vcs/lazygit/{lazygit-0.40.2.ebuild => lazygit-0.40.2-r1.ebuild} | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)