#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#
# Visible changes to classes here require an update to
"""Contains API functions and classes common to both pkg.client.api and
pkg.server.api."""
import six
"""A class representing the license information a package
provides. Not intended for instantiation by API consumers."""
"""Retrieves and returns the payload of the license (which
should be text). This may require remote retrieval of
resources and so this could raise a TransportError or other
ApiException."""
"""The FMRI of the package this license is for."""
"""The keyword identifying this license within its related
package."""
"""A boolean value indicating whether the license requires
acceptance."""
"""A boolean value indicating whether the license must be
displayed during install or update operations."""
"""Represents the scheme and category of an info.classification entry
for a package."""
scheme = None
category = None
if verbose:
else:
"""A class capturing the information about packages that a client
could need. The fmri is guaranteed to be set. All other values may
be None, depending on how the PackageInfo instance was created."""
# Possible package states; these constants should match the values used
# by the Image class. Constants with negative values are not currently
# available.
if category_info_list is None:
category_info_list = []
def build_from_fmri(f):
if not f:
return f
pfmri=f)
"""Returns a list of the values of the package attribute 'name'.
The 'modifiers' parameter, if present, is a dict containing
order for the values to be returned.
Returns an empty list if there are no values.
"""
# XXX should the modifiers parameter be allowed to be a subset
# of an action's modifiers?
)
modifiers, [])
"""This is a private method and not intended for
external consumers."""
# XXX this doesn't handle locale.
cat_data = []
cat_info = []
deps = []
# Anything other than dependency data
# requires summary data.
if actions is None:
for a in actions:
continue
elif a.name != "set":
continue
if attr_name == "pkg.summary":
if get_summ:
elif attr_name == "description":
# Historical summary field.
elif attr_name == "pkg.description":
elif cat_info != None and a.has_category_info():
if desc is None:
summ = ""
else:
desc = None