PERFORCE change 145401 for review

Alejandro Pulver alepulver at FreeBSD.org
Fri Jul 18 02:46:38 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=145401

Change 145401 by alepulver at alepulver_deimos on 2008/07/18 02:46:00

	- Update README
	- Remove LICENSE_WRKSRC (a full path is more convenient)
	- Organize and rename internal variables, add comments
	- Improve configuration

Affected files ...

.. //depot/projects/soc2008/alepulver-portslicense/ports/Mk/README#2 edit
.. //depot/projects/soc2008/alepulver-portslicense/ports/Mk/bsd.licenses.mk#2 edit
.. //depot/projects/soc2008/alepulver-portslicense/ports/Mk/test-license-1/Makefile#2 edit

Differences ...

==== //depot/projects/soc2008/alepulver-portslicense/ports/Mk/README#2 (text+ko) ====

@@ -57,7 +57,7 @@
 ==============================================================================
 
 When asking the user to agree the license there are options to save the choice
-to a configuration file in "${PORT_DBDIR}/license-config.mk".
+to a configuration file in "${LICENSE_CFG}" (can be global or per port).
 
 ==============================================================================
 6. Reports
@@ -80,30 +80,33 @@
   dual/multiple licenses (need parsing code), start with only one of them
 * implement LICENSE_COMPAT for packaging/linking (check *_DEPENDS
   appropiately), but should be allowed by default first (maybe should be
-  NOCOMPAT instead)?
+  INCOMPAT instead)?
 * Consider licenses that need manual agreement/manual fetching
   provide framework help for manual distfile placing, etc
+  maybe also add pkg-fetch-message or some variables to avoid manual IGNORE/printf?
 * how do you know if a license has changed? Save checksum? Maybe license
   revison number suffixed by a _n? Or not needed (this is only for changes of
   the same license type: e.g. BSD-based to BSD-based, but with no-pkg-sell).
-* provide useful aliases like "no-sell" for a general no-pkg-sell no-dist-sell
-* decide if LICENSE_* variables should inherit components from LICENSE if it
-  is a known one
+  only for license "variant" and "unknown", save checksum in port cfg and compare
+* provide useful aliases like "no-sell" for a general no-pkg-sell no-dist-sell,
+  and groups for the same purpose
 
 General:
 * additional targets (show-license, show-license-report,
   show-known-licenses, etc)
 * add common licenses (check a web page or try FOSSology)
 * avoid whitespace in saved files (reports and cfg)
+* add LICENSE_TEXT for when there is no LICENSE_FILE, and show instead (not
+  with a license but maybe for a URL to read it)
 
 Configuration:
 * provide target to assist cleaning LICENSES_ACCEPTED and LICENSES_REJECTED,
   and ports framework configuration
-* port specific config should be next to ${OPTIONSFILE}, remove the
-  license:category/port notation
 * provide root credential switching like make-config
 * allow approving a previously rejected and saved license with a target like
-  license-config
+  license-config (or by defining a variable)
+* separate groups into another variable (either internally and/or externally->better)
+* make list of error messages (by component/type) and the like, so targets are more dynamic
 
 Reports:
 

==== //depot/projects/soc2008/alepulver-portslicense/ports/Mk/bsd.licenses.mk#2 (text+ko) ====

@@ -41,12 +41,10 @@
 # The components of LICENSES_{ACCEPTED,REJECTED} can be one of:
 # - A license code (like "GPLv2").
 # - A license group prefixed by '@' (like "@OSI").
-# - A license variant specific to a port as "license:port" (like
-#   GPLv2:devel/foo).
 #
 # Note that the framework configuration format is the same, but stored in
-# ${LICENSE_CFG}. The user variables take precedence (anyways the other
-# configuration is also made by the user).
+# ${LICENSE_CFG} or ${LICENSE_CFG_PORT}. The user variables take precedence
+# (anyways the other configuration is also made by the user).
 #
 
 # Variables provided to ports
@@ -58,22 +56,23 @@
 # LICENSE_NAME		- Full license name (for the reports)
 # LICENSE_NOTES		- A note about restrictions (not needed), to replace
 # 					  RESTRICTED and ports/LEGAL.
