[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: empath
From:       Graham TerMarsch <gtermars () home ! com>
Date:       2000-01-05 22:52:50
[Download RAW message or body]

Sirtaj Singh Kang wrote:
> On Wed, Jan 05, 2000 at 04:01:32PM +0100, Dirk A. Mueller wrote:
> [snip]
> > so every commit needs updating the version.h. You an me know that this is
> > never the case (even ChangeLog's are normally not updated in KDE CVS).
> 
> I'd really like to know a better way to automatically maintain a version
> number for an application (not a file!) using CVS. I've thought about
> this for a long time and can't come up with one.
> 
> Perhaps one way is to "autocommit" one file every time a change occurs in
> the repository and use the version number of that file as the application
> version. It sounds pretty unwieldly, and I'm not sure it's possibly with
> CVS.

If it was a Perl script then I'd be able to tell you how to get the
version number based on a CVS revision.  Unfortunately, as for having
something build that for you automatically for C/C++, I'm not sure what
all I could say that'd be useful.  Only thing that comes to mind is if
you have a small 'version number' Perl script that holds the version
number within it, and when run generates a "version_num.h" file that can
be included within your app.  Shouldn't be hard to tie something like
that into the build process either.

FWIW, in Perl you'd want to do something like:

$VERSION = do {
    my @r = q$Revision:$ =~ /\d+/g;
    sprintf '%d.' . '%02d' x $#r, @r;
};
open( FOUT, ">version_num.h" );
print FOUT "#define VERSION $VERSION\n";
close( FOUT );

Trick to this working is that '$Revision:$' gets updated on each CVS
commit and the rest of the 'do{...}' loop yanks out the numbers for
you.  Hope that helps.

-- 
Graham TerMarsch

// -----------------------------------------------------------------
// If there are epigrams, there must be meta-epigrams.   
// -----------------------------------------------------------------

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic