About sqSCCVersion.h

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

About sqSCCVersion.h

Igor Stasenko
 
Hello,

i was looking how to make same trick for git, to embed the revision
information into the source and found no easy solution.

Using gitattributes is powerful, but too tedious for me to set it up
fast and too much info for doing simple things. (You may look
http://progit.org/book/ch7-2.html)

So, to make it fast, i will use shell script to generate output.

Unfortunately, it makes little sense to use #define GIT 1 (in sqSCCVersion.h)
because its easier to just include generated file:

#include "vmVersionInfo.h"  // defines REVISION_STRING


static char *sourceVersionString()
{
        return REVISION_STRING;
}

Where vmVersionInfo.h contents is generated dynamically by shell script.

To extract an URL a following command does it well:

git config --get remote.origin.url

Which shows:
[hidden email]:cogvm/blessed.git

To extract commit info, i using:

git show HEAD --pretty="Commit: %H Date: %cd By: %cn <%cE>"

Which shows:
b0df6dc6902a9eb05de02782a77712d855d0422e Date: Wed Jul 20 16:22:16
2011 +0200 By: Igor Stasenko <[hidden email]>

So, i will create a script which will generate a header file with
these two lines concatenated, and then just include it into modified
sqSCCVersion.h

The problem is that i cannot put invocation of this script it into
cmake config files, because then it will work only if you check out
source from git , but not for tarballs.
So, to generate the version info file this command will run separately
on server.

The output of sourceVersionString() function will be something like that:

[hidden email]:cogvm/blessed.git Commit:
b0df6dc6902a9eb05de02782a77712d855d0422e Date: Wed Jul 20 16:22:16
2011 +0200 By: Igor Stasenko <[hidden email]>

If you have better suggestions how this string should look like
(format, fields) i am here to listen. :)

--
Best regards,
Igor Stasenko AKA sig.
Reply | Threaded
Open this post in threaded view
|

Re: About sqSCCVersion.h

Igor Stasenko

After merging codebase from svn it seems to working well:

Smalltalk getSystemAttribute: 1009
'[hidden email]:cogvm/blessed.git Commit:
b0df6dc6902a9eb05de02782a77712d855d0422e Date: Wed Jul 20 16:22:16
2011 +0200 By: Igor Stasenko <[hidden email]>'


On 21 July 2011 18:13, Igor Stasenko <[hidden email]> wrote:

> Hello,
>
> i was looking how to make same trick for git, to embed the revision
> information into the source and found no easy solution.
>
> Using gitattributes is powerful, but too tedious for me to set it up
> fast and too much info for doing simple things. (You may look
> http://progit.org/book/ch7-2.html)
>
> So, to make it fast, i will use shell script to generate output.
>
> Unfortunately, it makes little sense to use #define GIT 1 (in sqSCCVersion.h)
> because its easier to just include generated file:
>
> #include "vmVersionInfo.h"  // defines REVISION_STRING
>
>
> static char *sourceVersionString()
> {
>        return REVISION_STRING;
> }
>
> Where vmVersionInfo.h contents is generated dynamically by shell script.
>
> To extract an URL a following command does it well:
>
> git config --get remote.origin.url
>
> Which shows:
> [hidden email]:cogvm/blessed.git
>
> To extract commit info, i using:
>
> git show HEAD --pretty="Commit: %H Date: %cd By: %cn <%cE>"
>
> Which shows:
> b0df6dc6902a9eb05de02782a77712d855d0422e Date: Wed Jul 20 16:22:16
> 2011 +0200 By: Igor Stasenko <[hidden email]>
>
> So, i will create a script which will generate a header file with
> these two lines concatenated, and then just include it into modified
> sqSCCVersion.h
>
> The problem is that i cannot put invocation of this script it into
> cmake config files, because then it will work only if you check out
> source from git , but not for tarballs.
> So, to generate the version info file this command will run separately
> on server.
>
> The output of sourceVersionString() function will be something like that:
>
> [hidden email]:cogvm/blessed.git Commit:
> b0df6dc6902a9eb05de02782a77712d855d0422e Date: Wed Jul 20 16:22:16
> 2011 +0200 By: Igor Stasenko <[hidden email]>
>
> If you have better suggestions how this string should look like
> (format, fields) i am here to listen. :)
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>



--
Best regards,
Igor Stasenko AKA sig.
Reply | Threaded
Open this post in threaded view
|

Re: About sqSCCVersion.h

melkyades
 
just to document... the script to execute is in /path/to/vmsource/codegen-scripts/extract-commit-info.sh, and as its comment says, should be run from build dir, like this:

build$ ../codegen-scripts/extract-commit-info.sh 

after that, everything should work.

cheers,
Javier.

On Thu, Jul 21, 2011 at 2:03 PM, Igor Stasenko <[hidden email]> wrote:

