Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Oct 2012 02:11:29 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r306536 - in head/java/javavmwrapper: . files
Message-ID:  <201210280211.q9S2BTOW006821@svn.freebsd.org>

Next in thread | Raw E-Mail | Index | Archive | Help
Author: jkim
Date: Sun Oct 28 02:11:29 2012
New Revision: 306536
URL: http://svn.freebsd.org/changeset/ports/306536

Log:
  - Ignore bootstrap-openjdk when we automatically register existing JVMs.
  - Make sure to destroy all symlinks pointing to ${PREFIX}/bin/javavm and
  ${PREFIX}/etc/javavms when we deinstall the package.
  
  Reviewed by:	glewis (maintainer)
  Feature safe:	yes

Modified:
  head/java/javavmwrapper/Makefile
  head/java/javavmwrapper/files/pkg-install.in
  head/java/javavmwrapper/pkg-deinstall

Modified: head/java/javavmwrapper/Makefile
==============================================================================
--- head/java/javavmwrapper/Makefile	Sun Oct 28 00:57:29 2012	(r306535)
+++ head/java/javavmwrapper/Makefile	Sun Oct 28 02:11:29 2012	(r306536)
@@ -1,14 +1,11 @@
-# New ports collection makefile for:	javavmwrapper
-# Date created:				10 June 2000
-# Whom:					Maxim Sobolev <sobomax@FreeBSD.org>
-#
+# Created by:	Maxim Sobolev <sobomax@FreeBSD.org>
 # $FreeBSD$
 #
 # This port is self contained in the src directory.
-#
 
 PORTNAME=	javavmwrapper
 PORTVERSION=	2.4
+PORTREVISION=	1
 CATEGORIES=	java
 MASTER_SITES=	# none
 DISTFILES=	# none
@@ -53,10 +50,10 @@ do-configure:
 do-install:
 	${INSTALL_SCRIPT} ${WRKDIR}/classpath.sh ${PREFIX}/bin/classpath
 	${INSTALL_SCRIPT} ${WRKDIR}/javavmwrapper.sh ${PREFIX}/bin/javavm
-	${LN} -sf ${PREFIX}/bin/javavm ${PREFIX}/bin/registervm
-	${LN} -sf ${PREFIX}/bin/javavm ${PREFIX}/bin/unregistervm
 	${LN} -sf ${PREFIX}/bin/javavm ${PREFIX}/bin/checkvms
 	${LN} -sf ${PREFIX}/bin/javavm ${PREFIX}/bin/manvm
+	${LN} -sf ${PREFIX}/bin/javavm ${PREFIX}/bin/registervm
+	${LN} -sf ${PREFIX}/bin/javavm ${PREFIX}/bin/unregistervm
 .for _man in checkvms.1 javavm.1 manvm.1 registervm.1
 	${INSTALL_MAN} ${WRKDIR}/${_man} ${MAN1PREFIX}/man/man1
 .endfor

Modified: head/java/javavmwrapper/files/pkg-install.in
==============================================================================
--- head/java/javavmwrapper/files/pkg-install.in	Sun Oct 28 00:57:29 2012	(r306535)
+++ head/java/javavmwrapper/files/pkg-install.in	Sun Oct 28 02:11:29 2012	(r306536)
@@ -21,9 +21,14 @@ else
 fi
 
 # Ensure all JDKs and JREs are installed
-for jvm in "${LOCALBASE}"/*jdk* "${LOCALBASE}"/*jre*; do
-    if [ -x "${jvm}/bin/java" ]; then
-        "${PKG_PREFIX}"/bin/registervm "${jvm}/bin/java" > /dev/null 2>&1
+_excl_dirs='bootstrap-openjdk'
+_find_expr='-depth 2 -regex .*/bin/java'
+for dir in ${_excl_dirs}; do
+    _find_expr="${_find_expr} ! -regex ${dir}/bin/java"
+done
+for jvm in `cd "${LOCALBASE}" && find *jdk* *jre* ${_find_expr}`; do
+    if [ -x "${LOCALBASE}/${jvm}" ]; then
+        "${PKG_PREFIX}"/bin/registervm "${LOCALBASE}/${jvm}" > /dev/null 2>&1
     fi
 done
 

Modified: head/java/javavmwrapper/pkg-deinstall
==============================================================================
--- head/java/javavmwrapper/pkg-deinstall	Sun Oct 28 00:57:29 2012	(r306535)
+++ head/java/javavmwrapper/pkg-deinstall	Sun Oct 28 02:11:29 2012	(r306536)
@@ -21,6 +21,11 @@ if [ -f "${OPTION_CONF}" -a -f "${OPTION
 	fi
 fi
 
+# Destroy the symbolic links that were created for every executable for a VM.
+find -L ${PKG_PREFIX}/bin -samefile ${PKG_PREFIX}/bin/javavm \
+    \! -name checkvms \! -name javavm \! -name manvm \
+    \! -name registervm \! -name unregistervm | xargs rm -f
+
 # The configuration file
 CONF="${PKG_PREFIX}/etc/javavms"
 
@@ -35,23 +40,7 @@ if [ ! -r "${CONF}" ]; then
     exit 1
 fi
 
-# Destroy the symbolic links that were created for every executable for a VM.
-cat "${CONF}" | \
-(
-while read JAVAVM; do
-    VM=`echo "${JAVAVM}" | sed -E 's|[[:space:]]*#.*||' 2>/dev/null`
-    JAVA_HOME=`dirname "${VM}"`
-    JAVA_HOME=`dirname "${JAVA_HOME}"`
-    for exe in "${JAVA_HOME}"/bin/* "${JAVA_HOME}"/jre/bin/*; do
-        exe=`basename "${exe}"`
-        if [ -L "${PKG_PREFIX}/bin/${exe}" -a \
-             "`ls -ld "${PKG_PREFIX}/bin/${exe}" 2>/dev/null | \
-               awk '/->/{print $NF;exit 0}END{exit 1}'`" = \
-             "${PKG_PREFIX}/bin/javavm" ]; then
-            rm "${PKG_PREFIX}/bin/${exe}"
-        fi
-    done;
-done;
-)
+# Remove the configuration file.
+rm -f "${CONF}"
 
 exit 0



Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?201210280211.q9S2BTOW006821>