[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Adding current svn revision to source automatically

From: Mark Phippard <mphippard_at_collab.net>
Date: Tue, 16 Dec 2008 12:42:32 -0500

On Tue, Dec 16, 2008 at 9:58 AM, Kenneth Goldman <kgoldman_at_us.ibm.com> wrote:
>> > As I tried to explain above, this requires access to the svn repository
>> > at build time, right? The version never appears in the source, right?
>> > So If I create a source tarball and send it to someone, they can't
>> > build binaries.
>>
>> The FAQ answer requires access to the repository at *some* time. It
>> doesn't have to be at compile time. It can be at the time you create
>> your source tarball, if you make the call to svnversion part of your
>> process for building that tarball.
>>
>> In fact, the FAQ even states "You can incorporate it into your build
>> *or release process*". It does not explicitly state that you can only
>> use it at build time - you inferred that from your own experience &
>> perception of what's made available.
>>
>> > I think I need the global version applied to the file at commit, not at
>> > build, but I don't understand how to do that. However, it seems like
>> > such a common need that there must be a solution.
>> >
>>
>> The FAQ answer is a solution. That process isn't restricted to just
>> build or release time - you can execute that anytime you need it.
>
> Here are my two specific problems with the FAQ solution:
>
> Solution 1, adding 'svnversion' to the makefile, clearly requires
> access to the repository at build time. That's when 'make' runs.
> The globalrev is ephemeral, discarded after the build. So it won't
> work on a released tarball.

svnversion does not access the repository at all. It reports the
version of the working copy.

> Solution 2, using 'svnversion' to update a source file. gets one into
> an endless loop. 'svnversion' adds version n to the .c file. But,
> as soon as I commit, the version rolls to n+1. So my source is
> always one version behind. Further, every overall project
> build/test/commit cycle increments the program version, even when
> nothing in the program changed.

You do not have to commit the change. For example, the Subversion
release process generates all the configure script and other build
files. These are not part of the repository. The recommendation in
the FAQ is to have a "template" file that is versioned and then have
your build script use the template and svnversion to create a .h or
other file that is not stored in the repository. Your tarball
creation process could do something like this.

-- 
Thanks
Mark Phippard
http://markphip.blogspot.com/
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=985121
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2008-12-16 18:47:30 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.