After merging codebase from svn it seems to working well:

Smalltalk getSystemAttribute: 1009
'[hidden email]:cogvm/blessed.git Commit:
b0df6dc6902a9eb05de02782a77712d855d0422e Date: Wed Jul 20 16:22:16
2011 +0200 By: Igor Stasenko <[hidden email]>'


On 21 July 2011 18:13, Igor Stasenko <[hidden email]> wrote:
> Hello,
>
> i was looking how to make same trick for git, to embed the revision
> information into the source and found no easy solution.
>
> Using gitattributes is powerful, but too tedious for me to set it up
> fast and too much info for doing simple things. (You may look
> http://progit.org/book/ch7-2.html)
>
> So, to make it fast, i will use shell script to generate output.
>
> Unfortunately, it makes little sense to use #define GIT 1 (in sqSCCVersion.h)
> because its easier to just include generated file:
>
> #include "vmVersionInfo.h"  // defines REVISION_STRING
>
>
> static char *sourceVersionString()
> {
>        return REVISION_STRING;
> }
>
> Where vmVersionInfo.h contents is generated dynamically by shell script.
>
> To extract an URL a following command does it well:
>
> git config --get remote.origin.url
>
> Which shows:
> [hidden email]:cogvm/blessed.git
>
> To extract commit info, i using:
>
> git show HEAD --pretty="Commit: %H Date: %cd By: %cn <%cE>"
>
> Which shows:
> b0df6dc6902a9eb05de02782a77712d855d0422e Date: Wed Jul 20 16:22:16
> 2011 +0200 By: Igor Stasenko <[hidden email]>
>
> So, i will create a script which will generate a header file with
> these two lines concatenated, and then just include it into modified
> sqSCCVersion.h
>
> The problem is that i cannot put invocation of this script it into
> cmake config files, because then it will work only if you check out
> source from git , but not for tarballs.
> So, to generate the version info file this command will run separately
> on server.
>
> The output of sourceVersionString() function will be something like that:
>
> [hidden email]:cogvm/blessed.git Commit:
> b0df6dc6902a9eb05de02782a77712d855d0422e Date: Wed Jul 20 16:22:16
> 2011 +0200 By: Igor Stasenko <[hidden email]>
>
> If you have better suggestions how this string should look like
> (format, fields) i am here to listen. :)
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>



--
Best regards,
Igor Stasenko AKA sig.



--
Lic. Javier Pimás
Ciudad de Buenos Aires
Reply | Threaded
Open this post in threaded view
|

Re: About sqSCCVersion.h

Guido Chari
 
Thanks for this info...

In Unix its needs execution permissions first...

Guido

2011/9/9 Javier Pimás <[hidden email]>
 
just to document... the script to execute is in /path/to/vmsource/codegen-scripts/extract-commit-info.sh, and as its comment says, should be run from build dir, like this:

build$ ../codegen-scripts/extract-commit-info.sh 

after that, everything should work.

cheers,
Javier.

On Thu, Jul 21, 2011 at 2:03 PM, Igor Stasenko <[hidden email]> wrote:

After merging codebase from svn it seems to working well:

Smalltalk getSystemAttribute: 1009
'[hidden email]:cogvm/blessed.git Commit:
b0df6dc6902a9eb05de02782a77712d855d0422e Date: Wed Jul 20 16:22:16
2011 +0200 By: Igor Stasenko <[hidden email]>'


On 21 July 2011 18:13, Igor Stasenko <[hidden email]> wrote:
> Hello,
>
> i was looking how to make same trick for git, to embed the revision
> information into the source and found no easy solution.
>
> Using gitattributes is powerful, but too tedious for me to set it up
> fast and too much info for doing simple things. (You may look
> http://progit.org/book/ch7-2.html)
>
> So, to make it fast, i will use shell script to generate output.
>
> Unfortunately, it makes little sense to use #define GIT 1 (in sqSCCVersion.h)
> because its easier to just include generated file:
>
> #include "vmVersionInfo.h"  // defines REVISION_STRING
>
>
> static char *sourceVersionString()
> {
>        return REVISION_STRING;
> }
>
> Where vmVersionInfo.h contents is generated dynamically by shell script.
>
> To extract an URL a following command does it well:
>
> git config --get remote.origin.url
>
> Which shows:
> [hidden email]:cogvm/blessed.git
>
> To extract commit info, i using:
>
> git show HEAD --pretty="Commit: %H Date: %cd By: %cn <%cE>"
>
> Which shows:
> b0df6dc6902a9eb05de02782a77712d855d0422e Date: Wed Jul 20 16:22:16
> 2011 +0200 By: Igor Stasenko <[hidden email]>
>
> So, i will create a script which will generate a header file with
> these two lines concatenated, and then just include it into modified
> sqSCCVersion.h
>
> The problem is that i cannot put invocation of this script it into
> cmake config files, because then it will work only if you check out
> source from git , but not for tarballs.
> So, to generate the version info file this command will run separately
> on server.
>
> The output of sourceVersionString() function will be something like that:
>
> [hidden email]:cogvm/blessed.git Commit:
> b0df6dc6902a9eb05de02782a77712d855d0422e Date: Wed Jul 20 16:22:16
> 2011 +0200 By: Igor Stasenko <[hidden email]>
>
> If you have better suggestions how this string should look like
> (format, fields) i am here to listen. :)
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>



