catalog.py revision 45
23N/A# The contents of this file are subject to the terms of the 23N/A# Common Development and Distribution License (the "License"). 23N/A# You may not use this file except in compliance with the License. 23N/A# See the License for the specific language governing permissions 23N/A# and limitations under the License. 23N/A# When distributing Covered Code, include this CDDL HEADER in each 23N/A# If applicable, add the following below this CDDL HEADER, with the 23N/A# fields enclosed by brackets "[]" replaced with your own identifying 23N/A# information: Portions Copyright [yyyy] [name of copyright owner] 23N/A# Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23N/A# Use is subject to license terms. 34N/A """A Catalog is the representation of the package FMRIs available to 34N/A this client or repository. Both purposes utilize the same storage 26N/A The serialized structure of the repository is an unordered list of 26N/A available package versions, followed by an unordered list of 26N/A incorporation relationships between packages. This latter section 26N/A allows the graph to be topologically sorted by the client. 50N/A XXX A authority mirror-uri ... 50N/A XXX Mirroring records also need to be allowed from client configuration, 26N/A and not just catalogs. 26N/A XXX It would be nice to include available tags and package sizes, 59N/A although this could also be calculated from the set of manifests. 59N/A XXX self.pkgs should be a dictionary, accessed by fmri string (or 59N/A package name). Current code is O(N_packages) O(M_versions), should be 59N/A O(1) O(M_versions), and possibly O(1) O(1). 23N/A # each V line is an fmri 50N/A # XXX This package is already in the catalog 50N/A # with some version set. Are we updating the 50N/A # version set or merging the two? 36N/A """Iterate through the catalog's, looking for an fmri match.""" 36N/A # XXX FMRI-based implementation doesn't do pattern matching, but 36N/A # exact matches only. 50N/A s = s +
"I %s\n" % r
50N/A """Return a pair of lists, the first list being those package 50N/A FMRIs present in the current object but not in the presented 50N/A catalog, the second being those present in the presented catalog 50N/A but not in the current catalog.""" 24N/A "pkg:/test@1.0,5.10-1:105",
50N/A "pkg:/test@1.0,5.11-1:50",
50N/A "pkg:/test@1.0,5.11-2",
26N/A "pkg:/test@1.0,5.11-3"