Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jun 2009 07:00:53 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Steve Bertrand <steve@ibctech.ca>
Cc:        "freebsd-questions@freebsd.org Questions -" <freebsd-questions@freebsd.org>
Subject:   Re: Automagic revision numbers with Perl Modules and SVN
Message-ID:  <4A309D95.8020109@infracaninophile.co.uk>
In-Reply-To: <4A304AD3.10109@ibctech.ca>
References:  <4A304AD3.10109@ibctech.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigE6353C696CDAAD1EAB6A3D0D
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

Steve Bertrand wrote:

> Any guidance to fix the version numbering (especially to fix the FreeBS=
D
> package db) to make it automagic again, is very welcome:
>=20
>=20
> %svn diff -r56 EagleUser.pm
> Index: EagleUser.pm
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- EagleUser.pm        (revision 56)
> +++ EagleUser.pm        (working copy)
> @@ -13,7 +13,7 @@
>  @EXPORT =3D qw(
>=20
>  );
> -$VERSION =3D sprintf "%d.%03d", q$Revision: 1.9 $ =3D~ /: (\d+)\.(\d+)=
/;

^^^^ This takes a version number like 1.9 (ie. a string of digits contain=
ing
one decimal point) and converts it to 1.009

> +$VERSION =3D (q$Revision: 1.9 $ =3D~ /: (\d+)\.(\d+)/;

^^^^ whereas this just extracts the number from the revision string and
uses it as is -- ie. 1.9

I believe that svn will update $Revision$ keywords in source files (or it=

has some similar function which only differs in the details), but I could=
 be
wrong, and it is entirely possible that the revision numbers will behave
differently -- svn keeping a repository wide version and cvs keeping a ve=
rsion
per file.  Consult the svn documentation on how to embed the version numb=
er
into the file -- once that is working, producing a perl one-liner to init=
ialise
$VERSION will be pretty easy.

Assuming this is from a standard module using Module::Build or
ExtUtils::MakeMaker you should check the Makefile.PL at the top
level.  In there if you're using Module::Build it should say something li=
ke:

  version_from   lib/EagleUser.pm

(although the path may differ).  This extracts the value of $VERSION=20
from the named .pm file and uses it as the overall module version. Assumi=
ng
your second line, you'll end up with a package name like bsdpan-EagelUser=
-1.9
(ExtUtils::MakeMaker works similarly).  If you're desperate, you can
override the setting by patching the Makefile but that doesn't help at al=
l
in your aim of having the version number update dynamically.

The convention about padding version strings with leading zeros seems
to have come and gone in the perl world.  I'm not at all sure what the
current recognised best practice is.

	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW


--------------enigE6353C696CDAAD1EAB6A3D0D
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEAREIAAYFAkownZ4ACgkQ8Mjk52CukIwV+QCfYvc9OM7WOKGTSdBCfnvRAaPj
mj0Anjw/pdG5UqH4EdMjNMqW8KthP1C6
=zSqP
-----END PGP SIGNATURE-----

--------------enigE6353C696CDAAD1EAB6A3D0D--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A309D95.8020109>