Mon Jun 29 14:49:57 2009 UTC ()
Don't call pkg_admin check-license if the version is too old to support
it.  Explicitly fail in that case and inform the user to update.

If the license condition is simple, provide a C&P-table line.

OK wiz@


(joerg)
diff -r1.24 -r1.25 pkgsrc/mk/license.mk

cvs diff -r1.24 -r1.25 pkgsrc/mk/license.mk (expand / switch to unified diff)

--- pkgsrc/mk/license.mk 2009/06/14 15:15:24 1.24
+++ pkgsrc/mk/license.mk 2009/06/29 14:49:57 1.25
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: license.mk,v 1.24 2009/06/14 15:15:24 joerg Exp $ 1# $NetBSD: license.mk,v 1.25 2009/06/29 14:49:57 joerg Exp $
2# 2#
3# This file handles everything about the LICENSE variable. It is 3# This file handles everything about the LICENSE variable. It is
4# included automatically by bsd.pkg.mk. 4# included automatically by bsd.pkg.mk.
5# 5#
6# XXX There should be one place to set the default list and for users 6# XXX There should be one place to set the default list and for users
7# to set the ACCEPTABLE_LICENSES list, used by both source builds and 7# to set the ACCEPTABLE_LICENSES list, used by both source builds and
8# binary installs# 8# binary installs#
9# 9#
10# XXX: Some of this content arguably belongs in the pkgsrc guide 10# XXX: Some of this content arguably belongs in the pkgsrc guide
11# instead. 11# instead.
12# 12#
13# === User-settable variables === 13# === User-settable variables ===
14# 14#
@@ -117,50 +117,66 @@ WARNINGS+= "[license.mk] Every package  @@ -117,50 +117,66 @@ WARNINGS+= "[license.mk] Every package
117 117
118.else 118.else
119 119
120.if defined(_ACCEPTABLE) 120.if defined(_ACCEPTABLE)
121WARNINGS+= "Deprecated variable _ACCEPTABLE found, use SKIP_LICENSE_CHECK=yes" 121WARNINGS+= "Deprecated variable _ACCEPTABLE found, use SKIP_LICENSE_CHECK=yes"
122SKIP_LICENSE_CHECK= yes 122SKIP_LICENSE_CHECK= yes
123.endif 123.endif
124 124
125SKIP_LICENSE_CHECK?= no 125SKIP_LICENSE_CHECK?= no
126 126
127.if !empty(SKIP_LICENSE_CHECK:M[Yy][Ee][Ss]) 127.if !empty(SKIP_LICENSE_CHECK:M[Yy][Ee][Ss])
128_ACCEPTABLE_LICENSE= skipped 128_ACCEPTABLE_LICENSE= skipped
129.else 129.else
130_ACCEPTABLE_LICENSE!= ${SETENV} \ 130_ACCEPTABLE_LICENSE!= \
131 PKGSRC_ACCEPTABLE_LICENSES=${ACCEPTABLE_LICENSES:Q} \ 131 if test `${PKG_ADMIN} -V` -lt 20090528; then \
132 PKGSRC_DEFAULT_ACCEPTABLE_LICENSES=${DEFAULT_ACCEPTABLE_LICENSES:Q} \ 132 echo outdated; \
133 ${PKG_ADMIN} check-license ${LICENSE:Q} || echo failure 133 else \
 134 ${SETENV} PKGSRC_ACCEPTABLE_LICENSES=${ACCEPTABLE_LICENSES:Q} \
 135 PKGSRC_DEFAULT_ACCEPTABLE_LICENSES=${DEFAULT_ACCEPTABLE_LICENSES:Q} \
 136 ${PKG_ADMIN} check-license ${LICENSE:Q} || echo failure; \
 137 fi
