You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Daniel John Debrunner <dj...@debrunners.com> on 2004/09/03 19:33:55 UTC

Re: version scheme

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

| A build number can also be set which corresponded to the Perforce (SCM)
| global change number for Cloudscape

Does anyone know of any neat tricks to get the subversion global
revision number into an ant task?

To get the SVN number into the built jars as the build number, a script
something like this is needed

SVN_CHANGE=`some way to get revision number out of SVN`
ant -Dchangenumber=$SVN_CHANGE buildjars

This allows the full version string to reference the SVN revision number
of the corresponding code. This is obviously useful in debugging older
versions without having to resort to a version to revision number map.

e.g. partial output from sysinfo with changenumber set to 37135

- --------- Derby Information --------
[/home/djd/derby/jars/insane/derby.jar] 10.0.2.0 - (37135)


Dan.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFBOKsDIv0S4qsbfuQRAvTlAJ4/+FON9wu0POmarzM/Nq4IoNbA/ACgz23G
bR2cKVb7WmgEZL42HMrbzS4=
=ubog
-----END PGP SIGNATURE-----


Re: version scheme

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
-----BEGIN PGP SIGNED MESSAGE-----

there's also the special substitutable keyword $LastChangedRevision$,
but that only tells you the revision of the file in which the keyword
is located.

- --
#ken	P-)}

Ken Coar, Sanagendamgagwedweinini  http://Ken.Coar.Org/
Author, developer, opinionist      http://Apache-Server.Com/

"Millennium hand and shrimp!"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBQTyoJZrNPMCpn3XdAQGtWAP8DYUxc3PwfzZYAOu8sWtl70aAzmI7umje
seohXUKs+C6LV2ODq+5SQ8EGTI5NM7ZMBnqn7QutoC2EezxU34VbHB0vlh9rgHQg
JknRfIhwEyNKkMA4VUDFdPnIsotHiikgnweMkczJhpQkf6qqn3PF1DjtsPTUuZhq
urqqAHOojdM=
=qp0F
-----END PGP SIGNATURE-----

Re: version scheme

Posted by Andrew McIntyre <fu...@nonintuitive.com>.
On Sep 3, 2004, at 11:54 AM, Daniel John Debrunner wrote:
> Then we need an ant way of executing svnversion and setting
> changenumber, this is in top level build.xml file.

Attached is a patch for this. Note that this patch assumes that it is  
ok to have letters in the build number, which is not currently the  
case.  Currently,
org.apache.derby.iapi.services.info.ProductVersionHolder assumes that  
the build number will be an integer, so if your version string  
contained a letter (like the M from the version string svnversion  
supplies), the version would actually be set to -1 according to how  
NumberFormatExceptions are handled there. See  
ProductVersionHolder.java, lines 291 and 371-385.

To work with the current method which expects an integer, you could add:

<replaceregexp file="${basedir}/changenumber.properties" match="M"  
replace=""/>
<replaceregexp file="${basedir}/changenumber.properties" match="S"  
replace=""/>
<replaceregexp file="${basedir}/changenumber.properties" match="^.*:"  
replace=""/>

to the getsvnversion target to handle the possible outputs of  
svnversion which might lead to error.

Note for this patch also that if svnversion fails, the revision will be  
set to 1 (or to the last time changenumber.properties was set).

andrew



Index: build.xml
===================================================================
--- build.xml   (revision 13)
+++ build.xml   (working copy)
@@ -631,16 +631,20 @@
    <target name="buildjarsclean"  
depends="cleanjars,initjars,derbyjar,derbytoolsjar,derbynetjar,derbyloca 
lejars"/>
    <target name="buildjars"  
depends="initjars,derbyjar,derbytoolsjar,derbynetjar,derbylocalejars"/>

-  <target name="initjars" depends="setsanityname">
+  <target name="initjars" depends="setsanityname,getsvnversion">
      <property name="derby.jar.dir"  
