I clicked send too soon. More below.
On 6/30/20 7:26 AM, Zimoch Dirk (PSI) via Core-talk wrote:
> Hi folks,
>
> I have a technical git related question. For StreamDevice, I used to update a version header file manually, but I always
> forgot to update the numbers when tagging a release. How can I do this automatically? Git has hooks, but none for tag as
> it seems (which would be also too late to be included in the tagged commit).
>
> The internet says: "No problem, simply generate the header (e.g. from 'git describe') when building your code." No
> problem indeed as long as I have the git repo. But those users that download zip files from github instead of cloning
> the repo complain now, as 'git describe' does not work for them, of course.
>
> Is there a way to generate the version header (or any other file that contains the related tag) on github when pushing
> the release, so it is included when downloading a release zip file?
I don't have a great answer to this. I'm not sure there is one.
The best I know of is the git substitutions mechanism.
eg. from README in Base
> $Format:%cD$
> $Format:%H$
https://github.com/epics-base/epics-base/blob/32ff3b2ed99bc27b9f5f876f2a9a48a29c40f2fe/README#L25-L26
and with substitution enabled
https://github.com/epics-base/epics-base/blob/32ff3b2ed99bc27b9f5f876f2a9a48a29c40f2fe/.gitattributes#L5
"git export" produces a README containing eg.
> Mon, 29 Jun 2020 21:20:05 -0700
> e4e541e55e5f22d45ac4dff787f3a22b30d43b09
The various format strings are described by 'man git-log'.
https://git-scm.com/docs/git-log
So you might in your Makefile have something like
GENVERSIONDEFAULT=$Format:%d$
Though I'm bound to say that I've not bother with this.
My strategy these days is to reduce the number of places
where I have to change a version number. Preferably to one.
This is done in Base, and eg. by a module
https://github.com/mdavidsaver/pvxs/blob/master/configure/CONFIG_PVXS_VERSION
I actually combine the two of these approaches so that the
manually created version number is accessible to user modules
both as make variables, and C macros. The VCS revision is also
captured, but only to be printed in various places.
https://github.com/mdavidsaver/pvxs/blob/651d7d18fbece66f158477761e58f7d5ca915933/src/Makefile#L37-L44
- Replies:
- AW: version headers Zimoch Dirk (PSI) via Core-talk
- References:
- version headers Zimoch Dirk (PSI) via Core-talk
- Navigate by Date:
- Prev:
Re: Problems with dbLinkIsConstant Johnson, Andrew N. via Core-talk
- Next:
Re: Problems with dbLinkIsConstant Torsten Bögershausen via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
<2020>
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: version headers Michael Davidsaver via Core-talk
- Next:
AW: version headers Zimoch Dirk (PSI) via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
<2020>
2021
2022
2023
2024
|