-# LICENSE_WRKSRC	- Path to LICENSE_FILE (default: ${WRKSRC})
-# LICENSE_FILE		- Path to license, relative to LICENSE_WRKSRC (or "none")
+# LICENSE_FILE		- Path to license (or "none")
 # LICENSE_DISTFILE	- Name of licensed files (defaults to ${DISTFILES})
 #
-# The following cases are supported:
+# The following cases are supported (see _LICENSE_TYPE):
 #
-# Case 1: license defined in the framework.
-# Define LICENSE; framework defines LICENSE_{PERMS,GROUPS,COMPAT,NAME}.
-# By redefining any of them the port falls in Case 2.
+# Case 1: license defined in the framework (aka "known").
+# Define LICENSE; framework defines license variables, by redefining any of
+# them the port falls in Case 2.
 #
-# Case 2: license is based on a defined one.
-# Define LICENSE; and LICENSE_{PERMS,GROUPS,COMPAT,NAME} are defined only if
-# the port does not.
+# Case 2: license is based on a defined one (aka "variant").
+# All license variables must be defined by the port (but LICENSE is set to
+# a known value).
+# XXX This case is being considered, and if it has to inherit properties from
+#     its base license. Or just let it fall in Case 3.
 #
-# Case 3: license only known by the port.
-# LICENSE_{PERMS,GROUPS,COMPAT,NAME} are mandatory.
+# Case 3: license only known by the port (aka "unknown").
+# All license variables must be defined by the port.
 #
 # Notes:
 # - Permissions use a default-deny policy (that's why groups are there).
@@ -102,111 +101,98 @@
 
 .if defined(LICENSE)
 
-# Valid components
+# Organization
+# - Define common license properties
+# - Define internal variables
+# - Check for single or multiple port licenses
+# - Check defined properties and compare with database
+# - Check user and framework configuration
+# - Define targets
 
-_LICENSE_VARS_ALL=	PERMS GROUPS NAME # COMPAT
-_LICENSE_PERMS_ALL=	dist-redist distsell pkg-redist pkg-sell auto-accept none
-_LICENSE_SAVE_ALL=	LICENSE ${_LICENSE_VARS_ALL:S/^/LICENSE_/} LICENSE_NOTES LICENSE_DISTFILE
+# XXX Start of editable section
 
-# Path variables
-
-LICENSE_WRKSRC?=	${WRKSRC}
-LICENSE_DISTFILE?=	${DISTFILES}
-LICENSE_DIR?=		${PREFIX}/share/licenses/${UNIQUENAME}
-LICENSE_DIR_REL?=	share/licenses/${UNIQUENAME}
-LICENSE_CFG?=		${PORT_DBDIR}/license-config.mk
-LICENSE_REPORT?=	${LICENSE_DIR}/report.mk
-
 # License definitions
 #
-# _LICENSES_ALL			- List of defined licenses
-# _LICENSE_GROUPS_ALL	- List of defined license groups
+# _LICENSE_LIST			- List of defined licenses
+# _LICENSE_LIST_GROUPS	- List of defined license groups
 #
 
-_LICENSES_ALL=			GPLv2
-_LICENSE_GROUPS_ALL=	FSF
+_LICENSE_LIST=			GPLv2
+_LICENSE_LIST_GROUPS=	FSF
 
 # Properties of license/group "xxx" (similar to port's variables, but single)
-# _LICENSE_xxx_NAME		- Full name of license/group, for the reports
-# _LICENSE_xxx_PERMS	- Permissions
-# _LICENSE_xxx_COMPAT	- Compatibility
+# _LICENSE_NAME_xxx		- Full name/description of license/group
+# _LICENSE_PERMS_xxx	- Permissions
+# _LICENSE_COMPAT_xxx	- Compatibility
 
 # List of licenses
 
-_LICENSE_GPLv2_NAME=	GNU General Public License version 2
-_LICENSE_GPLv2_PERMS=	dist-redist dist-sell pkg-redist pkg-sell auto-accept
-#_LICENSE_GPLv2_COMPAT=	#
+_LICENSE_NAME_GPLv2=	GNU General Public License version 2
+_LICENSE_PERMS_GPLv2=	dist-redist dist-sell pkg-redist pkg-sell auto-accept
+_LICENSE_COMPAT_GPLv2=	#
 
 # List of groups
 
