Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Nov 2017 15:16:31 +0000 (UTC)
From:      Mathieu Arnold <mat@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r453347 - head/Mk
Message-ID:  <201711021516.vA2FGVbT000293@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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})



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