value="${basedir}/jars/${sanity.name}"/>
      <property name="derby.jar.topdir" value="${basedir}/jars"/>
      <mkdir dir="${derby.jar.dir}"/>
      <mkdir dir="${derby.jar.dir}/lists"/>
+    <loadfile srcFile="${basedir}/changenumber.properties"
+              failonerror="false"
+              property="changenumber"/>
      <condition property="changenumber" value="1">
        <not>
          <isset property="changenumber"/>
        </not>
      </condition>
+    <echo message="Revision number set to ${changenumber}."/>
    </target>


@@ -930,6 +934,14 @@
      </condition>
    </target>

+  <target name="getsvnversion">
+    <exec executable="svnversion"
+          failifexecutionfails="no"
+          output="${basedir}/changenumber.properties">
+      <arg value="${basedir}"/>
+      <arg value="-n"/>
+    </exec>
+  </target>

    <target name="cleanjars" depends="setsanityname">
      <delete dir="${basedir}/jars/${sanity.name}"/>


Re: version scheme

Posted by Daniel John Debrunner <dj...@debrunners.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jan Hlavatý wrote:

| Daniel John Debrunner wrote:
|
|>Does anyone know of any neat tricks to get the subversion global
|>revision number into an ant task?
|>
|>To get the SVN number into the built jars as the build number, a script
|>something like this is needed
|>
|>SVN_CHANGE=`some way to get revision number out of SVN`
|>ant -Dchangenumber=$SVN_CHANGE buildjars
|
|
| You could try to run "svn info" in the root of the working copy and
parse the output,
| looking for a line starting with "Revision:".
| But do it in Java, or it wont be portable ;)

Thanks to the wonders of Google I found that the SVN command
svnversion gives a single value intended to be used as a build number.
It's even better in that it appends an M if the code has modified
versions. Derby code would need to be changed a little to handle the
build number as a string and not a number. I think the build number is
only used for display, so changing to a string should not be tricky.

Then we need an ant way of executing svnversion and setting
changenumber, this is in top level build.xml file.

Dan.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFBOL3yIv0S4qsbfuQRAs5lAJ9+TckOO++K0LMx2ZpwqFiC3hiEgACgxWMP
0A9oEJAUc1mhcFYGeXULDUQ=
=oxQZ
-----END PGP SIGNATURE-----


Re: version scheme

Posted by Jan Hlavatý <hl...@code.cz>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Daniel John Debrunner wrote:
> Does anyone know of any neat tricks to get the subversion global
> revision number into an ant task?
>
> To get the SVN number into the built jars as the build number, a script
> something like this is needed
>
> SVN_CHANGE=`some way to get revision number out of SVN`
> ant -Dchangenumber=$SVN_CHANGE buildjars

You could try to run "svn info" in the root of the working copy and parse the output,
looking for a line starting with "Revision:".
But do it in Java, or it wont be portable ;)

Jan

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iQEVAwUBQTiwEHFDePgyse5HAQIJEwf/YT8zQjh2F7cpoKCcnRvPVkl4dXpNGc03
mN8vQn55PzPlS8ay1wlzZURN2BlafX6wy4r5PrZbb9C/HC4B0RLU1Iu00KKHgCrI
MsiyIYtsz3mJTqFo97DQDYiI0TZRWvglgBwSIAp73qmpi/C2SkvFwAn+LpFAybTx
V440iZuBmm/l/LKLGgERd5nDUydfD7btIkiwu971XKbhGczn5mh3CctKsrL/6Y/s
CJ6sQZxsKO8b0rUzlaKQ3MddB2r2/u1wFnpQHfClOI/FkHR1U2RtvTMbvBlCHxdd
nb78fr7yZ+DDqxB6bcsHUZszb0RK63pUceqX1Ge9Ga+j3MlkJ0B5Cg==
=fnY2
-----END PGP SIGNATURE-----