-_LICENSE_FSF_NAME=		Free Software Foundation approved
-_LICENSE_FSF_PERMS=		#
-#_LICENSE_FSF_COMPAT=	#
+_LICENSE_NAME_FSF=		Free Software Foundation approved
+_LICENSE_PERMS_FSF=		#
+_LICENSE_COMPAT_FSF=	#
 
 # Grouping
+#
 # - Method 1:
-# _LICENSE_GROUP_xxx	- List of licenses under the "xxx" group
+# _LICENSE_LIST_GROUP_xxx	- List of licenses under the "xxx" group
+
+_LICENSE_LIST_GROUP_FSF=	GPLv2
+
 # - Method 2:
-# _LICENSE_xxx_GROUPS	- Groups the license/group belongs to
+# _LICENSE_GROUPS_xxx		- Groups the license/group belongs to
+
+# empty
 
-_LICENSE_GROUP_FSF=		GPLv2
+# XXX End of editable section
 
 # Method 1 expands to method 2
-.for group in ${_LICENSE_GROUPS_ALL}
-.	for lic in ${_LICENSE_GROUP_${group}}
-_LICENSE_${lic}_GROUPS?=	#
-.		if ${_LICENSE_${lic}_GROUPS:M${group}} == ""
-_LICENSE_${lic}_GROUPS+=	${group}
+.for group in ${_LICENSE_LIST_GROUPS}
+.	for lic in ${_LICENSE_LIST_GROUP_${group}}
+_LICENSE_GROUPS_${lic}?=	#
+.		if ${_LICENSE_GROUPS_${lic}:M${group}} == ""
+_LICENSE_GROUPS_${lic}+=	${group}
 .		endif
 .	endfor
 .endfor
 
-# Check if the user agrees with the license
+# Lists of variables and valid components
 #
-# LICENSES_ACCEPTED		- List of accepted licenses (user version)
-# LICENSES_REJECTED		- List of rejected licenses (user version)
-# _LICENSES_ACCEPTED	- List of accepted licenses (framework configuration)
-# _LICENSES_REJECTED	- List of rejected licenses (framework configuration)
-# _LICENSES_YES			- Merged list of accepted licenses
-# _LICENSES_NO			- Merged list of rejected licenses
+# _LICENSE_LIST_PERMS		- Valid permission components
+# _LICENSE_LIST_PORT_VARS	- License variables defined by the port
+# _LICENSE_LIST_GROUP_VARS	- License variables inherited from groups
+# _LICENSE_LIST_SAVE_VARS	- License variables present in the report
 
-.if exists(${LICENSE_CFG})
-.include "${LICENSE_CFG}"
-.endif
+_LICENSE_LIST_PERMS=		dist-redist distsell pkg-redist pkg-sell auto-accept none
+_LICENSE_LIST_PORT_VARS=	PERMS GROUPS NAME # COMPAT
+_LICENSE_LIST_GROUP_VARS=	PERMS # COMPAT
+_LICENSE_LIST_SAVE_VARS=	LICENSE ${_LICENSE_LIST_PORT_VARS:S/^/LICENSE_/} LICENSE_NOTES LICENSE_DISTFILE
 
-# Make sure these are defined
-_LICENSES_ACCEPTED?=	#
-_LICENSES_REJECTED?=	#
-LICENSES_ACCEPTED?=		#
-LICENSES_REJECTED?=		#
-_LICENSES_YES=			#
-_LICENSES_NO=			#
+# Path variables
+#
+# LICENSE_DIR		- Directory to install licenses
+# LICENSE_DIR_REL	- Same as above, without ${PREFIX}
+# LICENSE_CFG_GLOB	- Global license configuration file
+# LICENSE_CFG_PORT	- Per port license configuration file
+# LICENSE_REPORT	- License report to be created (under ${LICENSE_DIR})
 
-# Manual user configuration (cmd-line or /etc/make.conf)
-.for lic in ${LICENSES_ACCEPTED:C,\:,|,}
-.	if ${_LICENSES_YES:M${lic}} == ""
-_LICENSES_YES+=			${lic}
-.	endif
-.endfor
-.for lic in ${LICENSES_REJECTED:C,\:,|,}
-.	if ${_LICENSES_NO:M${lic}} == ""
-_LICENSES_NO+=			${lic}
-.	endif
-.endfor
+LICENSE_DISTFILE?=	${DISTFILES}
+LICENSE_DIR?=		${PREFIX}/share/licenses/${UNIQUENAME}
+LICENSE_DIR_REL?=	share/licenses/${UNIQUENAME}
+LICENSE_CFG_GLOB?=	${PORT_DBDIR}/license-config
+LICENSE_CFG_PORT?=	${PORT_DBDIR}/${UNIQUENAME}/license
+LICENSE_REPORT?=	${LICENSE_DIR}/report
 
