tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Licence handling: next steps (with attachment)
Hi!
I'd like to start adding license information to pkgsrc after 2009Q1 in
earnest.
The first part is better support in the infrastructure. The current
LICENSE variable is not flexible enough, because it only allows
choosing one license for a package. I extended the variable to support
AND and OR. The new syntax is: by default, all licenses in LICENSE are
ANDed together, you can specify OR by using the pipe symbol ('|')
without any spaces around.
Example:
LICENSE=license1|license2 license3 license4
means that you have to accept
(license1 OR license2) AND license3 AND license4
to build this package.
I think this should be sufficient for our needs; if not, we can
revisit it later.
The diff for supporting this is attached, the only user-visible change
is that bulk builders have to set _ACCEPTABLE to "yes" to skip the
license checks (until now, it sufficed to set it to anything).
I plan on committing this diff after 2009Q1.
The diff also adds a warning when building a package that doesn't have
LICENSE set.
The second step is adding/enabling LICENSE variables in the pkgsrc
Makefiles.
NOTE: Much care should be taken in this step -- rather leave it out if
you're not sure.
At some point in the future (perhaps after 2009Q3), setting the
LICENSE will not be optional for packages.
What is currently completely missing is handling of licenses when
installing binary packages, I hope someone else will provide this
part.
Comments?
Thomas
(resent with attachment)
Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.1954
diff -u -r1.1954 bsd.pkg.mk
--- bsd.pkg.mk 20 Mar 2009 19:25:01 -0000 1.1954
+++ bsd.pkg.mk 30 Mar 2009 12:22:46 -0000
@@ -83,15 +83,6 @@
MKCRYPTO?= YES # build crypto packages by default
-##### Variant spellings
-
-.if defined(LICENCE) && !defined(LICENSE)
-LICENSE= ${LICENCE}
-.endif
-.if defined(ACCEPTABLE_LICENCES) && !defined(ACCEPTABLE_LICENSES)
-ACCEPTABLE_LICENSES= ${ACCEPTABLE_LICENCES}
-.endif
-
##### Others
BUILD_DEPENDS?= # empty
@@ -529,25 +520,7 @@
PKG_FAIL_REASON+= "${PKGNAME} is marked as broken:" ${BROKEN:Q}
. endif
-. if defined(LICENSE)
-. if defined(ACCEPTABLE_LICENSES) && !empty(ACCEPTABLE_LICENSES:M${LICENSE})
-_ACCEPTABLE= yes
-. endif # ACCEPTABLE_LICENSES
-. if !defined(_ACCEPTABLE)
-. if defined(MAKECONF)
-_MAKECONF?= ${MAKECONF}
-. elif ${OPSYS} == "NetBSD" && ${MAKE} != "${PREFIX}/bin/bmake"
-_MAKECONF?= /etc/mk.conf
-. else
-_MAKECONF?= ${PREFIX}/etc/mk.conf
-. endif
-
-PKG_FAIL_REASON+= "${PKGNAME} has an unacceptable license: ${LICENSE}." \
- " To view the license, enter \"${MAKE} show-license\"." \
- " To indicate acceptance, add this line to ${_MAKECONF}:" \
- " ACCEPTABLE_LICENSES+=${LICENSE}"
-. endif # _ACCEPTABLE
-. endif # LICENSE
+.include "license.mk"
# Define __PLATFORM_OK only if the OS matches the pkg's allowed list.
. if defined(ONLY_FOR_PLATFORM) && !empty(ONLY_FOR_PLATFORM)
Index: license.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/license.mk,v
retrieving revision 1.11
diff -u -r1.11 license.mk
--- license.mk 25 Mar 2009 13:50:44 -0000 1.11
+++ license.mk 30 Mar 2009 12:22:46 -0000
@@ -6,6 +6,13 @@
# This file handles everything about the LICENSE variable. It is
# included automatically by bsd.pkg.mk.
#
+# The format of the LICENSE variable is:
+#
+# LICENSE=license1|license2 license3 license4
+#
+# which is interpreted as:
+# (license1 OR license2) AND license3 AND license4
+#
# XXX: Some of this content arguably belongs in the pkgsrc guide
# instead.
#
@@ -72,7 +79,7 @@
#
# ../doc/TODO, section "Licenses of packages"
#
-# Keywords: licence
+# Keywords: licence license
#
# This list is not complete. Free and Open Source licenses should be
@@ -97,9 +104,18 @@
cddl-1.0 \
open-font-license
+##### Variant spellings
+
+.if defined(LICENCE) && !defined(LICENSE)
+LICENSE= ${LICENCE}
+.endif
+.if defined(ACCEPTABLE_LICENCES) && !defined(ACCEPTABLE_LICENSES)
+ACCEPTABLE_LICENSES= ${ACCEPTABLE_LICENCES}
+.endif
+
.if !defined(LICENSE)
# XXX Revisit date.
-. if defined(AFTER_2007Q3)
+. if defined(AFTER_2009Q3)
LICENSE?= unknown
PKG_FAIL_REASON+= "[license.mk] Every package must define a LICENSE."
. else
@@ -111,14 +127,31 @@
# Note: some bulk builders rely on the fact that they can set
# _ACCEPTABLE to bypass license checks. Inform them when you intend to
# remove this variable.
-. if defined(ACCEPTABLE_LICENSES) && !empty(ACCEPTABLE_LICENSES:M${LICENSE})
-_ACCEPTABLE= yes
-. endif
+.for i in ${LICENSE}
+_LICENSE_ALTERNATES= ${i:S/|/ /}
+_LICENSE_PART_ACCEPTABLE_LICENSES=no
+.for j in ${_LICENSE_ALTERNATES}
+.if defined(ACCEPTABLE_LICENSES) && !empty(ACCEPTABLE_LICENSES:M${j})
+_LICENSE_PART_ACCEPTABLE_LICENSES=yes
+.endif
+.endfor
+.if ${_LICENSE_PART_ACCEPTABLE_LICENSES} == "no"
+_ACCEPTABLE=no
+.endif
+.endfor
+_ACCEPTABLE?=yes
-. if !defined(_ACCEPTABLE)
+. if empty(_ACCEPTABLE:M[Yy][Ee][Ss])
+. if defined(MAKECONF)
+_MAKECONF?= ${MAKECONF}
+. elif ${OPSYS} == "NetBSD" && ${MAKE} != "${PREFIX}/bin/bmake"
+_MAKECONF?= /etc/mk.conf
+. else
+_MAKECONF?= ${PREFIX}/etc/mk.conf
+. endif
PKG_FAIL_REASON+= "${PKGNAME} has an unacceptable license: ${LICENSE}." \
" To view the license, enter \"${MAKE} show-license\"." \
- " To indicate acceptance, add this line to your mk.conf:" \
+ " To indicate acceptance, add this line to ${_MAKECONF}:" \
" ACCEPTABLE_LICENSES+=${LICENSE}"
. endif
.endif
Home |
Main Index |
Thread Index |
Old Index