pkgplan.py revision 50
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc# CDDL HEADER START
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc# The contents of this file are subject to the terms of the
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc# Common Development and Distribution License (the "License").
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc# You may not use this file except in compliance with the License.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc# See the License for the specific language governing permissions
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc# and limitations under the License.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc# When distributing Covered Code, include this CDDL HEADER in each
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc# If applicable, add the following below this CDDL HEADER, with the
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc# fields enclosed by brackets "[]" replaced with your own identifying
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc# information: Portions Copyright [yyyy] [name of copyright owner]
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc# CDDL HEADER END
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
0ba2cbe97e0678a691742f98d2532caed0a2c4aaxc# Use is subject to license terms.
f4b3ec61df05330d25f55a36b975b4d7519fdeb1dh """A package plan takes two package FMRIs and an Image, and produces the
f4b3ec61df05330d25f55a36b975b4d7519fdeb1dh set of actions required to take the Image from the origin FMRI to the
f4b3ec61df05330d25f55a36b975b4d7519fdeb1dh destination FMRI."""
bcb5c89da22515e2ccf139578bad3caebcd716adSowmini Varadhan def propose_destination(self, fmri, manifest):
afdda45f890ee5dfc86e5131a30b11b354d51633Vasumathi Sundaram - Sun Microsystems if self.origin_fmri == None:
e7801d59e8ceda0cde8ebdfdddd7582ee2ea96efsowmini if not self.origin_fmri.is_same_pkg(self.destination_fmri):
d62bc4badc1c1f1549c961cfb8b420e650e1272byz # if origin unset, determine if we're dealing with an previously
d62bc4badc1c1f1549c961cfb8b420e650e1272byz # installed version or if we're dealing with the null package
e7801d59e8ceda0cde8ebdfdddd7582ee2ea96efsowmini f = self.image.get_version_installed(self.destination_fmri)
e7801d59e8ceda0cde8ebdfdddd7582ee2ea96efsowmini # if null package, then our plan is the set of actions for the
d62bc4badc1c1f1549c961cfb8b420e650e1272byz # destination version
e7801d59e8ceda0cde8ebdfdddd7582ee2ea96efsowmini if f == None:
f4b3ec61df05330d25f55a36b975b4d7519fdeb1dh # if a previous package, then our plan is derived from the
f4b3ec61df05330d25f55a36b975b4d7519fdeb1dh # set differences between the previous manifest's actions and
d62bc4badc1c1f1549c961cfb8b420e650e1272byz # the union of the destination manifest's actions with the
d62bc4badc1c1f1549c961cfb8b420e650e1272byz # critical actions of the critical versions in the version
d62bc4badc1c1f1549c961cfb8b420e650e1272byz # interval between origin and destination.
e7801d59e8ceda0cde8ebdfdddd7582ee2ea96efsowmini # retrieval step
e7801d59e8ceda0cde8ebdfdddd7582ee2ea96efsowmini # record that we are in an intermediate state
3fd94f8c011031b38162a1db3b554de4371c167fam # record that package states are consistent