--
Best regards,
Igor Stasenko AKA sig.



--
Lic. Javier Pimás
Ciudad de Buenos Aires


Reply | Threaded
Open this post in threaded view
|

Re: About sqSCCVersion.h

Igor Stasenko

On 13 September 2011 12:20, Guido Chari <[hidden email]> wrote:
>
> Thanks for this info...
> In Unix its needs execution permissions first...

you can just run it via sh.


> Guido
>
> 2011/9/9 Javier Pimás <[hidden email]>
>>
>>
>> just to document... the script to execute is in /path/to/vmsource/codegen-scripts/extract-commit-info.sh, and as its comment says, should be run from build dir, like this:
>> build$ ../codegen-scripts/extract-commit-info.sh
>> after that, everything should work.
>> cheers,
>> Javier.
>>
>> On Thu, Jul 21, 2011 at 2:03 PM, Igor Stasenko <[hidden email]> wrote:
>>>
>>> After merging codebase from svn it seems to working well:
>>>
>>> Smalltalk getSystemAttribute: 1009
>>> '[hidden email]:cogvm/blessed.git Commit:
>>> b0df6dc6902a9eb05de02782a77712d855d0422e Date: Wed Jul 20 16:22:16
>>> 2011 +0200 By: Igor Stasenko <[hidden email]>'
>>>
>>>
>>> On 21 July 2011 18:13, Igor Stasenko <[hidden email]> wrote:
>>> > Hello,
>>> >
>>> > i was looking how to make same trick for git, to embed the revision
>>> > information into the source and found no easy solution.
>>> >
>>> > Using gitattributes is powerful, but too tedious for me to set it up
>>> > fast and too much info for doing simple things. (You may look
>>> > http://progit.org/book/ch7-2.html)
>>> >
>>> > So, to make it fast, i will use shell script to generate output.
>>> >
>>> > Unfortunately, it makes little sense to use #define GIT 1 (in sqSCCVersion.h)
>>> > because its easier to just include generated file:
>>> >
>>> > #include "vmVersionInfo.h"  // defines REVISION_STRING
>>> >
>>> >
>>> > static char *sourceVersionString()
>>> > {
>>> >        return REVISION_STRING;
>>> > }
>>> >
>>> > Where vmVersionInfo.h contents is generated dynamically by shell script.
>>> >
>>> > To extract an URL a following command does it well:
>>> >
>>> > git config --get remote.origin.url
>>> >
>>> > Which shows:
>>> > [hidden email]:cogvm/blessed.git
>>> >
>>> > To extract commit info, i using:
>>> >
>>> > git show HEAD --pretty="Commit: %H Date: %cd By: %cn <%cE>"
>>> >
>>> > Which shows:
>>> > b0df6dc6902a9eb05de02782a77712d855d0422e Date: Wed Jul 20 16:22:16
>>> > 2011 +0200 By: Igor Stasenko <[hidden email]>
>>> >
>>> > So, i will create a script which will generate a header file with
>>> > these two lines concatenated, and then just include it into modified
>>> > sqSCCVersion.h
>>> >
>>> > The problem is that i cannot put invocation of this script it into
>>> > cmake config files, because then it will work only if you check out
>>> > source from git , but not for tarballs.
>>> > So, to generate the version info file this command will run separately
>>> > on server.
>>> >
>>> > The output of sourceVersionString() function will be something like that:
>>> >
>>> > [hidden email]:cogvm/blessed.git Commit:
>>> > b0df6dc6902a9eb05de02782a77712d855d0422e Date: Wed Jul 20 16:22:16
>>> > 2011 +0200 By: Igor Stasenko <[hidden email]>
>>> >
>>> > If you have better suggestions how this string should look like
>>> > (format, fields) i am here to listen. :)
>>> >
>>> > --
>>> > Best regards,
>>> > Igor Stasenko AKA sig.
>>> >
>>>
>>>
>>>
>>> --
>>> Best regards,
>>> Igor Stasenko AKA sig.
>>
>>
>>
>> --
>> Lic. Javier Pimás
>> Ciudad de Buenos Aires
>>
>
>
>



--
Best regards,
Igor Stasenko AKA sig.