catalog.py revision 36
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk# CDDL HEADER START
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk# The contents of this file are subject to the terms of the
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk# Common Development and Distribution License (the "License").
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk# You may not use this file except in compliance with the License.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk# See the License for the specific language governing permissions
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk# and limitations under the License.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk# When distributing Covered Code, include this CDDL HEADER in each
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk# If applicable, add the following below this CDDL HEADER, with the
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk# fields enclosed by brackets "[]" replaced with your own identifying
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk# information: Portions Copyright [yyyy] [name of copyright owner]
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk# CDDL HEADER END
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk# Use is subject to license terms.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk """A Catalog is the representation of the package FMRIs available to
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk this client or repository. Both purposes utilize the same storage
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk The serialized structure of the repository is an unordered list of
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk available package versions, followed by an unordered list of
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk incorporation relationships between packages. This latter section
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk allows the graph to be topologically sorted by the client.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk XXX It would be nice to include available tags and package sizes,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk although this could also be calculated from the set of manifests.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk # each V line is an fmri
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk if m == None:
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk # for each version in the package,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk # for each incorporation in the version,
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk # add to the version's list of incorporations
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk """Iterate through the catalog's, looking for an fmri match."""
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk # XXX FMRI-based implementation doesn't do pattern matching, but
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk # exact matches only.
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk raise KeyError, "%s not found in catalog" % pfmri
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk s = s + "I %s\n" % r
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk """Return a pair of lists, the first list being those package
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk FMRIs present in the current object but not in the presented
5b64d5d44892834ba97f003080f3467299b7c5c5jeff.schenk catalog, the second being those present in the presented catalog
dff2cc5646d4437ab9e0cb1dcb59da65462a5938jeff.schenk but not in the current catalog."""