FS#55748 - [stack] use git info for --version

Attached to Project: Community Packages
Opened by Michael Sloan (mgsloan) - Monday, 25 September 2017, 21:50 GMT
Last edited by Toolybird (Toolybird) - Tuesday, 04 April 2023, 23:42 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Felix Yan (felixonmars)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Hi! I'm one of the maintainers / authors of the stack build tool. Not currently an arch user, so this is not a user bug report. From https://stackoverflow.com/questions/46288963/custom-snapshots-with-stack-1-5-1/46289394 , I became aware that arch is releasing stack builds lack git version. I took a look at the build script here https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/stack , and it mostly seems reasonable. It sets the "disable-git-info" to false. Something to note is that the `-f-FLAG` arguments are unnecessary - they already default to false!

Is it not being built in a checked out git repo? It'd be nice to have this information so that it's clear what version of stack people are using.

Also considering making it easier to notice that arch's version is not the released version. Currently stack's master branch uses the same version as the last stable release. See this issue I've just opened - https://github.com/commercialhaskell/stack/issues/3455

This task depends upon

Closed by  Toolybird (Toolybird)
Tuesday, 04 April 2023, 23:42 GMT
Reason for closing:  Fixed
Additional comments about closing:  See comments
Comment by Eli Schwartz (eschwartz) - Monday, 25 September 2017, 22:52 GMT
  • Field changed: Task Type (Bug Report → Feature Request)
  • Field changed: Summary ([haskell-stack] → [stack] use git info for --version)
  • Field changed: Severity (Medium → Low)
If it's not a bug... then it's a feature request!

Also see the link at the top of every page on the bugtracker, reproduced for your convenience: http://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines
Note the section on Severity.
Also note the section on writing a Summary (and note that we have a "stack" package, not a "haskell-stack" package).
Comment by Eli Schwartz (eschwartz) - Monday, 25 September 2017, 22:59 GMT
Some projects set the internal version to ${release}-dev after they tag releases, you could consider doing that instead of using a nonexistent release numbering.
Comment by Felix Yan (felixonmars) - Tuesday, 05 December 2017, 19:05 GMT
@mgsloan Sorry for the very late reply.

You are right - the package is not built in a checkout out git repo, but a github archive (for checksums / reproducible builds). I usually update the package version to indicate that it's not the same version. Please let me know if there is an easy way to enable git info, thanks!
Comment by Ivy Foster (escondida) - Thursday, 10 October 2019, 23:59 GMT
mgsloan, is this still something you'd like to see implemented? If so, how do you recommend the packager get the git info from the github release tarball?
Comment by Michael Sloan (mgsloan) - Friday, 11 October 2019, 02:52 GMT
Hi! Personally I am relatively neutral about this as I no longer maintain stack.

The easiest way to include the git info would be to build it from within the git repository. There is compiletime code that queries the git repo info. Otherwise, you could consider manually patching https://github.com/commercialhaskell/stack/blob/master/src/main/BuildInfo.hs#L74 using info from "git rev-list -n 1 HEAD" for the sha of head and "git rev-list --all --count" for commit count.
Comment by Toolybird (Toolybird) - Tuesday, 04 April 2023, 23:42 GMT
This seems to have been fixed along the way because IIUC, it's now being built from a git checkout and I'm seeing a git revision in the version info:

$ stack --version
Version 2.7.5, Git revision ba147e6f59b2da75b1beb98b1888cce97f7032b1 (dirty) (8407 commits) x86_64
Compiled with:
<...>

Loading...