-# Framework configuration (load cfg file; respecting user vars)
-.for lic in ${_LICENSES_ACCEPTED:C,\:,|,}
-.	if ${LICENSES_REJECTED:M${lic}} == "" && ${_LICENSES_YES:M${lic}} == ""
-_LICENSES_YES+=			${lic}
-.	endif
-.endfor
-.for lic in ${_LICENSES_REJECTED:C,\:,|,}
-.	if ${LICENSES_ACCEPTED:M${lic}} == "" && ${_LICENSES_NO:M${lic}} == ""
-_LICENSES_NO+=			${lic}
-.	endif
-.endfor
+# Check if single or dual/multiple license
+#
+# _LICENSE_SINGLE	- Defined for a single license
+# _LICENSE_MULTI	- Set to "and"/"or"? (XXX Not implemented)
 
-# Check if single or dual/multiple license
 .for lic in ${LICENSE}
 .	if defined(_LICENSE_DEFINED)
 _LICENSE_MULTI=		yes
@@ -219,86 +205,167 @@
 .endif
 .undef _LICENSE_DEFINED
 
-# Evaluate final groups and permissions
+# Evaluate port license groups and permissions
+#
+# Available values for _LICENSE_TYPE:
+# Case 1: "known" (license info taken from internal database)
+# Case 2: "variant" (LICENSE is known, but info taken from port)
+# Case 3: "unknown" (LICENSE is not known, and info taken from port)
+#
+# Make sure required variables are defined, and remove conflicting (positive
+# and negative) and duplicated components.
 
 .if defined(_LICENSE_SINGLE)
 .	for lic in ${LICENSE}
+.		if ${_LICENSE_LIST:M${lic}} != ""
+.			for var in ${_LICENSE_LIST_PORT_VARS}
+.				if defined(LICENSE_${var})
+_LICENSE_TYPE=	variant
+.				endif
+.			endfor
+_LICENSE_TYPE?=	known
+.			for var in ${_LICENSE_LIST_PORT_VARS}
 # Case 1: license defined in the framework.
-.		if ${_LICENSES_ALL:M${lic}} != ""
-.			for var in ${_LICENSE_VARS_ALL}
+.				if ${_LICENSE_TYPE} == "known"
+_LICENSE_${var}=	${_LICENSE_${var}_${lic}}
 # Case 2: license is based on a defined one.
-.				if defined(LICENSE_${var})
-_LICENSE_TYPE?=	variant
+# XXX Should here be inheritance of non defined values?
+.				elif ${_LICENSE_TYPE} == "variant"
 _LICENSE_${var}=	${LICENSE_${var}}
-.				else
-_LICENSE_TYPE?=	known
-_LICENSE_${var}?=	${_LICENSE_${lic}_${var}}
 .				endif
 .			endfor
 # Case 3: license only known by the port.
 .		else
 _LICENSE_TYPE?=	unknown
-.			for var in ${_LICENSE_VARS_ALL}
-.				if !defined(LICENSE_${var})
-_LICENSE_ERROR?=	for a new (unknown) license, defining LICENSE_{PERMS,GROUPS,COMPAT,NAME} is mandatory
-.				else
+.			for var in ${_LICENSE_LIST_PORT_VARS}
+.				if defined(LICENSE_${var})
 _LICENSE_${var}=	${LICENSE_${var}}
 .				endif
 .			endfor
+# Check everything needed is defined.
+.			for var in ${_LICENSE_LIST_PORT_VARS}
+.				if !defined(_LICENSE_${var})
+.					if ${_LICENSE_TYPE} == "variant"
+_LICENSE_ERROR?=	for a modified license, defining LICENSE_${var} is mandatory (otherwise define LICENSE alone)
+.					elif ${_LICENSE_TYPE} == "unknown"
+_LICENSE_ERROR?=	for a new/unknown license, defining LICENSE_${var} is mandatory (otherwise use a known LICENSE)
+.					endif
+.				endif
+.			endfor
 .		endif
 # Groups are always inherited (and were expanded so no recursion)
