You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Kenny Leung <ke...@pobox.com> on 2007/02/16 03:22:41 UTC

How to get the version number out?

Hi All.

As part of our release process, I would like to "burn" the version  
number into the binary. I thought an easy way would be to create a  
file in the project directory with something like #define VERSION XXX  
upon export. However, there does not seem to be a post-export hook.

Any help is much appreciated.

Thanks!

-Kenny

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: How to get the version number out?

Posted by Eric Hanchrow <of...@blarg.net>.
>>>>> "Kenny" == Kenny Leung <ke...@pobox.com> writes:

    Kenny> ... a file in the project directory with something like
    Kenny> #define VERSION XXX upon export.  However, there does not
    Kenny> seem to be a post-export hook.

Have a script that chooses a revision to export (by, say, doing "svn
log"), and then passe that revision number to the "svn export"
command, _and_ creates the file with #define VERSION XXXX in it.

-- 
This movie doesn't scrape the bottom of the barrel.  This movie isn't
the bottom of the barrel.  This movie isn't below the bottom of the
barrel.  This movie doesn't deserve to be mentioned in the same
sentence with barrels.
        Roger Ebert on "Freddy Got Fingered"

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: How to get the version number out?

Posted by Andy Levy <an...@gmail.com>.
On 2/16/07, Kenny Leung <ke...@pobox.com> wrote:
> Hi Andy.
>
> I suspect this will only work with a checked-out copy of the project,
> but not an exported copy, is that correct?

According to the following text in that FAQ entry, I think you're right:

"The information you want (the *revision of your working copy*) is
available from the command svnversion;"


> On Feb 15, 2007, at 7:39 PM, Andy Levy wrote:
>
> > On 2/15/07, Kenny Leung <ke...@pobox.com> wrote:
> >> Hi All.
> >>
> >> As part of our release process, I would like to "burn" the version
> >> number into the binary. I thought an easy way would be to create a
> >> file in the project directory with something like #define VERSION XXX
> >> upon export. However, there does not seem to be a post-export hook.
> >
> > Have you seen http://subversion.tigris.org/faq.html#version-value-
> > in-source ?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: How to get the version number out?

Posted by Kenny Leung <ke...@pobox.com>.
Hi Andy.

I suspect this will only work with a checked-out copy of the project,  
but not an exported copy, is that correct?

-Kenny


On Feb 15, 2007, at 7:39 PM, Andy Levy wrote:

> On 2/15/07, Kenny Leung <ke...@pobox.com> wrote:
>> Hi All.
>>
>> As part of our release process, I would like to "burn" the version
>> number into the binary. I thought an easy way would be to create a
>> file in the project directory with something like #define VERSION XXX
>> upon export. However, there does not seem to be a post-export hook.
>
> Have you seen http://subversion.tigris.org/faq.html#version-value- 
> in-source ?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: How to get the version number out?

Posted by Andy Levy <an...@gmail.com>.
On 2/15/07, Kenny Leung <ke...@pobox.com> wrote:
> Hi All.
>
> As part of our release process, I would like to "burn" the version
> number into the binary. I thought an easy way would be to create a
> file in the project directory with something like #define VERSION XXX
> upon export. However, there does not seem to be a post-export hook.

Have you seen http://subversion.tigris.org/faq.html#version-value-in-source ?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: How to get the version number out?

Posted by Doug Goldstein <do...@monetra.com>.
Kenny Leung wrote:
> Hi All.
> 
> As part of our release process, I would like to "burn" the version 
> number into the binary. I thought an easy way would be to create a file 
> in the project directory with something like #define VERSION XXX upon 
> export. However, there does not seem to be a post-export hook.
> 
> Any help is much appreciated.
> 
> Thanks!
> 
> -Kenny
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
> 
> 

I typically add a hook to a makefile similar to this..

svnversion.h: svnversion-phony

svnversion-phony:
         @echo "#define SVNVER \""`svnversion -nc | @SED@ -e 
's/^[^:]*://' | @SED@ -e 's/M.*//'`"\"" > svnversion.h.tmp
         @cmp -s svnversion.h svnversion.h.tmp || (mv svnversion.h.tmp 
svnversion.h; echo created svnversion.h)

.PHONY: svnversion-phony

Then change BUILT_SOURCES to include svnversion.h and just include it 
where it's necessary.

This has the advantage of being automatic, the rules provided will only 
overwrite and replace the svnversion.h file if there was a 
change/difference so your dependencies are still maintained and not 
recompiled needlessly.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org