svn commit: r453347 - head/Mk

Mathieu Arnold mat at FreeBSD.org
Thu Nov 2 15:16:32 UTC 2017


Author: mat
Date: Thu Nov  2 15:16:31 2017
New Revision: 453347
URL: https://svnweb.freebsd.org/changeset/ports/453347

Log:
  Add a check for options names.
  
  They must be all uppercase, so that they do not conflict with flavors
  that are lowercase.
  
  Reviewed by:	bapt
  Sponsored by:	Absolight
  Differential Revision:	https://reviews.freebsd.org/D12810

Modified:
  head/Mk/bsd.port.mk   (contents, props changed)

Modified: head/Mk/bsd.port.mk
==============================================================================
--- head/Mk/bsd.port.mk	Thu Nov  2 13:47:15 2017	(r453346)
+++ head/Mk/bsd.port.mk	Thu Nov  2 15:16:31 2017	(r453347)
@@ -4659,6 +4659,24 @@ ${_t}:
 
 .if !target(pre-check-config)
 pre-check-config:
+_CHECK_OPTIONS_NAMES=	OPTIONS_DEFINE
+_CHECK_OPTIONS_NAMES+=	${OPTIONS_GROUP:S/^/OPTIONS_GROUP_/}
+_CHECK_OPTIONS_NAMES+=	${OPTIONS_MULTI:S/^/OPTIONS_MULTI_/}
+_CHECK_OPTIONS_NAMES+=	${OPTIONS_RADIO:S/^/OPTIONS_RADIO_/}
+_CHECK_OPTIONS_NAMES+=	${OPTIONS_SINGLE:S/^/OPTIONS_SINGLE_/}
+.for var in ${_CHECK_OPTIONS_NAMES}
+.  if defined(${var})
+.    for o in ${${var}}
+.      if ${o:C/[-_[:upper:][:digit:]]//g}
+OPTIONS_BAD_NAMES+=	${o}
+.      endif
+.    endfor
+.  endif
+.endfor
+.if defined(OPTIONS_BAD_NAMES) && !empty(OPTIONS_BAD_NAMES)
+DEV_WARNING+=	"These options name have characters outside of [-_A-Z0-9]:"
+DEV_WARNING+=	"${OPTIONS_BAD_NAMES:O:u}"
+.endif
 .for single in ${OPTIONS_SINGLE}
 .  for opt in ${OPTIONS_SINGLE_${single}}
 .    if empty(ALL_OPTIONS:M${single}) || !empty(PORT_OPTIONS:M${single})


More information about the svn-ports-all mailing list