-.		for group in ${_LICENSE_GROUPS}
-_LICENSE_PERMS+=	${_LICENSE_${group}_PERMS}
-#_LICENSE_COMPAT+=	${_LICENSE_${group}_COMPAT}
+.		for group in ${_LICENSE_LIST_GROUPS}
+.			for var in ${_LICENSE_LIST_GROUP_VARS}
+_LICENSE_${var}+=	${_LICENSE_${var}_${group}}
+.			endfor
 .		endfor
 # Remove ambiguous and duplicate components
 __LICENSE_PERMS:=	${_LICENSE_PERMS}
 _LICENSE_PERMS:=	#
-.		for comp in ${_LICENSE_PERMS_ALL}
+.		for comp in ${_LICENSE_LIST_PERMS}
 .			if ${__LICENSE_PERMS:M${comp}} != "" && ${__LICENSE_PERMS:Mno-${comp}} == "" && \
 			    ${_LICENSE_PERMS:M${comp}} == ""
 _LICENSE_PERMS+=	${comp}
 .			endif
 .		endfor
+# Check LICENSE_FILE (XXX Should be mandatory in all cases?)
+.		if !defined(LICENSE_FILE)
+_LICENSE_ERROR?=	LICENSE_FILE must be defined for unknown licenses
+.		endif
 .	endfor
 .else
 # XXX dual/multiple licenses
 .endif
 
+# Check if the user agrees with the license
+#
+# LICENSE_CFG			- Path to cfg file (either global or per port)
+# _LICENSE_CFG_TYPE		- "global" or "port", according to the previous
+#
+# LICENSES_ACCEPTED		- List of accepted licenses (user version)
+# LICENSES_REJECTED		- List of rejected licenses (user version)
+# _LICENSES_ACCEPTED	- List of accepted licenses (configuration file)
+# _LICENSES_REJECTED	- List of rejected licenses (configuration file)
+
+# If _LICENSE_TYPE is "known", configuration is global, otherwise per port.
+
+.if ${_LICENSE_TYPE} == "known"
+LICENSE_CFG=		${LICENSE_CFG_GLOB}
+_LICENSE_CFG_TYPE=	global
+.else
+LICENSE_CFG=	${LICENSE_CFG_PORT}
+_LICENSE_CFG_TYPE=	port
+.endif
+
+.if exists(${LICENSE_CFG})
+.	include "${LICENSE_CFG}"
+.endif
+
+# Make sure these are defined
+LICENSES_ACCEPTED?=		#
+LICENSES_REJECTED?=		#
+_LICENSES_ACCEPTED?=	#
+_LICENSES_REJECTED?=	#
+
 # Evaluate status (accepted, rejected or ask)
+#
+# _LICENSE_STATUS			- Status: "accepted", "rejected" or "ask"
+# _LICENSE_STATUS_FROM		- Status origin: "user", "config" or "default"
+# _LICENSE_STATUS_REASON	- Text reason of license status (XXX Required?)
 
+_LICENSE_TYPE_PAIRS_known=		LICENSES,user _LICENSES,config
+_LICENSE_TYPE_PAIRS_variant=	_LICENSES,config
+_LICENSE_TYPE_PAIRS_unknown=	_LICENSES,config
+
 .if defined(_LICENSE_SINGLE)
-# Check license
+# User and saved configuration
 .	for lic in ${LICENSE}
