pkgplan.py revision 2693
50N/A# The contents of this file are subject to the terms of the 50N/A# Common Development and Distribution License (the "License"). 50N/A# You may not use this file except in compliance with the License. 50N/A# See the License for the specific language governing permissions 50N/A# and limitations under the License. 50N/A# When distributing Covered Code, include this CDDL HEADER in each 50N/A# If applicable, add the following below this CDDL HEADER, with the 50N/A# fields enclosed by brackets "[]" replaced with your own identifying 50N/A# information: Portions Copyright [yyyy] [name of copyright owner] 2627N/A# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 50N/A """A package plan takes two package FMRIs and an Image, and produces the 50N/A set of actions required to take the Image from the origin FMRI to the 66N/A If the destination FMRI is None, the package is removed. 2690N/A # we don't serialize __xferfiles or __xfersize since those should be 2690N/A # recalculated after after a plan is loaded (since the contents of the 2690N/A # download cache may have changed). 2690N/A # we don't serialize __origin_mfst, __destination_mfst, or 2690N/A # __repair_actions since we only support serializing pkgplans which 2690N/A # have had their actions evaluated and merged, and when action 2690N/A # evaluation is complete these fields are cleared. 2690N/A # we don't serialize our image object pointer. that has to be reset 2690N/A # after this object is reloaded. 2690N/A # make sure all __state__noserialize values are valid 2690N/A # figure out which state we are saving. 2690N/A # describe our state and the types of all objects 2690N/A """Returns the serialized state of this object in a format 2690N/A that that can be easily stored using JSON, pickle, etc.""" 2690N/A # validate unserialized state 2690N/A # (see comments above __state__noserialize) 2690N/A # we use __slots__, so create a state dictionary 2690N/A """Update the state of this object using previously serialized 2690N/A state obtained via getstate().""" 2690N/A # get the name of the object we're dealing with 2690N/A # decode serialized state into python objects 2690N/A # we use __slots__, so directly update attributes 2690N/A # update unserialized state 2690N/A # (see comments above __state__noserialize) 2690N/A """Allocate a new object using previously serialized state 2690N/A obtained via getstate().""" 1618N/A """Adds a license status entry for the given src and dest 1618N/A 'src' should be None or the source action for a license. 1618N/A 'dest' must be the destination action for a license.""" 1505N/A """Propose origin and dest fmri, manifest""" 1505N/A # I'd like a cleaner solution than this; we need to actually 2453N/A # construct a list of actions as things currently are rather 2453N/A # than just re-applying the current set of actions. 583N/A # Create a list of (src, dst) pairs for the actions to send to 2453N/A # dest is none for removals. 307N/A """ updates a set of installed fmris to reflect 66N/A """Determine the actions required to transition the package.""" 2026N/A # If new actions are being installed, check the destination 2261N/A # Since user removed publisher, assume this is 2261N/A # the same as if they had set signature-policy 2261N/A # ignore for the publisher. 2261N/A # Only perform signature verification logic if 2261N/A # there are signatures or if signature-policy 2458N/A "check-certificate-revocation"))
307N/A # figure out how many implicit directories disappear in this 307N/A # transition and add directory remove actions. These won't 307N/A # do anything unless no pkgs reference that directory in 1045N/A # Retrieving origin_dirs first and then checking it for any 1045N/A # entries allows avoiding an unnecessary expanddirs for the 1045N/A # destination manifest when it isn't needed. 2277N/A # Manifest.get_directories() returns implicit directories, which 2277N/A # means that this computation ends up re-adding all the explicit 2277N/A # directories getting removed to the removed list. This is 400N/A # Stash information needed by legacy actions. 2453N/A # Add any install repair actions to the update list 2453N/A # Initial installs require acceptance. 2117N/A # If src action required acceptance, 2117N/A # then license was already accepted 2117N/A # before, and if the hashes are the 2117N/A # same for the license payload, then 2117N/A # it doesn't need to be accepted again. 1618N/A """A generator function that yields tuples of the form (license, 1618N/A entry). Where 'entry' is a dict containing the license status 1618N/A """Sets the license status for the given license entry. 1618N/A 'plicense' should be the value of the license attribute for the 1618N/A destination license action. 1618N/A 'accepted' is an optional parameter that can be one of three 1618N/A None leaves accepted status unchanged 1618N/A False sets accepted status to False 1618N/A True sets accepted status to True 1618N/A 'displayed' is an optional parameter that can be one of three 1618N/A None leaves displayed status unchanged 1618N/A False sets displayed status to False 1618N/A True sets displayed status to True""" 2407N/A """Return tuple of compressed bytes possibly downloaded 2407N/A and number of bytes laid down; ignore removals 2407N/A because they're usually pinned by snapshots""" 388N/A """Perform actions required prior to installation or removal of 66N/A This method executes each action's preremove() or preinstall() 66N/A methods, as well as any package-wide steps that need to be taken 1618N/A # Determine if license acceptance requirements have been met as 481N/A """Download data for any actions that need it.""" 2690N/A """Load previously downloaded data for actions that need it.""" 237N/A """ perform action for installation of package""" 1755N/A # Don't log these as they're expected, and should be 1618N/A """ handle action updates""" 1755N/A # Don't log these as they're expected, and should be 237N/A """ handle action removals""" 1755N/A # Don't log these as they're expected, and should be 400N/A """Perform actions required after install or remove of a pkg. 66N/A This method executes each action's postremove() or postinstall() 66N/A methods, as well as any package-wide steps that need to be taken 66N/A # record that package states are consistent 2293N/A """Used to save unexpected files or directories found during 2293N/A plan execution. Salvaged items are tracked in the imageplan. 2470N/A # get just the file path that was salvaged 2470N/A """move unpackaged contents to specified destination""" 2470N/A # remove leading / if present