pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/57928: pkgsrc guide on overriding ACCEPTABLE_LICENSES is broken



>Number:         57928
>Category:       pkg
>Synopsis:       pkgsrc guide on overriding ACCEPTABLE_LICENSES is broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Feb 11 21:30:00 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The Pkgsrc Licensation
>Environment:
>Description:
From <https://www.NetBSD.org/docs/pkgsrc/pkgsrc.html#handling-licenses>:

> One might want to only install packages with a BSD license, or the GPL, and not the other. The free licenses are added to the default ACCEPTABLE_LICENSES variable. The pkgsrc user can override the default by setting the ACCEPTABLE_LICENSES variable with "=" instead of "+=". The licenses accepted by default are defined in the DEFAULT_ACCEPTABLE_LICENSES variable in the file pkgsrc/mk/license.mk.

However, this doesn't work: pkgsrc happily builds packages when ACCEPTABLE_LICENSES is set to empty in mk.conf.

It doesn't work to set DEFAULT_ACCEPTABLE_LICENSES in mk.conf either, because mk/license.mk unconditionally sets DEFAULT_ACCEPTABLE_LICENSES.

It doesn't work to set ACCEPTABLE_LICENSES= (empty) and DEFAULT_ACCEPTABLE_LICENSES= (empty) in pkg_install.conf either, because pkgsrc sets the environment variable PKGSRC_DEFAULT_ACCEPTABLE_LICENSES unconditionally to the default list, and pkg_install adds whatever is in that environment variable to the acceptable list.

Embarrassingly enough, the discrepancy appears to have been there since 2009:

1. On 2009-04-08, wiz added text in doc/guide/files/fixes.xml 1.98 about using `=' instead of `+=' with ACCEPTABLE_LICENSES in order to override the default.  At the time, this was correct: mk/bsd.prefs.mk 1.288 (from 2008-10-05) set `ACCEPTABLE_LICENSES?= ${DEFAULT_ACCEPTABLE_LICENSES}', and mk/license.mk 1.12 (from 2009-04-08) used `!empty(ACCEPTABLE_LICENSES:M${LICENSE})' to check for a match.
2. joerg adapted mk/license.mk to use `pkg_admin check-license' in order to evaluate logical license expressions with AND and OR, in mk/license.mk 1.24 (2009-06-14), passing both ACCEPTABLE_LICENSES _and_ DEFAULT_ACCEPTABLE_LICENSES through environment variables.
>How-To-Repeat:
cd net/socat && make show-var VARNAME=_ACCEPTABLE_LICENSE ACCEPTABLE_LICENSES=

Expected result: no

Actual result: yes


>Fix:
Yes, please!



Home | Main Index | Thread Index | Old Index