-.		if ${_LICENSES_NO:M${lic}} != ""
+.		for pair in ${_LICENSE_TYPE_PAIRS_${_LICENSE_TYPE}}
+_LC_VAR:=	${pair:C/,.*//}
+_LC_TYPE:=	${pair:C/.*,//}
+.			if ${${_LC_VAR}_REJECTED:M${lic}} != "" && !defined(_LICENSE_STATUS)
+_LICENSE_STATUS=	rejected
+_LICENSE_STATUS_FROM:=	${_LC_TYPE}
+.			elif ${${_LC_VAR}_ACCEPTED:M${lic}} != "" && !defined(_LICENSE_STATUS)
+_LICENSE_STATUS=	accepted
+_LICENSE_STATUS_FROM:=	${_LC_TYPE}
+.			endif
+.		endfor
+
+# Automatic configuration
+.		if !defined(_LICENSE_STATUS)
+# Check groups (only available for user configuration)
+.			for group in ${_LICENSE_LIST_GROUPS}
+.				if ${LICENSES_REJECTED:M\@${group}} != ""
 _LICENSE_STATUS?=	rejected
-.		elif (${_LICENSE_TYPE} == "known" && ${_LICENSES_YES:M${lic}} != "") || \
-		     (${_LICENSE_PERMS:Mauto-accept} != "" && !defined(LICENSES_ASK))
+_LICENSE_STATUS_FROM?=	user
+.				endif
+.				if ${LICENSES_ACCEPTED:M\@${group}} != ""
 _LICENSE_STATUS?=	accepted
-.		else
-.			if ${_LICENSE_TYPE} == "variant"
-.					for pair in ${_LICENSES_YES:M*\|*}
-_LC_TEST:=			${pair}
-.						if ${_LC_TEST:C,.*\|,,} == ${PKGORIGIN} && ${_LC_TEST:C,\|.*,,} == ${lic}
+_LICENSE_STATUS_FROM?=	user
+.				endif
+.			endfor
+# Auto-accept if LICENSE_PERMS has auto-accept, and !LICENSES_ASK
+.			if ${_LICENSE_PERMS:Mauto-accept} != ""
+.				if !defined(LICENSES_ASK)
 _LICENSE_STATUS?=	accepted
-.						endif
-.					endfor
-.			undef _LC_TEST
+_LICENSE_STATUS_FROM?=	default
+.				else
+_LICENSE_STATUS?=	ask
+_LICENSE_STATUS_FROM?=	user
+.				endif
+.			endif
+# If defined BATCH and need to ask, it fails
+.			if defined(BATCH)
+_LICENSE_STATUS?=	rejected
+_LICENSE_STATUS_FROM?=	user
 .			endif
+# Otherwise ask to the user
 _LICENSE_STATUS?=	ask
+_LICENSE_STATUS_FROM?=	default
 .		endif
 .	endfor
-# Check groups
-.	if ${_LICENSE_STATUS} == "ask"
-.		for group in ${_LICENSE_GROUPS}
-.			if ${_LICENSES_YES:M\@${group}} != ""
-_LICENSE_STATUS=	accepted
-.			endif
-.			if ${_LICENSES_NO:M\@${group}} != ""
-_LICENSE_STATUS=	rejected
-.			endif
-.		endfor
-.	endif
+
 .else
 # XXX dual/multiple licenses
 .endif
@@ -307,44 +374,29 @@
 
 check-license:
 .if defined(_LICENSE_ERROR)
-		@${ECHO_MSG} "===>  License not correctly defined: ${_LICENSE_ERROR}."
+		@${ECHO_MSG} "===>  License not correctly defined: ${_LICENSE_ERROR}"
 		@exit 1
 .endif
 .if defined(_LICENSE_SINGLE)
 .	if ${_LICENSE_STATUS} == "rejected"
-		@${ECHO_MSG} "===>  License ${LICENSE} rejected by the user."
+		@${ECHO_MSG} "===>  License ${LICENSE} rejected by the user (by ${_LICENSE_STATUS_FROM})"
 		@exit 1
 .	elif ${_LICENSE_STATUS} == "accepted"
-			@${ECHO_MSG} "===>  License ${LICENSE} accepted by the user."
+		@${ECHO_MSG} "===>  License ${LICENSE} accepted by the user (by ${_LICENSE_STATUS_FROM})"
 .	elif ${_LICENSE_STATUS} == "ask"
-.		if defined(BATCH)
-			@${ECHO_MSG} "===>  License ${LICENSE} needs agreement but BATCH is defined."
-			@exit 1
-.		else
-			@${ECHO_MSG} "===>  License ${LICENSE} needs agreement, will ask later."
-.		endif
+		@${ECHO_MSG} "===>  License ${LICENSE} needs agreement, will ask later (by ${_LICENSE_STATUS_FROM})"
 .	endif
 .else
 # XXX dual/multiple licenses
 .endif
 
-.if ${_LICENSE_STATUS} == "ask"
-.	if ${_LICENSE_TYPE} == "variant"
-_LICENSES_ACCEPTED+=	${LICENSE}|${PKGORIGIN}
-.	elif ${_LICENSE_TYPE} == "known"
-_LICENSES_ACCEPTED+=	${LICENSE}
-.		for lic in ${LICENSE}
-_LICENSES_REJECTED:=	${_LICENSES_REJECTED:N${lic}}
-.		endfor
-.	endif
-.endif
-
 # Display, ask and save preference if requested
 
 ask-license:
+# XXX verify checksum if accepted by port cfg file
 .if ${_LICENSE_STATUS} == "ask"
-	@if [ ! -f ${LICENSE_WRKSRC}/${LICENSE_FILE} ]; then \
-		${ECHO_CMD} "License not found in \"${LICENSE_WRKSRC}/${LICENSE_FILE}\", aborting."; \
+	@if [ ! -f ${LICENSE_FILE} ]; then \
+		${ECHO_CMD} "License not found in \"${LICENSE_FILE}\", aborting."; \
 		exit 1; \
 	fi
 	@until [ "$$status" = done ]; do \
@@ -357,14 +409,21 @@
 			  exit 1;; \
 		[Ss]) ${ECHO_CMD} "License was accepted and saved."; \
 			  ${MKDIR} ${LICENSE_CFG:H}; \
-			  (${ECHO_CMD} _LICENSES_ACCEPTED=${_LICENSES_ACCEPTED:C/\|/:/:Q}; \
-			   ${ECHO_CMD} _LICENSES_REJECTED=${_LICENSES_REJECTED:C/\|/:/:Q}) > ${LICENSE_CFG}; \
+			  ${ECHO_CMD} _LICENSES_ACCEPTED=${LICENSE} > ${LICENSE_CFG}; \
 			  status=done;; \
-		[Vv]) more ${LICENSE_WRKSRC}/${LICENSE_FILE}; \
+		[Vv]) more ${LICENSE_FILE}; \
 		esac; \
 	done
