Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Jul 2017 18:09:11 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r445802 - head/Mk
Message-ID:  <201707141809.v6EI9BaI002805@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans (src committer)
Date: Fri Jul 14 18:09:11 2017
New Revision: 445802
URL: https://svnweb.freebsd.org/changeset/ports/445802

Log:
  Minor cleanup to Java version/vendor/OS validation
  
  - Use POSIX compliant expressions instead of employing GNU extensions
  (branching in BREs)
  - Simplify regex generation using make(1)'s :ts modifier
  
  PR:		220054
  Approved by:	bapt (portmgr)

Modified:
  head/Mk/bsd.java.mk

Modified: head/Mk/bsd.java.mk
==============================================================================
--- head/Mk/bsd.java.mk	Fri Jul 14 18:05:32 2017	(r445801)
+++ head/Mk/bsd.java.mk	Fri Jul 14 18:09:11 2017	(r445802)
@@ -214,44 +214,30 @@ check-makevars::
 
 # Error checking: JAVA_VERSION
 .if !defined(_JAVA_VERSION_LIST_REGEXP)
-.	for v in ${_JAVA_VERSION_LIST}
-.		if defined(_JAVA_VERSION_LIST_REGEXP)
-_JAVA_VERSION_LIST_REGEXP:=		${_JAVA_VERSION_LIST_REGEXP}\|
-.		endif
-_JAVA_VERSION_LIST_REGEXP:=		${_JAVA_VERSION_LIST_REGEXP}$v
-.	endfor
+_JAVA_VERSION_LIST_REGEXP=	${_JAVA_VERSION_LIST:C/\+/\\+/:ts|}
 .endif
 
-
 check-makevars::
-	@test ! -z "${JAVA_VERSION}" && ( ${ECHO_CMD} "${JAVA_VERSION}" | ${TR} " " "\n" | ${GREP} -q "${_JAVA_VERSION_LIST_REGEXP}" || \
+	@test ! -z "${JAVA_VERSION}" && ( ${ECHO_CMD} "${JAVA_VERSION}" | ${TR} " " "\n" | ${GREP} -Eq "${_JAVA_VERSION_LIST_REGEXP}" || \
 	(${ECHO_CMD} "${PKGNAME}: Makefile error: \"${JAVA_VERSION}\" is not a valid value for JAVA_VERSION. It should be one or more of: ${__JAVA_VERSION_LIST} (with an optional \"+\" suffix.)"; ${FALSE})) || true
 
 # Error checking: JAVA_VENDOR
 .if !defined(_JAVA_VENDOR_LIST_REGEXP)
-.	for v in ${_JAVA_VENDOR_LIST}
-.		if defined(_JAVA_VENDOR_LIST_REGEXP)
-_JAVA_VENDOR_LIST_REGEXP:=		${_JAVA_VENDOR_LIST_REGEXP}\|
-.		endif
-_JAVA_VENDOR_LIST_REGEXP:=		${_JAVA_VENDOR_LIST_REGEXP}$v
-.	endfor
+_JAVA_VENDOR_LIST_REGEXP=	${_JAVA_VENDOR_LIST:ts|}
 .endif
+
 check-makevars::
-	@test ! -z "${JAVA_VENDOR}" && ( ${ECHO_CMD} "${JAVA_VENDOR}" | ${TR} " " "\n" | ${GREP} -q "${_JAVA_VENDOR_LIST_REGEXP}" || \
+	@test ! -z "${JAVA_VENDOR}" && ( ${ECHO_CMD} "${JAVA_VENDOR}" | ${TR} " " "\n" | ${GREP} -Eq "${_JAVA_VENDOR_LIST_REGEXP}" || \
 	(${ECHO_CMD} "${PKGNAME}: Makefile error: \"${JAVA_VENDOR}\" is not a valid value for JAVA_VENDOR. It should be one or more of: ${_JAVA_VENDOR_LIST}"; \
 	${FALSE})) || true
 
 # Error checking: JAVA_OS
 .if !defined(_JAVA_OS_LIST_REGEXP)
-.	for v in ${_JAVA_OS_LIST}
-.		if defined(_JAVA_OS_LIST_REGEXP)
-_JAVA_OS_LIST_REGEXP:=		${_JAVA_OS_LIST_REGEXP}\|
-.		endif
-_JAVA_OS_LIST_REGEXP:=		${_JAVA_OS_LIST_REGEXP}$v
-.	endfor
+_JAVA_OS_LIST_REGEXP=	${_JAVA_OS_LIST:ts|}
 .endif
+
 check-makevars::
-	@test ! -z "${JAVA_OS}" && ( ${ECHO_CMD} "${JAVA_OS}" | ${TR} " " "\n" | ${GREP} -q "${_JAVA_OS_LIST_REGEXP}" || \
+	@test ! -z "${JAVA_OS}" && ( ${ECHO_CMD} "${JAVA_OS}" | ${TR} " " "\n" | ${GREP} -Eq "${_JAVA_OS_LIST_REGEXP}" || \
 	(${ECHO_CMD} "${PKGNAME}: Makefile error: \"${JAVA_OS}\" is not a valid value for JAVA_OS. It should be one or more of: ${_JAVA_OS_LIST}"; \
 	${FALSE})) || true
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707141809.v6EI9BaI002805>