Automagic revision numbers with Perl Modules and SVN

Steve Bertrand steve at
Fri Jun 12 13:49:00 UTC 2009

Steve Bertrand wrote:
> Hey all,
> I've been migrating all of my projects from CVS to SVN (starting over
> from the beginning).
> All of the projects in question are Perl modules.


> Any guidance to fix the version numbering (especially to fix the FreeBSD
> package db) to make it automagic again, is very welcome:

Well, it took longer than I had hoped/expected, but I've finally got my
version automatic again. For the archives:

# cd project_dir
# svn propset svn:keywords "Revision"


%svn diff -r56
-$VERSION = sprintf "%d.%03d", q$Revision: 1.9 $ =~ /: (\d+)\.(\d+)/;

+$VERSION = sprintf "%d", q$Revision$ =~ /(\d+)/;

It took me quite a while to get that change right. Many of the examples
on the 'net did not have the sprintf(), which resulted in $VERSION == 1
no matter what. Once I did the next commit, the current revision was
inserted into 'Revision'., my desired result:

%pkg_version -v | grep Eagle


Cheers and thanks!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3233 bytes
Desc: S/MIME Cryptographic Signature
Url :

More information about the freebsd-questions mailing list