From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Apr 19 15:50:34 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1959A16A404 for ; Wed, 19 Apr 2006 15:50:34 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id ECCB943D75 for ; Wed, 19 Apr 2006 15:50:20 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k3JFoFXQ065506 for ; Wed, 19 Apr 2006 15:50:15 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k3JFoFZD065503; Wed, 19 Apr 2006 15:50:15 GMT (envelope-from gnats) Resent-Date: Wed, 19 Apr 2006 15:50:15 GMT Resent-Message-Id: <200604191550.k3JFoFZD065503@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jean-Baptiste Quenot Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EA54516A487; Wed, 19 Apr 2006 15:45:45 +0000 (UTC) (envelope-from jbq@anyware-tech.com) Received: from caraldi.com (195-13-58-165.oxyd.net [195.13.58.165]) by mx1.FreeBSD.org (Postfix) with ESMTP id 428C343D5A; Wed, 19 Apr 2006 15:45:41 +0000 (GMT) (envelope-from jbq@anyware-tech.com) Received: from vision.anyware (10.21.96-84.rev.gaoland.net [84.96.21.10]) by caraldi.com (Postfix) with ESMTP id 71816620C; Wed, 19 Apr 2006 17:45:40 +0200 (CEST) Received: by vision.anyware (Postfix, from userid 1021) id 1B3686173; Wed, 19 Apr 2006 17:45:42 +0200 (CEST) Message-Id: <20060419154542.1B3686173@vision.anyware> Date: Wed, 19 Apr 2006 17:45:42 +0200 (CEST) From: Jean-Baptiste Quenot To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: java@FreeBSD.org Subject: ports/96050: Allow java/javavmwrapper to report the location of the JVM X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Apr 2006 15:50:34 -0000 >Number: 96050 >Category: ports >Synopsis: Allow java/javavmwrapper to report the location of the JVM >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Wed Apr 19 15:50:15 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Jean-Baptiste Quenot >Release: FreeBSD 5.5-PRERELEASE i386 >Organization: >Environment: System: FreeBSD vision.anyware 5.5-PRERELEASE FreeBSD 5.5-PRERELEASE #1: Thu Mar 9 19:20:53 CET 2006 jbq@vision.anyware:/usr/obj/usr/src/sys/VISION i386 >Description: Please see discussion at http://lists.freebsd.org/pipermail/freebsd-java/2006-April/005152.html The Java ports infrastructure provides ${JAVA_HOME} and ${JAVA} on build-time to a port's Makefile, but it would be great to set the Java version requirement on a per-port basis in the rc flags. This requires to get JAVA_HOME and java executable path from javavmwrapper at runtime. The idea is to make javavm recognize two special environment variables: JAVAVM_PRINT_JAVA_HOME When set, find the best suitable JVM and print the corresponding value of JAVA_HOME instead of executing the java program JAVAVM_PRINT_JAVA_PROGRAM When set, find the best suitable JVM and print the path of the Java program instead of executing it For this to work correctly, we need javavm to stop upon failure. Until now, when the java program cannot be exec-uted, javavm issues a warning and goes on to the next JVM. Thanks in advance! >How-To-Repeat: >Fix: diff -ru javavmwrapper.orig/src/javavm.1 javavmwrapper/src/javavm.1 --- javavmwrapper.orig/src/javavm.1 Tue Apr 19 00:03:27 2005 +++ javavmwrapper/src/javavm.1 Wed Apr 19 17:32:22 2006 @@ -124,6 +124,12 @@ .Ql 1.5 and .Ql 1.5+ . +.It Ev JAVAVM_PRINT_JAVA_HOME +When set, find the best suitable JVM and print the corresponding value of +JAVA_HOME instead of executing the java program. +.It Ev JAVAVM_PRINT_JAVA_PROGRAM +When set, find the best suitable JVM and print the path of the Java program +instead of executing it. .El .Sh FILES .Bl -tag -width indent diff -ru javavmwrapper.orig/src/javavmwrapper.sh javavmwrapper/src/javavmwrapper.sh --- javavmwrapper.orig/src/javavmwrapper.sh Fri Nov 4 00:04:40 2005 +++ javavmwrapper/src/javavmwrapper.sh Wed Apr 19 17:29:22 2006 @@ -6,6 +6,8 @@ # They can then be selected from based on environment variables and the # configuration file. # +# Please have a look at the javavm(1) man page for more information. +# # ---------------------------------------------------------------------------- # "THE BEER-WARE LICENSE" (Revision 42, (c) Poul-Henning Kamp): # Maxim Sobolev wrote this file. As long as you retain @@ -43,13 +45,23 @@ tryJavaCommand () { # Check for the command being executable and exec it if so. if [ -x "${1}" ]; then - if [ ! -z "${SAVE_PATH}" ]; then - export PATH=${SAVE_PATH} + if [ -z "$JAVAVM_PRINT_JAVA_HOME" -a -z "$JAVAVM_PRINT_JAVA_PROGRAM" ] ; then + if [ ! -z "${SAVE_PATH}" ]; then + export PATH=${SAVE_PATH} + fi + + exec "${@}" + echo "${IAM}: error: couldn't run specified Java command - \"${1}\"" >&2 + exit 1 + else + if [ -n "$JAVAVM_PRINT_JAVA_HOME" ] ; then + echo "${JAVA_HOME}" + else + echo "${@}" + fi + exit 0 fi - exec "${@}" fi - - echo "${IAM}: warning: couldn't run specified Java command - \"${1}\"" >&2 } # >Release-Note: >Audit-Trail: >Unformatted: