New pkg(5) license functionality
By user12609878 on Jan 07, 2010
For those of you that require license acceptance or display for your packages, you should be aware that starting with OpenSolaris development build b131, new functionality will be delivered to support license acceptance and display.
The following fixes and enhancements were integrated:
- add 'must-accept' attribute to license actions
- licenseinfo api needs to expose license action attributes
- add 'must-display' attribute to license actions
- change pkg.client.api to understand and require license acceptance
- pkg(1) needs update for client api license acceptance changes
These changes were made to support packages that require display or acceptance of license related data during package install and update operations. As a result of these changes, the pkg(1) client and client API require explicit acceptance and/or indication of license display during install and update operations.
Please note that (currently) no packages exist that use this functionality, but they are expected in the near future.
If any of the license actions contained in a package being installed or updated have must-accept=true, the following pkg(1) subcommands require that the new --accept option be provided before the operation will proceed:
In addition, all of the above subcommands also now have a --licenses option to display the payload of all the licenses for packages part of the operation. For example:
pkg install -n --licenses foo
The above command would display all of the licenses for the packages that would be installed or updated if the package 'foo' were installed or updated. If the --accept option is not provided, and a license requires acceptance, the pkg(1) client will now exit with exit code 6, indicating license acceptance failure. If a license requires display, the pkg(1) client will display it during install/update operations; this cannot be suppressed.
Client API Changes
Incompatible with clients using versions 0-28:
The ImageInterface class has changed as follows:
- set_plan_license_status() was added. This is used to indicate
whether licenses for the packages being operated on have been
accepted or displayed. Clients must do this if the related
license requires acceptance or display.
The LicenseInfo class has changed as follows:
- get_text() may now trigger a remote retrieval of the license
payload if needed to return the text.
- The related package FMRI and license attributes are now
properties: fmri, license, must_accept, and must_display.
The PlanDescription class has changed as follows:
- get_changes() is now a generator function.
- get_licenses() was added to allow clients to retrieve the
list of licenses related to the plan's operations as well
as the current accepted and displayed status of each. Please
note that this function returns _all_ licenses related to the
operation; not just those that require acceptance or display.
To use this new license acceptance functionality, simply add must-accept=true or must-display=true (as appropriate) to license actions in your package manifest. An example pkgsend sequence might look like this:
open email@example.com,5.11-0 add depend type=require firstname.lastname@example.org add file /tmp/libc.so.1 mode=0555 owner=root group=bin path=/lib/libc.so.1 add license /tmp/libc.copyright license=libc.copyright must-display=True add license /tmp/libc.license license=libc.license must-accept=True close
Please note that this functionality is not supported before build 131, and that you should use this functionality sparingly. must-accept=true should not be placed on the majority of open source licenses (BSD, GPL, etc.) and must-display should only be set if absolutely necessary.
Comments or concerns should be sent to the pkg-discuss mailing list on opensolaris.org.