#
# 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
#
#
#
"""module describing a package attribute
This module contains the AttributeAction class, which represents a single
attribute of a package (package metadata). Attributes are typed, and the
possible types are: XXX."""
from . import generic
import six
"""Class representing a package attribute."""
try:
except KeyError:
# For convenience, we allow people to express attributes as
# "<name>=<value>", rather than "name=<name> value=<value>", but
# we always convert to the latter.
try:
return
except KeyError:
pass
'Missing "name" or "value" attribute')
"""Generates the indices needed by the search dictionary. See
generic.py for a more detailed explanation."""
if self.has_category_info():
try:
return [
[all_levels] +
for scheme, all_levels
in self.parse_category_info()
]
except ValueError:
pass
tmp = []
if " " in v:
for w in words:
v))
else:
return tmp
lst = [
]
return [
for w in lst
]
return [
for w in v.split()
]
else:
return [
]
rval = []
# Some logic is inlined here for performance reasons.
return rval
if ":" in val:
else:
scheme = ""
return rval
"""Performs additional validation of action attributes that
for performance or other reasons cannot or should not be done
during Action object creation. An ActionError exception (or
subclass of) will be raised if any attributes are not valid.
This is primarily intended for use during publication or during
error handling to provide additional diagonostics.
'fmri' is an optional package FMRI (object or string) indicating
what package contained this action.
"""
"pkg.description", "pkg.depend.explicit-install"):
# If set action is for any of the above, only a single
# value is permitted.
single_attrs=("value",))
# For pkg actuators, just test that the values are valid
# FMRIs. We want to prevent the system from failing when
# newer, currently unknown actuators are encountered.
errors = []
for f in fmris:
try:
if errors:
else:
# In all other cases, multiple values are assumed to be
# permissible.