db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: rev 47314 - in incubator/derby/code/trunk: . java/drda/org/apache/derby/impl/drda java/engine/org/apache/derby/iapi/services/info java/engine/org/apache/derby/impl/store/raw/log java/tools/org/apache/derby/impl/tools/sysinfo java/tools/org/apache/derby/tools
Date Mon, 27 Sep 2004 17:18:32 GMT
Author: djd
Date: Mon Sep 27 10:18:30 2004
New Revision: 47314

Modified:
   incubator/derby/code/trunk/build.xml
   incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DB2jServerImpl.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/info/ProductVersionHolder.java
   incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
   incubator/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java
   incubator/derby/code/trunk/java/tools/org/apache/derby/tools/sysinfo.java
Log:
Set Derby's build number to be the output of svnversion.


Modified: incubator/derby/code/trunk/build.xml
==============================================================================
--- incubator/derby/code/trunk/build.xml	(original)
+++ incubator/derby/code/trunk/build.xml	Mon Sep 27 10:18:30 2004
@@ -488,16 +488,20 @@
   <target name="buildjarsclean" depends="cleanjars,initjars,derbyjar,derbytoolsjar,derbynetjar"/>
   <target name="buildjars" depends="initjars,derbyjar,derbytoolsjar,derbynetjar"/>
 
-  <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"/>
-    <condition property="changenumber" value="1">
+     <loadfile srcFile="${basedir}/changenumber.properties"
+               failonerror="false"
+               property="changenumber"/>
+    <condition property="changenumber" value="???">
       <not>
         <isset property="changenumber"/>
       </not>
     </condition>
+    <echo message="Revision number set to ${changenumber}."/>
   </target>
 
 
@@ -734,6 +738,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}"/>

Modified: incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DB2jServerImpl.java
==============================================================================
--- incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DB2jServerImpl.java	(original)
+++ incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DB2jServerImpl.java	Mon
Sep 27 10:18:30 2004
@@ -154,7 +154,7 @@
 	protected static String att_extnam;
 	protected static String att_srvrlslv; 
 	protected static String prdId;
-	private static int buildNumber;
+	private static String buildNumber;
 	// we will use single or mixed, not double byte to reduce traffic on the
 	// wire, this is in keeping with JCC
 	// Note we specify UTF8 for the single byte encoding even though it can

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/info/ProductVersionHolder.java
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/info/ProductVersionHolder.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/services/info/ProductVersionHolder.java
Mon Sep 27 10:18:30 2004
@@ -122,7 +122,7 @@
 	private int minorVersion = BAD_NUMBER;
 	private int maintVersion = BAD_NUMBER;
 	private int drdaMaintVersion = BAD_NUMBER;