134.endif 138.endif
135 139
136.if ${_ACCEPTABLE_LICENSE} == "no" 140.if ${_ACCEPTABLE_LICENSE} == "no"
137. if defined(MAKECONF) 141. if defined(MAKECONF)
138_MAKE_CONF?= ${MAKECONF} 142_MAKE_CONF?= ${MAKECONF}
139. elif ${OPSYS} == "NetBSD" && ${MAKE} == "/usr/bin/make" 143. elif ${OPSYS} == "NetBSD" && ${MAKE} == "/usr/bin/make"
140_MAKE_CONF?= /etc/mk.conf 144_MAKE_CONF?= /etc/mk.conf
141. else 145. else
142_MAKE_CONF?= ${PREFIX}/etc/mk.conf 146_MAKE_CONF?= ${PREFIX}/etc/mk.conf
143.endif 147.endif
144. if ${OPSYS} == "NetBSD" && ${PKG_TOOLS_BIN} == "/usr/sbin" 148. if ${OPSYS} == "NetBSD" && ${PKG_TOOLS_BIN} == "/usr/sbin"
145_PKG_INSTALL_CONF?= /etc/pkg_install.conf 149_PKG_INSTALL_CONF?= /etc/pkg_install.conf
146. else 150. else
147_PKG_INSTALL_CONF?= ${PREFIX}/etc/pkg_install.conf 151_PKG_INSTALL_CONF?= ${PREFIX}/etc/pkg_install.conf
148.endif 152.endif
149 153
 154. if empty(LICENSE:MAND) && empty(LICENSE:MOR) && empty(LICENSE:M*[()]*)
150PKG_FAIL_REASON+= "${PKGNAME} has an unacceptable license condition: " \ 155PKG_FAIL_REASON+= "${PKGNAME} has an unacceptable license condition: " \
151 " "${LICENSE:Q} \ 156 " "${LICENSE:Q} \
152 "You can mark the license \`\`license'' as acceptable by adding" \ 157 "You can mark the license \`\`license'' as acceptable by adding" \
153 " ACCEPTABLE_LICENSES+= license" \ 158 " ACCEPTABLE_LICENSES+= ${LICENSE}" \
154 "to ${_MAKE_CONF} or by adding" \ 159 "to ${_MAKE_CONF} or by adding" \
155 " ACCEPTABLE_LICENSES= license" \ 160 " ACCEPTABLE_LICENSES= ${LICENSE}" \
156 "to ${_PKG_INSTALL_CONF}." 161 "to ${_PKG_INSTALL_CONF}."
157. if empty(LICENSE:M*[A-Z()]) 
158PKG_FAIL_REASON+= "The following command will show you the license text:" \ 162PKG_FAIL_REASON+= "The following command will show you the license text:" \
159 " ${MAKE} show-license" 163 " ${MAKE} show-license"
 164. else
 165PKG_FAIL_REASON+= "${PKGNAME} has an unacceptable license condition: " \
 166 " "${LICENSE:Q} \
 167 "You can mark the license \`\`license'' as acceptable by adding" \
 168 " ACCEPTABLE_LICENSES+= license" \
 169 "to ${_MAKE_CONF} or by adding" \
 170 " ACCEPTABLE_LICENSES= license" \
 171 "to ${_PKG_INSTALL_CONF}."
160. endif 172. endif
161 173
162.elif ${_ACCEPTABLE_LICENSE} == "failure" 174.elif ${_ACCEPTABLE_LICENSE} == "failure"
163PKG_FAIL_REASON+= "License conditions for ${PKGNAME} could not be evaluated" 175PKG_FAIL_REASON+= "License conditions for ${PKGNAME} could not be evaluated"
 176.elif ${_ACCEPTABLE_LICENSE} == "outdated"
 177PKG_FAIL_REASON+= \
 178 "Your pkg_install is too old to evaluate license conditions" \
 179 "You can bypass this check by setting SKIP_LICENSE_CHECK=yes"
164.endif 180.endif
165 181
166.endif 182.endif