pkgplan.py revision 2610
1057N/A# The contents of this file are subject to the terms of the 1057N/A# Common Development and Distribution License (the "License"). 660N/A# You may not use this file except in compliance with the License. 1057N/A# See the License for the specific language governing permissions 1057N/A# and limitations under the License. 1057N/A# When distributing Covered Code, include this CDDL HEADER in each 1057N/A# If applicable, add the following below this CDDL HEADER, with the 1057N/A# fields enclosed by brackets "[]" replaced with your own identifying 1057N/A# information: Portions Copyright [yyyy] [name of copyright owner] 1109N/A# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 684N/A """A package plan takes two package FMRIs and an Image, and produces the 684N/A set of actions required to take the Image from the origin FMRI to the 1109N/A If the destination FMRI is None, the package is removed. 684N/A "actions",
"check_cancelation",
"destination_fmri",
"image",
684N/A "origin_fmri",
"pkg_summary",
"__destination_mfst",
684N/A "__license_status",
"__origin_mfst",
"__progtrack",
684N/A "__repair_actions",
"__xferfiles",
"__xfersize",
1109N/A "_autofix_pkgs",
"__executed" 684N/A """Adds a license status entry for the given src and dest 684N/A 'src' should be None or the source action for a license. 684N/A 'dest' must be the destination action for a license.""" 1109N/A """Return a list of pickled actions.""" 684N/A """Return a list of unpickled actions.""" 684N/A """Update the state of this object using the contents of 684N/A the supplied dictionary.""" 684N/A # if there is no origin, don't allocate an fmri obj 684N/A # if there is no destination, don't allocate an fmri obj 1057N/A """Returns a dictionary containing the state of this object 1057N/A so that it can be easily stored using JSON, pickle, etc.""" 684N/A """Propose origin and dest fmri, manifest""" 684N/A # self.origin_fmri = None 684N/A # I'd like a cleaner solution than this; we need to actually 684N/A # construct a list of actions as things currently are rather 684N/A # than just re-applying the current set of actions. 684N/A # Create a list of (src, dst) pairs for the actions to send to 684N/A # src is none for repairs. 684N/A # dest is none for removals. 684N/A """ updates a set of installed fmris to reflect 684N/A """Determine the actions required to transition the package.""" 1109N/A # If new actions are being installed, check the destination 684N/A # manifest for signatures. 684N/A # Since user removed publisher, assume this is 1109N/A # the same as if they had set signature-policy 684N/A # ignore for the publisher. 684N/A # Only perform signature verification logic if 684N/A # there are signatures or if signature-policy 684N/A "check-certificate-revocation"))
684N/A # figure out how many implicit directories disappear in this 684N/A # transition and add directory remove actions. These won't 684N/A # do anything unless no pkgs reference that directory in 684N/A # Retrieving origin_dirs first and then checking it for any 684N/A # entries allows avoiding an unnecessary expanddirs for the 684N/A # destination manifest when it isn't needed. 684N/A # Manifest.get_directories() returns implicit directories, which 684N/A # means that this computation ends up re-adding all the explicit 1109N/A # directories getting removed to the removed list. This is 684N/A # Stash information needed by legacy actions. 684N/A # Add any install repair actions to the update list 684N/A # Initial installs require acceptance. 679N/A # If src action required acceptance, 684N/A # then license was already accepted 684N/A # before, and if the hashes are the 684N/A # same for the license payload, then 1109N/A # it doesn't need to be accepted again. 1109N/A """A generator function that yields tuples of the form (license, 1109N/A entry). Where 'entry' is a dict containing the license status 1109N/A """Sets the license status for the given license entry. 1109N/A 'plicense' should be the value of the license attribute for the 1109N/A destination license action. 1109N/A 'accepted' is an optional parameter that can be one of three 1109N/A None leaves accepted status unchanged 1109N/A False sets accepted status to False 1109N/A True sets accepted status to True 1109N/A 'displayed' is an optional parameter that can be one of three 1109N/A None leaves displayed status unchanged 1109N/A False sets displayed status to False 1109N/A True sets displayed status to True""" 684N/A """Return tuple of compressed bytes possibly downloaded 1109N/A and number of bytes laid down; ignore removals 1109N/A because they're usually pinned by snapshots""" 1057N/A """Perform actions required prior to installation or removal of 1057N/A This method executes each action's preremove() or preinstall() 1057N/A methods, as well as any package-wide steps that need to be taken 1057N/A # Determine if license acceptance requirements have been met as 1057N/A """Download data for any actions that need it.""" 684N/A """ perform action for installation of package""" 1109N/A # Don't log these as they're expected, and should be 684N/A # handled by the caller. 684N/A """ handle action updates""" 684N/A # Don't log these as they're expected, and should be 684N/A # handled by the caller. 684N/A """ handle action removals""" 1057N/A # Don't log these as they're expected, and should be 1057N/A """Perform actions required after install or remove of a pkg. 1109N/A This method executes each action's postremove() or postinstall() 1057N/A methods, as well as any package-wide steps that need to be taken 1109N/A # record that package states are consistent 1109N/A """Used to save unexpected files or directories found during 1057N/A plan execution. Salvaged items are tracked in the imageplan. 1057N/A # get just the file path that was salvaged 679N/A """move unpackaged contents to specified destination""" 679N/A # remove leading / if present