-	private int buildNumber = BAD_NUMBER;
+	private String buildNumber = "????";
 	private Boolean isBeta;
 
 	private ProductVersionHolder() {
@@ -141,7 +141,7 @@
 								 int minorVersion,
 								 int maintVersion,
 								 int drdaMaintVersion,
-								 int buildNumber,
+								 String buildNumber,
 								 Boolean isBeta)
 	{
 		if (productVendorName != null)
@@ -171,7 +171,7 @@
 	  @param maintVersion The least significant portion of a 3 part
 	  product version. Must be non-negative.
 	  @param drdaMaintVersion The protocol modification number for minor release.
-	  @param buildNumber The buildNumber for a product. Must be positive.
+	  @param buildNumber The buildNumber for a product. 
 	  @param isBeta true iff the product is beta.
 	  @return A valid ProductVersionHolder of null if any of the parameters
 	  provided are not valid.
@@ -185,7 +185,7 @@
 						   int minorVersion,
 						   int maintVersion,
 						   int drdaMaintVersion,
-						   int buildNumber,
+						   String buildNumber,
 						   Boolean isBeta)
 	{
 		ProductVersionHolder pvh =
@@ -288,7 +288,7 @@
 		int v2 = parseInt(p.getProperty(PropertyNames.PRODUCT_MINOR_VERSION));
 		int v3 = parseInt(p.getProperty(PropertyNames.PRODUCT_MAINT_VERSION));
 		int v4 = parseInt(p.getProperty(PropertyNames.PRODUCT_DRDA_MAINT_VERSION));
-		int bn = parseInt(p.getProperty(PropertyNames.PRODUCT_BUILD_NUMBER));
+		String bn = p.getProperty(PropertyNames.PRODUCT_BUILD_NUMBER);
 		Boolean isBeta =
 			Boolean.valueOf(p.getProperty(PropertyNames.PRODUCT_BETA_VERSION));
 		return 	getProductVersionHolder(pvn,pn,ptn,v1,v2,v3,v4,bn,isBeta);
@@ -357,8 +357,40 @@
 	/**
 	  Return the build number for this product.
 	  */
-	public int getBuildNumber() {return buildNumber;}
+	public String getBuildNumber() {return buildNumber;}
 
+    /**
+     * Return the build number as an integer if possible,
+     * mapping from the SVN number.
+     * nnnnn -> returns nnnnn
+     * nnnnnM -> returns -nnnnn indicates a modified code base
+     * nnnnn:mmmmm -> returns -nnnnn
+     * anything else -> returns -1
+    */
+    public int getBuildNumberAsInt(){
+    	if (buildNumber == null)
+    	    return -1;
+    	boolean dubiousCode = false;
+    	int offset = buildNumber.indexOf('M');
+    	if (offset == -1)
+    	    offset = buildNumber.indexOf(':');
+    	else
+    	    dubiousCode = true;
+    	if (offset == -1)
+    		offset = buildNumber.length();
+        else
+            dubiousCode = true;
+    	
+    	try {
+    		int bnai = Integer.parseInt(buildNumber.substring(0, offset));
+    		if (dubiousCode)
+    		    bnai = -bnai;
+    		return bnai;
+    	} catch (NumberFormatException nfe) 
+     	{
+     		return -1;
+    	}
+    }
 
 	/**
 	  Parse a string containing a non-negative integer. Return
@@ -426,7 +458,7 @@
 
 		return sb.toString();
 	}
-	public static String fullVersionString(int major, int minor, int maint, boolean isBeta,
int build) {
+	public static String fullVersionString(int major, int minor, int maint, boolean isBeta,
String build) {
 		StringBuffer sb = new StringBuffer();
 		sb.append(major);
 		sb.append('.');
@@ -462,7 +494,7 @@
 			sb.append(' ');
             sb.append(preRelease);
         }
-		if (build != 0) {
+		if (build != null) {
 			sb.append(" - (");
 
 			sb.append(build);
@@ -478,7 +510,7 @@
     public String getVersionBuildString(boolean withBuild)
     {
 		return ProductVersionHolder.fullVersionString(majorVersion, minorVersion, maintVersion,
isBeta(),
-			withBuild ? buildNumber : 0);
+			withBuild ? buildNumber : null);
     }
 
 	/*

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
(original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/log/LogToFile.java
Mon Sep 27 10:18:30 2004
@@ -2218,7 +2218,7 @@
 
 		// For 2.0 beta we added the build number and the isBeta indication.
 		// (5 bytes from our first spare long)
-		daos.writeInt(jbmsVersion.getBuildNumber());
+		daos.writeInt(jbmsVersion.getBuildNumberAsInt());
 		byte flags = 0;
 		if (onDiskBeta) flags |= IS_BETA_FLAG;
 		daos.writeByte(flags);

Modified: incubator/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java
==============================================================================
--- incubator/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java	(original)
+++ incubator/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java	Mon
Sep 27 10:18:30 2004
@@ -379,7 +379,7 @@
 			int major = Integer.valueOf(p.getProperty ("derby.locale.version.major")).intValue();
 			int minor = Integer.valueOf(p.getProperty ("derby.locale.version.minor")).intValue();
 			int maint = Integer.valueOf(p.getProperty ("derby.locale.version.maint")).intValue();
-			int build = Integer.valueOf(p.getProperty ("derby.locale.build.number")).intValue();
+			String build = p.getProperty ("derby.locale.build.number");
 
 			String lv = ProductVersionHolder.fullVersionString(major, minor, maint, false, build);
 
@@ -862,7 +862,7 @@
 			minor.intValue(),
 			0,
 			0,
-			build.intValue(),
+			build.toString(),
 			Boolean.FALSE);
 
 		ZipInfoProperties zip = new ZipInfoProperties(jccVersion);

Modified: incubator/derby/code/trunk/java/tools/org/apache/derby/tools/sysinfo.java
==============================================================================
--- incubator/derby/code/trunk/java/tools/org/apache/derby/tools/sysinfo.java	(original)
+++ incubator/derby/code/trunk/java/tools/org/apache/derby/tools/sysinfo.java	Mon Sep 27 10:18:30
2004
@@ -120,7 +120,7 @@
 		gets the build number for the IBM Cloudscape embedded library
 		@return the build number, or -1 if the information is not found.
 	*/
-  static public int getBuildNumber()
+  static public String getBuildNumber()
   {
     return getBuildNumber("DBMS");
   }
@@ -129,14 +129,14 @@
 		gets the build number for the specified library
 		@param genus which library to get the build number for. Valid inputs are
 			DBMS, TOOLS
-		@return the build number, or -1 if the information is not found.
+		@return the build number, or ???? if the information is not found.
 	*/
-  static public int getBuildNumber(String genus)
+  static public String getBuildNumber(String genus)
   {
         ProductVersionHolder pvh = ProductVersionHolder.getProductVersionHolderFromMyEnv(genus);
         if (pvh == null)
         {
-            return -1;
+            return "????";
         }
 
         return pvh.getBuildNumber();

Mime
View raw message