+.elif defined(LICENSES_CONFIG)
+.	if ${_LICENSE_STATUS_FROM} == "user"
+# XXX fail here
+.	else
+# XXX replace cfg
+.	endif
 .endif
 
+# Package list entries, and installation
+
 PLIST_FILES+=	${LICENSE_DIR_REL}/${LICENSE_REPORT:T}
 PLIST_DIRS+=	${LICENSE_DIR_REL}
 
@@ -374,12 +433,11 @@
 
 install-license:
 	@${MKDIR} ${LICENSE_DIR}
-	@test -f ${LICENSE_WRKSRC}/${LICENSE_FILE} && \
-		${INSTALL_DATA} ${LICENSE_WRKSRC}/${LICENSE_FILE} ${LICENSE_DIR}
+	@test -f ${LICENSE_FILE} && ${INSTALL_DATA} ${LICENSE_FILE} ${LICENSE_DIR}
 	@${TRUE} > ${LICENSE_REPORT}
-.	for var in ${_LICENSE_SAVE_ALL}
+.	for var in ${_LICENSE_LIST_SAVE_VARS}
 .		if !empty(${var})
-		@${ECHO_CMD} ${var}=${${var}} >> ${LICENSE_REPORT}
+		@${ECHO_CMD} '${var}=${${var}}' >> ${LICENSE_REPORT}
 .		endif
 .	endfor
 

==== //depot/projects/soc2008/alepulver-portslicense/ports/Mk/test-license-1/Makefile#2 (text+ko) ====

@@ -18,15 +18,15 @@
 NO_WRKSUBDIR=	yes
 
 LICENSE=	GPLv2
-LICENSE_FILE=	MyFile
-LICENSE_PERMS=	no-pkg-sell no-dist-sell
+LICENSE_FILE=	${WRKSRC}/MyFile
+#LICENSE_PERMS=	no-pkg-sell no-dist-sell
 #LICENSE_NAME=	Berkeley Software Distribution License
 #LICENSE_GROUPS=	#
 #LICENSE_PERMS=	dist-redist pkg-redist auto-accept
 
 do-extract:
 	@${MKDIR} ${WRKDIR}
-	@${ECHO_CMD} "example" > ${WRKSRC}/${LICENSE_FILE}
+	@${ECHO_CMD} "example" > ${LICENSE_FILE}
 
 do-install:
 


More information about the p4-projects mailing list