Thread: JDBC build patches

JDBC build patches

From
Peter Eisentraut
Date:
These are the follow-up patches to Peter Mount's recent Java build
improvements.

* implement 'make uninstall' for the java directories

* pick up the version information from Makefile.global

* honour the default port as specified to configure

* allow building outside the source tree
(This doesn't actually work, because Ant always puts the build dir
relative to the source dir, but at least the whole thing will proceed
smoothly when the rest of the tree builds this way.)

I'd install these patches soon unless someone objects.

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/

Attachment

Re: JDBC build patches

From
Peter Mount
Date:
At 23:42 09/03/01 +0100, Peter Eisentraut wrote:
>These are the follow-up patches to Peter Mount's recent Java build
>improvements.
>
>* implement 'make uninstall' for the java directories

What's the difference between uninstall and clean?

>* pick up the version information from Makefile.global

Just need to add a could of -D parameters to the Makefile in the jdbc
directory.

ie:
         ant -Dmajor=8 -Dminor=2

that would set the version to be 8.2

>* honour the default port as specified to configure

Hmm, not a good idea. The driver should be as globally useable (part of
write once run anywhere), so this would be pretty disasterous.

So far our standard has been to use 5432 if no port is supplied.


>* allow building outside the source tree
>(This doesn't actually work, because Ant always puts the build dir
>relative to the source dir, but at least the whole thing will proceed
>smoothly when the rest of the tree builds this way.)

You can by passing the base dir in the ant command line using -D

ie:

ant -Ddest=/tmp/dest -Djars=/tmp/jars

would build unti /tmp/dest and put the jars under /tmp/jars

Peter


Re: JDBC build patches

From
Peter Eisentraut
Date:
Peter Mount writes:

> What's the difference between uninstall and clean?

'clean' undoes 'all', 'uninstall' undoes 'install'.

> >* honour the default port as specified to configure
>
> Hmm, not a good idea. The driver should be as globally useable (part of
> write once run anywhere), so this would be pretty disasterous.

ISTM that if the user actually goes through the trouble of building the
driver himself (as opposed to downloading the jar file) as well as
configuring with a non-standard port (as opposed to configuring the port
at runtime) he probably wants the JDBC driver in on that deal.  It also
seems unlikely that he would take this driver and send it to some random
person to make a point about "run anywhere".

> So far our standard has been to use 5432 if no port is supplied.

It's still this way.  As I said, only people that use configure
--with-pgport see any change, and those people know what they're getting
into.

> >* allow building outside the source tree
> >(This doesn't actually work, because Ant always puts the build dir
> >relative to the source dir, but at least the whole thing will proceed
> >smoothly when the rest of the tree builds this way.)
>
> You can by passing the base dir in the ant command line using -D
> ant -Ddest=/tmp/dest -Djars=/tmp/jars
> would build unti /tmp/dest and put the jars under /tmp/jars

That's what I thought, but for some reason it always appends the path to
the current directory, even if it's absolute.  Might be an old version of
Ant.

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


Re: JDBC build patches

From
Peter Mount
Date:
At 17:47 12/03/01 +0100, Peter Eisentraut wrote:
>Peter Mount writes:
>
> > What's the difference between uninstall and clean?
>
>'clean' undoes 'all', 'uninstall' undoes 'install'.

Ah ok.


> > >* honour the default port as specified to configure
> >
> > Hmm, not a good idea. The driver should be as globally useable (part of
> > write once run anywhere), so this would be pretty disasterous.
>
>ISTM that if the user actually goes through the trouble of building the
>driver himself (as opposed to downloading the jar file) as well as
>configuring with a non-standard port (as opposed to configuring the port
>at runtime) he probably wants the JDBC driver in on that deal.  It also
>seems unlikely that he would take this driver and send it to some random
>person to make a point about "run anywhere".

True. I just didn't want there to be a rogue driver with a different port.
Over time I've kept the driver pretty clean on that front (been one of the
goals). As long as they understand the driver is unique to them, it
shouldn't catch anyone out.


> > So far our standard has been to use 5432 if no port is supplied.
>
>It's still this way.  As I said, only people that use configure
>--with-pgport see any change, and those people know what they're getting
>into.

Perhaps a message saying this (or even in the version strings within JDBC).


> > >* allow building outside the source tree
> > >(This doesn't actually work, because Ant always puts the build dir
> > >relative to the source dir, but at least the whole thing will proceed
> > >smoothly when the rest of the tree builds this way.)
> >
> > You can by passing the base dir in the ant command line using -D
> > ant -Ddest=/tmp/dest -Djars=/tmp/jars
> > would build unti /tmp/dest and put the jars under /tmp/jars
>
>That's what I thought, but for some reason it always appends the path to
>the current directory, even if it's absolute.  Might be an old version of
>Ant.

Might be, I'll check.

There is a nice little gotcha with Cygwin, but then that's the problem of
Win32 IMHO :-)

Peter


Re: JDBC build patches

From
Peter Eisentraut
Date:
Peter Mount writes:

> > > So far our standard has been to use 5432 if no port is supplied.
> >
> >It's still this way.  As I said, only people that use configure
> >--with-pgport see any change, and those people know what they're getting
> >into.
>
> Perhaps a message saying this (or even in the version strings within JDBC).

Version string sounds okay.  A message during the build would probably get
lost.

How about this patch:

diff -u -r1.5 Driver.java.in
--- Driver.java.in      2001/03/11 11:07:01     1.5
+++ Driver.java.in      2001/03/14 21:47:09
@@ -214,7 +214,13 @@
      */
     public static String getVersion()
     {
-       return "@VERSION@";
+        String version = "@VERSION@";
+       String defport = defaultPort();
+
+        if (defport == "5432")
+            return version;
+        else
+            return version + " (default port " + defport + ")";
     }

   /**
@@ -350,8 +356,13 @@
    * @return the port number portion of the URL or -1 if no port was specified
    */
   public int port()
+  {
+    return Integer.parseInt(props.getProperty("PGPORT", defaultPort()));
+  }
+
+  private String defaultPort()
   {
-    return Integer.parseInt(props.getProperty("PGPORT","@DEF_PGPORT@"));
+    return "@DEF_PGPORT@";
   }

   /**

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/